Skip to content

Commit dc5e776

Browse files
committed
feat(api): add SDK version to API requests user agent
1 parent 2d6150f commit dc5e776

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/services/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
export class APIService {
1212
public readonly baseUrl = "https://api.squarecloud.app";
1313
public readonly version: APIVersion<1 | 2> = "v2";
14+
public readonly sdkVersion: string = require("../../package.json").version;
1415
public readonly userId: string;
1516

1617
constructor(protected readonly apiKey: string) {
@@ -63,6 +64,7 @@ export class APIService {
6364
Accept: "application/json",
6465
...(init.headers || {}),
6566
Authorization: this.apiKey,
67+
"User-Agent": `squarecloud-sdk-js/${this.sdkVersion}`,
6668
};
6769

6870
const url = new URL(path, `${this.baseUrl}/${this.version}/`);

0 commit comments

Comments
 (0)