@microbitsclub/microbits-client
Version:
Microbits API client
40 lines (39 loc) • 1.3 kB
TypeScript
export declare type APIResponse<TOk> = {
type: 'ok';
ok: TOk;
} | {
type: 'error';
error: string;
};
export declare namespace APIResponse {
interface GetUserSessionByIdData {
id: string;
isActivated: boolean;
}
type GetUserSessionById = APIResponse<GetUserSessionByIdData | null>;
interface GetPaywallByIdData {
id: string;
name: string;
price: number;
referralPrice: number | null;
url: string;
isGroup: boolean;
merchantId: string;
}
type GetPaywallById = APIResponse<GetPaywallByIdData>;
type GetPaywallByContentUrlData = GetPaywallByIdData;
type GetPaywallByContentUrl = APIResponse<GetPaywallByContentUrlData>;
interface CreatePaywallPurchaseData {
id: string;
when: Date;
purchaserId: string;
paywallId: string;
contentUrl: string;
price: number;
}
type CreatePaywallPurchase = APIResponse<CreatePaywallPurchaseData>;
type IsUserSessionAuthorizedForPaywallData = boolean;
type IsUserSessionAuthorizedForPaywall = APIResponse<IsUserSessionAuthorizedForPaywallData>;
type ActivateUserSession = APIResponse<GetUserSessionByIdData>;
type GetPaywallPurchase = APIResponse<CreatePaywallPurchaseData>;
}