@takaro/apiclient 0.0.0-dev.f76d332 → 0.0.0-dev.f94005c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,11 +23,17 @@ export class BaseApiClient<T extends IBaseApiClientConfig> {
23
23
  };
24
24
 
25
25
  constructor(protected readonly config: T) {
26
+ // Browsers refuse to let JS set the User-Agent header (it's a "forbidden header").
27
+ // Only include it when running outside a browser context (Node.js / server-side).
28
+ // Use globalThis so this compiles under both DOM and non-DOM TypeScript lib targets.
29
+ const isBrowser =
30
+ typeof (globalThis as Record<string, unknown>)['window'] !== 'undefined' &&
31
+ typeof (globalThis as Record<string, unknown>)['document'] !== 'undefined';
26
32
  const axiosConfig: AxiosRequestConfig = {
27
33
  baseURL: this.config.url,
28
34
  headers: {
29
35
  'Content-Type': 'application/json',
30
- 'User-Agent': 'Takaro-API-Client',
36
+ ...(!isBrowser && { 'User-Agent': 'Takaro-API-Client' }),
31
37
  },
32
38
  withCredentials: true,
33
39
  };
package/src/lib/client.ts CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  EventApi,
15
15
  PlayerOnGameServerApi,
16
16
  ItemApi,
17
- StatsApi,
18
17
  ShopOrderApi,
19
18
  ShopListingApi,
20
19
  ShopCategoryApi,
@@ -22,6 +21,7 @@ import {
22
21
  TrackingApi,
23
22
  EntityApi,
24
23
  AnalyticsApi,
24
+ InviteLinkApi,
25
25
  } from '../generated/api.js';
26
26
  import { BaseApiClient, IBaseApiClientConfig } from './baseClient.js';
27
27
 
@@ -237,16 +237,6 @@ export class Client extends BaseApiClient<IApiClientConfig> {
237
237
  );
238
238
  }
239
239
 
240
- get stats() {
241
- return new StatsApi(
242
- {
243
- isJsonMime: this.isJsonMime,
244
- },
245
- '',
246
- this.axios,
247
- );
248
- }
249
-
250
240
  get shopListing() {
251
241
  return new ShopListingApi(
252
242
  {
@@ -316,4 +306,14 @@ export class Client extends BaseApiClient<IApiClientConfig> {
316
306
  this.axios,
317
307
  );
318
308
  }
309
+
310
+ get inviteLink() {
311
+ return new InviteLinkApi(
312
+ {
313
+ isJsonMime: this.isJsonMime,
314
+ },
315
+ '',
316
+ this.axios,
317
+ );
318
+ }
319
319
  }