@sethub/sdk
Version:
<div align="center"> <h1> SetHub SDK </h1>
43 lines (42 loc) • 1.25 kB
TypeScript
import type { Authentication } from '../../services/authentication/protocols/authentication';
export declare namespace SetHubProtocols {
export type RefreshAccessTokenOutput = {
access_token: string;
refresh_token: string;
};
type AuthenticationStorage = {
store: (authentication: Authentication) => Promise<void>;
get: () => Promise<Authentication | null>;
remove: () => Promise<void>;
};
export type Client = {
id: string;
name: string;
version: string;
};
export type Platform = {
name: string;
version?: string;
};
export type Options = {
baseURL: string;
client: Client;
platform: Platform;
onLogout?: () => void;
authenticationStore?: AuthenticationStorage;
logRequests?: boolean;
};
export type ErrorCodes = 'token.expired' | 'internal';
export type FailureResponse<Code = ErrorCodes> = {
code: Code;
message: string;
};
export type Response<Success = unknown, Failure extends FailureResponse = FailureResponse> = {
data: Success;
error: null;
} | {
data: null;
error: Failure;
};
export {};
}