diff --git a/.changeset/big-turtles-tickle.md b/.changeset/big-turtles-tickle.md new file mode 100644 index 0000000..7b040c9 --- /dev/null +++ b/.changeset/big-turtles-tickle.md @@ -0,0 +1,5 @@ +--- +'@blizzard-api/client': patch +--- + +Update types in client after updates in core, and expose the types diff --git a/packages/client/src/client/index.ts b/packages/client/src/client/index.ts index 7584864..96b5321 100644 --- a/packages/client/src/client/index.ts +++ b/packages/client/src/client/index.ts @@ -1,11 +1,12 @@ import { stringify } from 'node:querystring'; import { getEndpoint } from '@blizzard-api/core'; -import type { Origins, Locales, ClientOptions, ResourceResponse, Resource } from '@blizzard-api/core'; +import type { Origins, Locales, ResourceResponse, Resource } from '@blizzard-api/core'; import type { AxiosResponse } from 'axios'; import axios from 'axios'; import type { AccessToken, AccessTokenRequestArguments, + ClientOptions, IBlizzardApiClient, ValidateAccessTokenArguments, ValidateAccessTokenResponse, @@ -33,7 +34,10 @@ export class BlizzardApiClient implements IBlizzardApiClient { public axios = axios.create(); - public getRequestUrl(resource: Resource, options?: Partial) { + public getRequestUrl( + resource: Resource, + options?: Partial, + ) { const config = { ...this.defaults, ...options }; const endpoint = getEndpoint(config.origin, config.locale); @@ -42,8 +46,8 @@ export class BlizzardApiClient implements IBlizzardApiClient { return `${endpoint.hostname}${backslashSeparator}${resource.path}`; } - public getRequestConfig( - resource: Resource, + public getRequestConfig( + resource: Resource, options?: Partial, headers?: Record, ) { @@ -67,8 +71,8 @@ export class BlizzardApiClient implements IBlizzardApiClient { }; } - public sendRequest( - resource: Resource, + public sendRequest( + resource: Resource, options?: Partial, headers?: Record, ): ResourceResponse> { diff --git a/packages/client/src/client/types.ts b/packages/client/src/client/types.ts index 4a0daa7..4c6d990 100644 --- a/packages/client/src/client/types.ts +++ b/packages/client/src/client/types.ts @@ -1,4 +1,4 @@ -import type { Origins } from '@blizzard-api/core'; +import type { Locales, Origins } from '@blizzard-api/core'; import type { AxiosResponse } from 'axios'; export interface AccessToken { @@ -28,6 +28,14 @@ export interface ValidateAccessTokenResponse { client_id: string; } +export interface ClientOptions { + key: string; + secret: string; + origin: Origins; + locale?: Locales; + token?: string; +} + export interface IBlizzardApiClient { getAccessToken: (options: AccessTokenRequestArguments) => Promise>; setAccessToken: (token: string) => void; diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 3e38f50..04e1838 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -1 +1,2 @@ export { BlizzardApiClient } from './client/index.js'; +export * from './client/types';