UNPKG

@microbitsclub/microbits-client

Version:
39 lines (38 loc) 1.21 kB
export declare type APIResult<TOk, TError> = { type: 'ok'; ok: TOk; } | { type: 'error'; error: TError; }; export declare type APIResulOk<T> = T extends APIResult<infer TOk, any> ? TOk : never; export declare namespace APIResponse { interface UserSession { id: string; isActivated: boolean; } interface Paywall { id: string; name: string; price: number; referralPrice: number | null; url: string; isGroup: boolean; merchantId: string; } interface PaywallPurchase { id: string; when: Date; purchaserId: string; paywallId: string; contentUrl: string; price: number; } type GetPaywallById = APIResult<Paywall | null, string>; type GetPaywallByContentUrl = APIResult<Paywall | null, string>; type GetUserSessionById = APIResult<UserSession | null, string>; type IsUserSessionAuthorizedForPaywall = APIResult<boolean, string>; type ActivateUserSession = APIResult<UserSession, string>; type CreatePaywallPurchase = APIResult<PaywallPurchase, string>; type GetPaywallPurchase = APIResult<PaywallPurchase | null, string>; }