@opexa/portal-sdk
v0.0.159
Published
A library that provides a set of functions to interact with Opexa Portal API.
Downloads
2,245
Readme
Opexa Portal SDK
A library that provides a set of functions to interact with Opexa Portal API.
Installation
npm install @opexa/portal-sdk
Usage
- Create sdk instance
// lib/sdk.js
import Sdk from '@opexa/portal-sdk';
export const sdk = new Sdk({
platform: 'Z892',
environment: 'development',
});
- Use sdk instance
import { sdk } from '$lib/sdk';
import * as React from 'react';
function Page() {
const [account, setAccount] = React.useState();
React.useEffect(function () {
sdk.account().then(setAccount);
}, []);
return (
<pre>
<code>{JSON.stringify(account, null, 2)}</code>
</pre>
);
}
API
Sdk
Sdk
accepts the following options:
*site
- The site ID to be used*sitePlatform
- The site platform ID to be used*platform
- The platform code to be used*environment
- Whether to use production/development api
, and returns the following methods:
signIn
- Start user sessionsignIn(input: SignInInput): Promise<SignInReturn>
type SignInInput = | { type: 'NAME_AND_PASSWORD'; name: string; password: string; } | { type: 'MOBILE_NUMBER'; mobileNumber: string; verificationCode: string; }; type SignInReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'AccountNotFound'; message: string; }; };
signOut
- End current user sessionsignOut(): Promise<void>
site
- Retrieve site detailssite(): Promise<SiteReturn>
interface Site { id: string; name: string; logo?: string; }
type SiteReturn = | { ok: true; data: Site; } | { ok: false; error: HttpError; };
platform
- Retrieve current platform detailsplatform(): Promise<PlatformReturn>
interface Platform { paymentSettings: { minimumFirstDepositAmount?: number; restrictWithdrawalsToVerifiedMembers: boolean; depositGateway: { bank: GatewaySettings; gcash: GatewaySettings; maya: GatewaySettings; mayaApp: GatewaySettings; }; withdrawalGateway: { bank: GatewaySettings; gcash: GatewaySettings; maya: GatewaySettings; mayaApp: GatewaySettings; }; }; pointsClubSettings: { multiplier: number; }; } type PlatformReturn = | { ok: true; data: Platform; } | { ok: false; error: HttpError; };
account
- Retrieve current user's detailsaccount(): Promise<AccountReturn>
interface Account { id: string; name: string; status: MemberAccountStatus; realName?: string; nickName?: string; dateOfBirth?: Date; validId?: string; emailAddress?: string; mobileNumber?: string; verified: boolean; verificationStatus: MemberAccountVerificationStatus; mobileNumberVerified: boolean; mobileNumberVerificationRequired: boolean; transactionPassword: boolean; dateTimeLastActive?: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type AccountReturn = | { ok: true; data: Account; } | { ok: false; error: HttpError; };
createAccount
- Create new user accountcreateAccount(input: CreateAccountInput): Promise<CreateAccountReturn>
interface CreateAccountInput { id?: string; name: string; password: string; mobileNumber: string; dateOfBirth: string; btag?: string; domain?: string; referralCode?: string; verificationCode?: string; reCAPTCHAResponse?: string; } type CreateAccountReturn = | { ok: true; error?: never; data: { id: string; }; } | { ok: false; data?: never; error: | HttpError | { name: | 'AccountNameNotAvailableError' | 'InvalidPlatformError' | 'InvalidReCAPTCHAResponseError' | 'InvalidSMSVerificationCodeError' | 'MinimumAgeRequirementError' | 'MobileNumberNotAvailableError'; message: string; }; };
updateAccount
- Update current user's detailsupdateAccount(input: UpdateAccountInput): Promise<UpdateAccountReturn>
type UpdateAccountReturn = | { ok: true; data?: never; error?: never; } | { ok: false; data?: never; error: { name: | 'AccountNameNotAvailableError' | 'EmailAddressNotAvailableError' | 'InvalidTransactionPasswordError' | 'MobileNumberNotAvailableError' | 'NickNameNotAvailableError' | 'RealNameAlreadySetError' | 'ValidIdAlreadySetError'; message: string; }; };
deleteAccount
- Delete current user's accountdeleteAccount(id: string): Promise<DeleteAccountReturn>
type DeleteAccountReturn = | { ok: true; } | { ok: false; error: UnknownError | HttpError; };
resetPassword
- Reset user's passwordresetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>
interface ResetPasswordInput { mobileNumber: string; newPassword: string; verificationCode: string; } type ResetPasswordReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'AccountNotFoundError' | 'InvalidVerificationCodeError'; message: string; }; };
verificationDetails
- Retrieve user's verification detailsverificationDetails(): Promise<VerificationDetailsReturn>
interface VerificationDetails { id: string; status: MemberVerificationStatus; address: string; sourceOfIncome: string; natureOfWork: string; nationality: string; placeOfBirth: string; idFrontImage: File; selfieImage: File; } type VerificationDetailsReturn = | { ok: true; data: VerificationDetails; } | { ok: false; error: HttpError; };
submitVerificationDetails
- Submit current user's verification detailssubmitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>
interface SubmitVerificationDetailsInput { id?: string; idFrontImage: string; selfieImage: string; address: string; sourceOfIncome: string; natureOfWork: string; nationality: string; placeOfBirth: string; } type SubmitVerificationDetailsReturn = | { ok: true; data: { id: string; }; } | { ok: false; error: | HttpError | { name: | 'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyExistsError'; message: string; }; };
updateVerificationDetails
- Update current user's verification detailsupdateVerificationDetails(input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>
interface UpdateVerificationDetailsInput { idFrontImage: string; selfieImage: string; address: string; permanentAddress: string; sourceOfIncome: string; natureOfWork: string; nationality: string; placeOfBirth: string; } type UpdateVerificationDetailsReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: | 'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyApprovedError' | 'MemberVerificationDoesNotExistError'; message: string; }; };
verifyMobileNumber
- Verify current user's mobile numberverifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>
type VerifyMobileNumberReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError'; message: string; }; };
profileCompletion
- Retrieve current user's profile completion statusprofileCompletion(): Promise<ProfileCompletionReturn>
interface ProfileCompletion { completionPercentage: number; personalInformation: boolean; accountVerification: boolean; mobileNumberVerification: boolean; transactionPassword: boolean; accountPassword: boolean; } type ProfileCompletionReturn = | { ok: true; data: ProfileCompletion; } | { ok: false; error: HttpError; };
sendVerificationCode
- Send verification code to mobile number or email addresssendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>
type SendVerificationCodeReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError'; message: string; }; };
wallet
- Retrieve current user's wallet detailswallet(): Promise<WalletReturn>
interface Wallet { id: string; balance: number; currency: Currency; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type WalletReturn = | { ok: true; data: Wallet | null; } | { ok: false; error: HttpError; };
announcements
- Retrieve announcements for current platformannouncements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>
interface AnnouncementsInput { first?: number; after?: string; } interface Announcement { id: string; type: 'RELEASE' | 'SCHEDULED_MAINTENANCE'; title: string; status: 'ACTIVE' | 'INACTIVE'; message: string; activationStartDateTime: Date; activationEndDateTime: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type AnnouncementsReturn = | { ok: true; data: { announcements: (Announcement & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
createWithdrawal
- Create new withdrawal requestcreateWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>
interface CreateBankWithdrawalInput { id?: string; type: 'BANK'; amount: number; transactionPassword: string; } interface CreateGCashWithdrawalInput { id?: string; type: 'GCASH'; amount: number; transactionPassword: string; recipientMobileNumber: string; } interface CreateMayaWithdrawalInput { id?: string; type: 'MAYA'; amount: number; transactionPassword: string; recipientMobileNumber: string; } interface CreateMayaAppWithdrawalInput { id?: string; type: 'MAYA_APP'; amount: number; transactionPassword: string; } type CreateWithdrawalInput = | CreateBankWithdrawalInput | CreateGCashWithdrawalInput | CreateMayaWithdrawalInput | CreateMayaAppWithdrawalInput; type CreateWithdrawalReturn = | { ok: true; data: { id: string; }; } | { ok: false; error: | HttpError | { name: | 'MobileNumberNotVerifiedError' | 'AccountNotVerifiedError' | 'InvalidWithdrawalAmountError' | 'WithdrawalDailyLimitExceededError' | 'InvalidTransactionPasswordError' | 'NotEnoughBalanceError'; message: string; }; };
withdrawalRecords
- Retrieve current user's withdrawal recordswithdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA'; type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED'; interface WithdrawalRecordsInput { first?: number; after?: string; filter?: { type?: { equal?: WithdrawalRecordType; notEqual?: WithdrawalRecordType; in?: WithdrawalRecordType[]; notIn?: WithdrawalRecordType[]; }; status?: { equal?: WithdrawalRecordStatus; notEqual?: WithdrawalRecordStatus; in?: WithdrawalRecordStatus[]; notIn?: WithdrawalRecordStatus[]; }; reference?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; withdrawalNumber?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; dateTimeCreated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; dateTimeLastUpdated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; }; } interface WithdrawalRecord { id: string; type: WithdrawalRecordType; bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1'; fee: number; amount: number; netAmount: number; status: WithdrawalRecordStatus; reference?: string; withdrawalNumber: string; recipientMobileNumber?: string; dateTimeConfirmed?: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type WithdrawalRecordsReturn = | { ok: true; data: { withdrawalRecords: (WithdrawalRecord & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
remainingDailyWithdrawalsCount
- Retrieve current user's remaining daily withdrawals countremainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
type RemainingDailyWithdrawalsCountReturn = | { ok: true; data: number; } | { ok: false; error: HttpError; };
createDeposit
- Create new deposit requestcreateDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
interface CreateMayaDepositInput { id?: string; type: 'MAYA'; amount: number; promo?: string; } interface CreateGCashDepositInput { id?: string; type: 'GCASH'; amount: number; promo?: string; } interface CreateMayaAppDepositInput { id?: string; type: 'MAYA_APP'; amount: number; promo?: string; } type CreateDepositInput = | CreateMayaDepositInput | CreateGCashDepositInput | CreateMayaAppDepositInput; type CreateDepositReturn = | { ok: true; data: { id: string; }; } | { ok: false; error: | HttpError | { name: | 'DepositPromoMaximumAmountExceededError' | 'DepositPromoMinimumAmountNotMetError' | 'HasActiveBonusError' | 'MaximumDepositAmountExceededError' | 'MinimumDepositAmountNotMetError' | 'MinimumFirstDepositAmountNotMetError' | 'PromoNotEnabledError' | 'WalletDoesNotExistError'; message: string; }; };
deposit
- Retrieve deposit detailsdeposit(id: string): Promise<DepositReturn>
interface Deposit { id: string; type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP'; status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED'; amount: number; netAmount: number; fee: number; reference?: string; checkoutUrl?: string; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type DepositReturn = | { ok: true; data: Deposit | null; } | { ok: false; error: HttpError; };
depositRecords
- Retrieve current user's deposit recordsdepositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP'; type DepositRecordStatus = | 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED'; interface DepositRecordsInput { first?: number; after?: string; filter?: { type?: { equal?: DepositRecordType; notEqual?: DepositRecordType; in?: DepositRecordType[]; notIn?: DepositRecordType[]; }; status?: { equal?: DepositRecordStatus; notEqual?: DepositRecordStatus; in?: DepositRecordStatus[]; notIn?: DepositRecordStatus[]; }; reference?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; depositNumber?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; dateTimeCreated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; dateTimeLastUpdated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; }; } interface DepositRecord { id: string; type: DepositRecordType; status: DepositRecordStatus; amount: number; netAmount: number; fee: number; reference?: string; depositNumber: string; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type DepositRecordsReturn = | { ok: true; data: { depositRecords: (DepositRecord & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
depositsCount
- Retrieve current user's deposits countdepositsCount(): Promise<DepositsCountReturn>
type DepositsCountReturn = | { ok: true; data: number; } | { ok: false; error: HttpError; };
betRecords
- Retrieve current user's bet recordsbetRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED'; interface BetRecordsInput { first?: number; after?: string; sort?: SortOrder; filter?: { serialCode?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; game?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; }; game__externalId?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; game__type?: { equal?: GameType; notEqual?: GameType; in?: GameType[]; notIn?: GameType[]; }; game__provider?: { equal?: GameProvider; notEqual?: GameProvider; in?: GameProvider[]; notIn?: GameProvider[]; }; dateTimeCreated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; vendorRoundId?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; status?: { equal?: BetRecordStatus; notEqual?: BetRecordStatus; in?: BetRecordStatus[]; notIn?: BetRecordStatus[]; }; }; startDateTime?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; endDateTime?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; } interface BetRecord { id: string; game: Game; status: BetRecordStatus; serialCode: string; vendorRoundId?: string; bet: number; payout: number; validBet: number; jackpotContribution: number; jackpotPayout: number; winloss?: number; betContent?: string; contestName?: string; externalCategory?: string; dateTimeSettled?: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; metadata: { odds?: string; validBet?: number; }; } type BetRecordsReturn = | { ok: true; data: { betRecords: (BetRecord & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
transactionRecords
- Retrieve current user's transaction recordstransactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
type TransactionRecordType = | 'DEPOSIT' | 'PAYOUT' | 'WITHDRAWAL_REFUND' | 'TRANSFER_IN' | 'WITHDRAWAL' | 'BET' | 'TRANSFER_OUT' | 'ROLLBACK' | 'BET_REFUND' | 'PAYOUT_REFUND' | 'CASHBACK_BONUS' | 'BONUS' | 'RESERVE' | 'REJECT_WITHDRAWAL' | 'MANUAL_DEPOSIT' | 'GCASH_DEPOSIT' | 'MANUAL_WITHDRAWAL' | 'BANK_WITHDRAWAL' | 'GCASH_WITHDRAWAL' | 'COMMIT_RESERVE' | 'ROLLBACK_PAYOUT' | 'ROLLBACK_RESERVE'; interface TransactionRecordsInput { first?: number; after?: string; filter?: { type?: { equal?: TransactionRecordType; notEqual?: TransactionRecordType; in?: TransactionRecordType[]; notIn?: TransactionRecordType[]; }; referenceNumber?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; dateTimeCreated?: { equal?: Date | string; notEqual?: Date | string; in?: Date | string[]; notIn?: Date | string[]; lesserThan?: Date | string; lesserThanOrEqual?: Date | string; greaterThan?: Date | string; greaterThanOrEqual?: Date | string; }; }; } interface TransactionRecord { id: string; type: TransactionRecordType; amount: number; content?: string; currentBalance: number; referenceNumber: string; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type TransactionRecordsReturn = | { ok: true; data: { transactionRecords: (TransactionRecord & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
promos
- Retrieve promos for current platformpromos(): Promise<PromosReturn>
interface Promo { id: string; type: 'DEPOSIT'; name: string; banner: { id: string; url: string; status: 'READY'; dateTimeCreated: Date; }; status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED'; description: string; minimumBonusAmount?: number; maximumBonusAmount?: number; minimumDepositAmount?: number; maximumDepositAmount?: number; activationStartDateTime: Date; activationEndDateTime: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type PromosReturn = | { ok: true; data: Promo[]; } | { ok: false; error: HttpError; };
availablePromos
- Retrieve available promos for current useravailablePromos(): Promise<PromosReturn>
bonus
- Retrieve current user's bonus detailsbonus(): Promise<BonusReturn>
interface Bonus { id: string; promo: Promo; deposit?: { type: DepositRecordType; status: DepositRecordStatus; amount: number; netAmount: number; fee: number; reference?: string; dateTimeCreated: Date; dateTimeLastUpdated: Date; }; amount: number; balance: number; turnoverRequirement: number; currentTurnoverRequirementContribution: number; currentTurnoverRequirementContributionPercentage: number; expiration: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type BonusReturn = | { ok: true; data: Bonus | null; } | { ok: false; error: HttpError; };
cashbacks
- Retrieve cashbacks for current platformcashbacks(): Promise<CashbackReturn>
interface Cashback { id: string; name: string; banner: { id: string; url: string; status: 'READY'; dateTimeCreated: Date; }; status: CashbackStatus; description: string; activationStartDateTime: Date; activationEndDateTime: Date; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type CashbackReturn = | { ok: true; data: Cashback[]; } | { ok: false; error: HttpError; };
cashbackBonuses
- Retrieve current user's cashback bonusescashbackBonuses(): Promise<CashbackBonusesReturn>
interface CashbackBonus { id: string; balance: number; cashback: Cashback; dateTimeCreated: Date; dateTimeLastUpdated: Date; } type CashbackBonusesReturn = | { ok: true; data: CashbackBonus[]; } | { ok: false; error: HttpError; };
claimCashbackBonus
- Claim cashback bonusclaimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
type ClaimCashbackBonusReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'CashbackBonusDoesNotExistError'; message: string; }; };
games
- Retrieve gamesgames(input?: GamesInput): Promise<GamesReturn>
type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES'; type GameProvider = | 'JILI' | 'PGSOFT' | 'FACHAI' | 'PLAYTECH' | 'CQ9' | 'JDB' | 'BOOONGO' | 'HABANERO' | 'RELAXGAMING' | 'DG' | 'E2E' | 'BTI' | 'DARWIN' | 'MEGABALL' | 'DRBINGO' | 'RTG'; interface GamesInput { after?: string; first?: number; filter?: { id?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; }; name?: { equal?: string; notEqual?: string; in?: string[]; notIn?: string[]; contains?: string; startsWith?: string; }; type?: { equal?: GameType; notEqual?: GameType; in?: GameType[]; notIn?: GameType[]; }; provider?: { equal?: GameProvider; notEqual?: GameProvider; in?: GameProvider[]; notIn?: GameProvider[]; }; }; } interface Game { id: string; type: GameType; name: string; image: string; provider: GameProvider; } type GamesReturn = | { ok: true; data: { games: (Game & { cursor: string })[]; totalCount: number; hasNextPage: boolean; endCursor?: string; }; } | { ok: false; error: HttpError; };
gameSession
- Retrieve game session detailsgameSession(id: string): Promise<GameSessionReturn>
type GameSession = | { id: string; game: Game; status: 'READY'; launchUrl: string; dateTimeCreated: Date; dateTimeLastUpdated: Date; } | { id: string; game: Game; status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED'; dateTimeCreated: Date; dateTimeLastUpdated: Date; }; type GameSessionReturn = | { ok: true; data: GameSession | null; } | { ok: false; error: HttpError; };
createGameSession
- Create new game sessioncreateGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
interface CreateGameSessionInput { id?: string; game: string; } type CreateGameSessionReturn = | { ok: true; data: { id: string; }; } | { ok: false; error: | HttpError | { name: 'GameDoesNotExistError'; message: string; }; };
endGameSession
- End game sessionendGameSession(id: string): Promise<EndGameSessionReturn>
type EndGameSessionReturn = | { ok: true; } | { ok: false; error: HttpError | UnknownError; };
file
- Retrieve file detailsfile(id: string): Promise<FileReturn>
type File = | { id: string; url?: never; status: 'UPLOADING' | 'FAILED'; dateTimeCreated: Date; } | { id: string; url: string; status: 'READY'; dateTimeCreated: Date; } | { id: string; url?: string; status: 'DELETED'; dateTimeCreated: Date; }; type FileReturn = | { ok: true; data: File | null; } | { ok: false; error: HttpError; };
uploadImageFile
- Upload image fileuploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
type UploadImageFileReturn = | { ok: true; data: { id: string; }; } | { ok: false; error: | HttpError | { name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError'; message: string; }; };
pointsWallet
- Retrieve current user's points wallet detailspointsWallet(): Promise<PointsWalletReturn>
interface PointsWallet { id: string; points: number; account: string; dateTimeCreated: Date; } type PointsWalletReturn = | { ok: true; data: PointsWallet | null; } | { ok: false; error: HttpError; };
pointsToCashConversion
- Convert points to cashpointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
type PointsToCashConversionReturn = | { ok: true; } | { ok: false; error: | HttpError | { name: 'InsufficientPointsError'; message: string; }; };