@opexa/portal-sdk 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,1623 +1,1623 @@
1
- ## Opexa Portal SDK
2
-
3
- A library that provides a set of functions to interact with Opexa Portal API.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @opexa/portal-sdk
9
- ```
10
-
11
- ## Usage
12
-
13
- - Create sdk instance
14
-
15
- ```ts
16
- // lib/sdk.js
17
- import Sdk from '@opexa/portal-sdk';
18
-
19
- export const sdk = new Sdk({
20
- platform: 'Z892',
21
- environment: 'development',
22
- });
23
- ```
24
-
25
- - Use sdk instance
26
-
27
- ```jsx
28
- import { sdk } from '$lib/sdk';
29
- import * as React from 'react';
30
-
31
- function Page() {
32
- const [account, setAccount] = React.useState();
33
-
34
- React.useEffect(function () {
35
- sdk.account().then(setAccount);
36
- }, []);
37
-
38
- return (
39
- <pre>
40
- <code>{JSON.stringify(account, null, 2)}</code>
41
- </pre>
42
- );
43
- }
44
- ```
45
-
46
- ## API
47
-
48
- ### `Sdk`
49
-
50
- `Sdk` accepts the following options:
51
-
52
- - `*site` - The site ID to be used
53
- - `*sitePlatform` - The site platform ID to be used
54
- - `*platform` - The platform code to be used
55
- - `*environment` - Whether to use production/development api
56
-
57
- , and returns the following methods:
58
-
59
- - `signIn` - Start user session
60
-
61
- ```ts
62
- signIn(input: SignInInput): Promise<SignInReturn>
63
- ```
64
-
65
- ```ts
66
- type SignInInput =
67
- | {
68
- type: 'NAME_AND_PASSWORD';
69
- name: string;
70
- password: string;
71
- }
72
- | {
73
- type: 'MOBILE_NUMBER';
74
- mobileNumber: string;
75
- verificationCode: string;
76
- };
77
-
78
- type SignInReturn =
79
- | {
80
- ok: true;
81
- }
82
- | {
83
- ok: false;
84
- error:
85
- | HttpError
86
- | {
87
- name: 'AccountNotFound';
88
- message: string;
89
- };
90
- };
91
- ```
92
-
93
- - `signOut` - End current user session
94
-
95
- ```ts
96
- signOut(): Promise<void>
97
- ```
98
-
99
- - `site` - Retrieve site details
100
-
101
- ```ts
102
- site(): Promise<SiteReturn>
103
- ```
104
-
105
- ```ts
106
- interface Site {
107
- id: string;
108
- name: string;
109
- logo?: string;
110
- }
111
- ```
112
-
113
- ```ts
114
- type SiteReturn =
115
- | {
116
- ok: true;
117
- data: Site;
118
- }
119
- | {
120
- ok: false;
121
- error: HttpError;
122
- };
123
- ```
124
-
125
- - `platform` - Retrieve current platform details
126
-
127
- ```ts
128
- platform(): Promise<PlatformReturn>
129
- ```
130
-
131
- ```ts
132
- interface Platform {
133
- paymentSettings: {
134
- minimumFirstDepositAmount?: number;
135
- restrictWithdrawalsToVerifiedMembers: boolean;
136
- depositGateway: {
137
- bank: GatewaySettings;
138
- gcash: GatewaySettings;
139
- maya: GatewaySettings;
140
- mayaApp: GatewaySettings;
141
- };
142
- withdrawalGateway: {
143
- bank: GatewaySettings;
144
- gcash: GatewaySettings;
145
- maya: GatewaySettings;
146
- mayaApp: GatewaySettings;
147
- };
148
- };
149
- pointsClubSettings: {
150
- multiplier: number;
151
- };
152
- }
153
-
154
- type PlatformReturn =
155
- | {
156
- ok: true;
157
- data: Platform;
158
- }
159
- | {
160
- ok: false;
161
- error: HttpError;
162
- };
163
- ```
164
-
165
- - `account` - Retrieve current user's details
166
-
167
- ```ts
168
- account(): Promise<AccountReturn>
169
- ```
170
-
171
- ```ts
172
- interface Account {
173
- id: string;
174
- name: string;
175
- status: MemberAccountStatus;
176
- realName?: string;
177
- nickName?: string;
178
- dateOfBirth?: Date;
179
- validId?: string;
180
- emailAddress?: string;
181
- mobileNumber?: string;
182
- verified: boolean;
183
- verificationStatus: MemberAccountVerificationStatus;
184
- mobileNumberVerified: boolean;
185
- mobileNumberVerificationRequired: boolean;
186
- transactionPassword: boolean;
187
- dateTimeLastActive?: Date;
188
- dateTimeCreated: Date;
189
- dateTimeLastUpdated: Date;
190
- }
191
-
192
- type AccountReturn =
193
- | {
194
- ok: true;
195
- data: Account;
196
- }
197
- | {
198
- ok: false;
199
- error: HttpError;
200
- };
201
- ```
202
-
203
- - `createAccount` - Create new user account
204
-
205
- ```ts
206
- createAccount(input: CreateAccountInput): Promise<CreateAccountReturn>
207
- ```
208
-
209
- ```ts
210
- interface CreateAccountInput {
211
- id?: string;
212
- name: string;
213
- password: string;
214
- mobileNumber: string;
215
- dateOfBirth: string;
216
- btag?: string;
217
- domain?: string;
218
- referralCode?: string;
219
- verificationCode?: string;
220
- reCAPTCHAResponse?: string;
221
- }
222
-
223
- type CreateAccountReturn =
224
- | {
225
- ok: true;
226
- error?: never;
227
- data: {
228
- id: string;
229
- };
230
- }
231
- | {
232
- ok: false;
233
- data?: never;
234
- error:
235
- | HttpError
236
- | {
237
- name:
238
- | 'AccountNameNotAvailableError'
239
- | 'InvalidPlatformError'
240
- | 'InvalidReCAPTCHAResponseError'
241
- | 'InvalidSMSVerificationCodeError'
242
- | 'MinimumAgeRequirementError'
243
- | 'MobileNumberNotAvailableError';
244
- message: string;
245
- };
246
- };
247
- ```
248
-
249
- - `updateAccount` - Update current user's details
250
-
251
- ```ts
252
- updateAccount(input: UpdateAccountInput): Promise<UpdateAccountReturn>
253
- ```
254
-
255
- ```ts
256
- type UpdateAccountReturn =
257
- | {
258
- ok: true;
259
- data?: never;
260
- error?: never;
261
- }
262
- | {
263
- ok: false;
264
- data?: never;
265
- error: {
266
- name:
267
- | 'AccountNameNotAvailableError'
268
- | 'EmailAddressNotAvailableError'
269
- | 'InvalidTransactionPasswordError'
270
- | 'MobileNumberNotAvailableError'
271
- | 'NickNameNotAvailableError'
272
- | 'RealNameAlreadySetError'
273
- | 'ValidIdAlreadySetError';
274
- message: string;
275
- };
276
- };
277
- ```
278
-
279
- - `deleteAccount` - Delete current user's account
280
-
281
- ```ts
282
- deleteAccount(id: string): Promise<DeleteAccountReturn>
283
- ```
284
-
285
- ```ts
286
- type DeleteAccountReturn =
287
- | {
288
- ok: true;
289
- }
290
- | {
291
- ok: false;
292
- error: UnknownError | HttpError;
293
- };
294
- ```
295
-
296
- - `resetPassword` - Reset user's password
297
-
298
- ```ts
299
- resetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>
300
- ```
301
-
302
- ```ts
303
- interface ResetPasswordInput {
304
- mobileNumber: string;
305
- newPassword: string;
306
- verificationCode: string;
307
- }
308
-
309
- type ResetPasswordReturn =
310
- | {
311
- ok: true;
312
- }
313
- | {
314
- ok: false;
315
- error:
316
- | HttpError
317
- | {
318
- name: 'AccountNotFoundError' | 'InvalidVerificationCodeError';
319
- message: string;
320
- };
321
- };
322
- ```
323
-
324
- - `verificationDetails` - Retrieve user's verification details
325
-
326
- ```ts
327
- verificationDetails(): Promise<VerificationDetailsReturn>
328
- ```
329
-
330
- ```ts
331
- interface VerificationDetails {
332
- id: string;
333
- status: MemberVerificationStatus;
334
- address: string;
335
- sourceOfIncome: string;
336
- natureOfWork: string;
337
- nationality: string;
338
- placeOfBirth: string;
339
- idFrontImage: File;
340
- selfieImage: File;
341
- }
342
-
343
- type VerificationDetailsReturn =
344
- | {
345
- ok: true;
346
- data: VerificationDetails;
347
- }
348
- | {
349
- ok: false;
350
- error: HttpError;
351
- };
352
- ```
353
-
354
- - `submitVerificationDetails` - Submit current user's verification details
355
-
356
- ```ts
357
- submitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>
358
- ```
359
-
360
- ```ts
361
- interface SubmitVerificationDetailsInput {
362
- id?: string;
363
- idFrontImage: string;
364
- selfieImage: string;
365
- address: string;
366
- sourceOfIncome: string;
367
- natureOfWork: string;
368
- nationality: string;
369
- placeOfBirth: string;
370
- }
371
-
372
- type SubmitVerificationDetailsReturn =
373
- | {
374
- ok: true;
375
- data: {
376
- id: string;
377
- };
378
- }
379
- | {
380
- ok: false;
381
- error:
382
- | HttpError
383
- | {
384
- name:
385
- | 'FileDoesNotExistError'
386
- | 'FileNotReadyError'
387
- | 'MemberVerificationAlreadyExistsError';
388
- message: string;
389
- };
390
- };
391
- ```
392
-
393
- - `updateVerificationDetails` - Update current user's verification details
394
-
395
- ```ts
396
- updateVerificationDetails(input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>
397
- ```
398
-
399
- ```ts
400
- interface UpdateVerificationDetailsInput {
401
- idFrontImage: string;
402
- selfieImage: string;
403
- address: string;
404
- permanentAddress: string;
405
- sourceOfIncome: string;
406
- natureOfWork: string;
407
- nationality: string;
408
- placeOfBirth: string;
409
- }
410
-
411
- type UpdateVerificationDetailsReturn =
412
- | {
413
- ok: true;
414
- }
415
- | {
416
- ok: false;
417
- error:
418
- | HttpError
419
- | {
420
- name:
421
- | 'FileDoesNotExistError'
422
- | 'FileNotReadyError'
423
- | 'MemberVerificationAlreadyApprovedError'
424
- | 'MemberVerificationDoesNotExistError';
425
- message: string;
426
- };
427
- };
428
- ```
429
-
430
- - `verifyMobileNumber` - Verify current user's mobile number
431
-
432
- ```ts
433
- verifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>
434
- ```
435
-
436
- ```ts
437
- type VerifyMobileNumberReturn =
438
- | {
439
- ok: true;
440
- }
441
- | {
442
- ok: false;
443
- error:
444
- | HttpError
445
- | {
446
- name: 'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError';
447
- message: string;
448
- };
449
- };
450
- ```
451
-
452
- - `profileCompletion` - Retrieve current user's profile completion status
453
-
454
- ```ts
455
- profileCompletion(): Promise<ProfileCompletionReturn>
456
- ```
457
-
458
- ```ts
459
- interface ProfileCompletion {
460
- completionPercentage: number;
461
- personalInformation: boolean;
462
- accountVerification: boolean;
463
- mobileNumberVerification: boolean;
464
- transactionPassword: boolean;
465
- accountPassword: boolean;
466
- }
467
-
468
- type ProfileCompletionReturn =
469
- | {
470
- ok: true;
471
- data: ProfileCompletion;
472
- }
473
- | {
474
- ok: false;
475
- error: HttpError;
476
- };
477
- ```
478
-
479
- - `sendVerificationCode` - Send verification code to mobile number or email address
480
-
481
- ```ts
482
- sendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>
483
- ```
484
-
485
- ```ts
486
- type SendVerificationCodeReturn =
487
- | {
488
- ok: true;
489
- }
490
- | {
491
- ok: false;
492
- error:
493
- | HttpError
494
- | {
495
- name: 'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError';
496
- message: string;
497
- };
498
- };
499
- ```
500
-
501
- - `wallet` - Retrieve current user's wallet details
502
-
503
- ```ts
504
- wallet(): Promise<WalletReturn>
505
- ```
506
-
507
- ```ts
508
- interface Wallet {
509
- id: string;
510
- balance: number;
511
- currency: Currency;
512
- dateTimeCreated: Date;
513
- dateTimeLastUpdated: Date;
514
- }
515
-
516
- type WalletReturn =
517
- | {
518
- ok: true;
519
- data: Wallet | null;
520
- }
521
- | {
522
- ok: false;
523
- error: HttpError;
524
- };
525
- ```
526
-
527
- - `announcements` - Retrieve announcements for current platform
528
-
529
- ```ts
530
- announcements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>
531
- ```
532
-
533
- ```ts
534
- interface AnnouncementsInput {
535
- first?: number;
536
- after?: string;
537
- }
538
-
539
- interface Announcement {
540
- id: string;
541
- type: 'RELEASE' | 'SCHEDULED_MAINTENANCE';
542
- title: string;
543
- status: 'ACTIVE' | 'INACTIVE';
544
- message: string;
545
- activationStartDateTime: Date;
546
- activationEndDateTime: Date;
547
- dateTimeCreated: Date;
548
- dateTimeLastUpdated: Date;
549
- }
550
-
551
- type AnnouncementsReturn =
552
- | {
553
- ok: true;
554
- data: {
555
- announcements: (Announcement & { cursor: string })[];
556
- totalCount: number;
557
- hasNextPage: boolean;
558
- endCursor?: string;
559
- };
560
- }
561
- | {
562
- ok: false;
563
- error: HttpError;
564
- };
565
- ```
566
-
567
- - `createWithdrawal` - Create new withdrawal request
568
-
569
- ```ts
570
- createWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>
571
- ```
572
-
573
- ```ts
574
- interface CreateBankWithdrawalInput {
575
- id?: string;
576
- type: 'BANK';
577
- amount: number;
578
- transactionPassword: string;
579
- }
580
-
581
- interface CreateGCashWithdrawalInput {
582
- id?: string;
583
- type: 'GCASH';
584
- amount: number;
585
- transactionPassword: string;
586
- recipientMobileNumber: string;
587
- }
588
-
589
- interface CreateMayaWithdrawalInput {
590
- id?: string;
591
- type: 'MAYA';
592
- amount: number;
593
- transactionPassword: string;
594
- recipientMobileNumber: string;
595
- }
596
-
597
- interface CreateMayaAppWithdrawalInput {
598
- id?: string;
599
- type: 'MAYA_APP';
600
- amount: number;
601
- transactionPassword: string;
602
- }
603
-
604
- type CreateWithdrawalInput =
605
- | CreateBankWithdrawalInput
606
- | CreateGCashWithdrawalInput
607
- | CreateMayaWithdrawalInput
608
- | CreateMayaAppWithdrawalInput;
609
-
610
- type CreateWithdrawalReturn =
611
- | {
612
- ok: true;
613
- data: {
614
- id: string;
615
- };
616
- }
617
- | {
618
- ok: false;
619
- error:
620
- | HttpError
621
- | {
622
- name:
623
- | 'MobileNumberNotVerifiedError'
624
- | 'AccountNotVerifiedError'
625
- | 'InvalidWithdrawalAmountError'
626
- | 'WithdrawalDailyLimitExceededError'
627
- | 'InvalidTransactionPasswordError'
628
- | 'NotEnoughBalanceError';
629
- message: string;
630
- };
631
- };
632
- ```
633
-
634
- - `withdrawalRecords` - Retrieve current user's withdrawal records
635
-
636
- ```ts
637
- withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
638
- ```
639
-
640
- ```ts
641
- type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
642
- type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
643
-
644
- interface WithdrawalRecordsInput {
645
- first?: number;
646
- after?: string;
647
- filter?: {
648
- type?: {
649
- equal?: WithdrawalRecordType;
650
- notEqual?: WithdrawalRecordType;
651
- in?: WithdrawalRecordType[];
652
- notIn?: WithdrawalRecordType[];
653
- };
654
- status?: {
655
- equal?: WithdrawalRecordStatus;
656
- notEqual?: WithdrawalRecordStatus;
657
- in?: WithdrawalRecordStatus[];
658
- notIn?: WithdrawalRecordStatus[];
659
- };
660
- reference?: {
661
- equal?: string;
662
- notEqual?: string;
663
- in?: string[];
664
- notIn?: string[];
665
- contains?: string;
666
- startsWith?: string;
667
- };
668
- withdrawalNumber?: {
669
- equal?: string;
670
- notEqual?: string;
671
- in?: string[];
672
- notIn?: string[];
673
- contains?: string;
674
- startsWith?: string;
675
- };
676
- dateTimeCreated?: {
677
- equal?: Date | string;
678
- notEqual?: Date | string;
679
- in?: Date | string[];
680
- notIn?: Date | string[];
681
- lesserThan?: Date | string;
682
- lesserThanOrEqual?: Date | string;
683
- greaterThan?: Date | string;
684
- greaterThanOrEqual?: Date | string;
685
- };
686
- dateTimeLastUpdated?: {
687
- equal?: Date | string;
688
- notEqual?: Date | string;
689
- in?: Date | string[];
690
- notIn?: Date | string[];
691
- lesserThan?: Date | string;
692
- lesserThanOrEqual?: Date | string;
693
- greaterThan?: Date | string;
694
- greaterThanOrEqual?: Date | string;
695
- };
696
- };
697
- }
698
-
699
- interface WithdrawalRecord {
700
- id: string;
701
- type: WithdrawalRecordType;
702
- bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
703
- fee: number;
704
- amount: number;
705
- netAmount: number;
706
- status: WithdrawalRecordStatus;
707
- reference?: string;
708
- withdrawalNumber: string;
709
- recipientMobileNumber?: string;
710
- dateTimeConfirmed?: Date;
711
- dateTimeCreated: Date;
712
- dateTimeLastUpdated: Date;
713
- }
714
-
715
- type WithdrawalRecordsReturn =
716
- | {
717
- ok: true;
718
- data: {
719
- withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
720
- totalCount: number;
721
- hasNextPage: boolean;
722
- endCursor?: string;
723
- };
724
- }
725
- | {
726
- ok: false;
727
- error: HttpError;
728
- };
729
- ```
730
-
731
- - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
732
-
733
- ```ts
734
- remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
735
- ```
736
-
737
- ```ts
738
- type RemainingDailyWithdrawalsCountReturn =
739
- | {
740
- ok: true;
741
- data: number;
742
- }
743
- | {
744
- ok: false;
745
- error: HttpError;
746
- };
747
- ```
748
-
749
- - `createDeposit` - Create new deposit request
750
-
751
- ```ts
752
- createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
753
- ```
754
-
755
- ```ts
756
- interface CreateMayaDepositInput {
757
- id?: string;
758
- type: 'MAYA';
759
- amount: number;
760
- promo?: string;
761
- }
762
-
763
- interface CreateGCashDepositInput {
764
- id?: string;
765
- type: 'GCASH';
766
- amount: number;
767
- promo?: string;
768
- }
769
-
770
- interface CreateMayaAppDepositInput {
771
- id?: string;
772
- type: 'MAYA_APP';
773
- amount: number;
774
- promo?: string;
775
- }
776
-
777
- type CreateDepositInput =
778
- | CreateMayaDepositInput
779
- | CreateGCashDepositInput
780
- | CreateMayaAppDepositInput;
781
-
782
- type CreateDepositReturn =
783
- | {
784
- ok: true;
785
- data: {
786
- id: string;
787
- };
788
- }
789
- | {
790
- ok: false;
791
- error:
792
- | HttpError
793
- | {
794
- name:
795
- | 'DepositPromoMaximumAmountExceededError'
796
- | 'DepositPromoMinimumAmountNotMetError'
797
- | 'MaximumDepositAmountExceededError'
798
- | 'MinimumDepositAmountNotMetError'
799
- | 'MinimumFirstDepositAmountNotMetError'
800
- | 'PromoNotEnabledError'
801
- | 'WalletDoesNotExistError';
802
- message: string;
803
- };
804
- };
805
- ```
806
-
807
- - `deposit` - Retrieve deposit details
808
-
809
- ```ts
810
- deposit(id: string): Promise<DepositReturn>
811
- ```
812
-
813
- ```ts
814
- interface Deposit {
815
- id: string;
816
- type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
817
- status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
818
- amount: number;
819
- netAmount: number;
820
- fee: number;
821
- reference?: string;
822
- checkoutUrl?: string;
823
- dateTimeCreated: Date;
824
- dateTimeLastUpdated: Date;
825
- }
826
-
827
- type DepositReturn =
828
- | {
829
- ok: true;
830
- data: Deposit | null;
831
- }
832
- | {
833
- ok: false;
834
- error: HttpError;
835
- };
836
- ```
837
-
838
- - `depositRecords` - Retrieve current user's deposit records
839
-
840
- ```ts
841
- depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
842
- ```
843
-
844
- ```ts
845
- type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
846
- type DepositRecordStatus =
847
- | 'PENDING'
848
- | 'ACCEPTED'
849
- | 'APPROVED'
850
- | 'REJECTED'
851
- | 'CONFIRMED'
852
- | 'CANCELLED';
853
-
854
- interface DepositRecordsInput {
855
- first?: number;
856
- after?: string;
857
- filter?: {
858
- type?: {
859
- equal?: DepositRecordType;
860
- notEqual?: DepositRecordType;
861
- in?: DepositRecordType[];
862
- notIn?: DepositRecordType[];
863
- };
864
- status?: {
865
- equal?: DepositRecordStatus;
866
- notEqual?: DepositRecordStatus;
867
- in?: DepositRecordStatus[];
868
- notIn?: DepositRecordStatus[];
869
- };
870
- reference?: {
871
- equal?: string;
872
- notEqual?: string;
873
- in?: string[];
874
- notIn?: string[];
875
- contains?: string;
876
- startsWith?: string;
877
- };
878
- depositNumber?: {
879
- equal?: string;
880
- notEqual?: string;
881
- in?: string[];
882
- notIn?: string[];
883
- contains?: string;
884
- startsWith?: string;
885
- };
886
- dateTimeCreated?: {
887
- equal?: Date | string;
888
- notEqual?: Date | string;
889
- in?: Date | string[];
890
- notIn?: Date | string[];
891
- lesserThan?: Date | string;
892
- lesserThanOrEqual?: Date | string;
893
- greaterThan?: Date | string;
894
- greaterThanOrEqual?: Date | string;
895
- };
896
- dateTimeLastUpdated?: {
897
- equal?: Date | string;
898
- notEqual?: Date | string;
899
- in?: Date | string[];
900
- notIn?: Date | string[];
901
- lesserThan?: Date | string;
902
- lesserThanOrEqual?: Date | string;
903
- greaterThan?: Date | string;
904
- greaterThanOrEqual?: Date | string;
905
- };
906
- };
907
- }
908
-
909
- interface DepositRecord {
910
- id: string;
911
- type: DepositRecordType;
912
- status: DepositRecordStatus;
913
- amount: number;
914
- netAmount: number;
915
- fee: number;
916
- reference?: string;
917
- depositNumber: string;
918
- dateTimeCreated: Date;
919
- dateTimeLastUpdated: Date;
920
- }
921
-
922
- type DepositRecordsReturn =
923
- | {
924
- ok: true;
925
- data: {
926
- depositRecords: (DepositRecord & { cursor: string })[];
927
- totalCount: number;
928
- hasNextPage: boolean;
929
- endCursor?: string;
930
- };
931
- }
932
- | {
933
- ok: false;
934
- error: HttpError;
935
- };
936
- ```
937
-
938
- - `depositsCount` - Retrieve current user's deposits count
939
-
940
- ```ts
941
- depositsCount(): Promise<DepositsCountReturn>
942
- ```
943
-
944
- ```ts
945
- type DepositsCountReturn =
946
- | {
947
- ok: true;
948
- data: number;
949
- }
950
- | {
951
- ok: false;
952
- error: HttpError;
953
- };
954
- ```
955
-
956
- - `betRecords` - Retrieve current user's bet records
957
-
958
- ```ts
959
- betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
960
- ```
961
-
962
- ```ts
963
- type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
964
-
965
- interface BetRecordsInput {
966
- first?: number;
967
- after?: string;
968
- sort?: SortOrder;
969
- filter?: {
970
- serialCode?: {
971
- equal?: string;
972
- notEqual?: string;
973
- in?: string[];
974
- notIn?: string[];
975
- contains?: string;
976
- startsWith?: string;
977
- };
978
- game?: {
979
- equal?: string;
980
- notEqual?: string;
981
- in?: string[];
982
- notIn?: string[];
983
- };
984
- game__externalId?: {
985
- equal?: string;
986
- notEqual?: string;
987
- in?: string[];
988
- notIn?: string[];
989
- contains?: string;
990
- startsWith?: string;
991
- };
992
- game__type?: {
993
- equal?: GameType;
994
- notEqual?: GameType;
995
- in?: GameType[];
996
- notIn?: GameType[];
997
- };
998
- game__provider?: {
999
- equal?: GameProvider;
1000
- notEqual?: GameProvider;
1001
- in?: GameProvider[];
1002
- notIn?: GameProvider[];
1003
- };
1004
- dateTimeCreated?: {
1005
- equal?: Date | string;
1006
- notEqual?: Date | string;
1007
- in?: Date | string[];
1008
- notIn?: Date | string[];
1009
- lesserThan?: Date | string;
1010
- lesserThanOrEqual?: Date | string;
1011
- greaterThan?: Date | string;
1012
- greaterThanOrEqual?: Date | string;
1013
- };
1014
- vendorRoundId?: {
1015
- equal?: string;
1016
- notEqual?: string;
1017
- in?: string[];
1018
- notIn?: string[];
1019
- contains?: string;
1020
- startsWith?: string;
1021
- };
1022
- status?: {
1023
- equal?: BetRecordStatus;
1024
- notEqual?: BetRecordStatus;
1025
- in?: BetRecordStatus[];
1026
- notIn?: BetRecordStatus[];
1027
- };
1028
- };
1029
- startDateTime?: {
1030
- equal?: Date | string;
1031
- notEqual?: Date | string;
1032
- in?: Date | string[];
1033
- notIn?: Date | string[];
1034
- lesserThan?: Date | string;
1035
- lesserThanOrEqual?: Date | string;
1036
- greaterThan?: Date | string;
1037
- greaterThanOrEqual?: Date | string;
1038
- };
1039
- endDateTime?: {
1040
- equal?: Date | string;
1041
- notEqual?: Date | string;
1042
- in?: Date | string[];
1043
- notIn?: Date | string[];
1044
- lesserThan?: Date | string;
1045
- lesserThanOrEqual?: Date | string;
1046
- greaterThan?: Date | string;
1047
- greaterThanOrEqual?: Date | string;
1048
- };
1049
- }
1050
-
1051
- interface BetRecord {
1052
- id: string;
1053
- game: Game;
1054
- status: BetRecordStatus;
1055
- serialCode: string;
1056
- vendorRoundId?: string;
1057
- bet: number;
1058
- payout: number;
1059
- validBet: number;
1060
- jackpotContribution: number;
1061
- jackpotPayout: number;
1062
- winloss?: number;
1063
- betContent?: string;
1064
- contestName?: string;
1065
- externalCategory?: string;
1066
- dateTimeSettled?: Date;
1067
- dateTimeCreated: Date;
1068
- dateTimeLastUpdated: Date;
1069
- metadata: {
1070
- odds?: string;
1071
- validBet?: number;
1072
- };
1073
- }
1074
-
1075
- type BetRecordsReturn =
1076
- | {
1077
- ok: true;
1078
- data: {
1079
- betRecords: (BetRecord & { cursor: string })[];
1080
- totalCount: number;
1081
- hasNextPage: boolean;
1082
- endCursor?: string;
1083
- };
1084
- }
1085
- | {
1086
- ok: false;
1087
- error: HttpError;
1088
- };
1089
- ```
1090
-
1091
- - `transactionRecords` - Retrieve current user's transaction records
1092
-
1093
- ```ts
1094
- transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1095
- ```
1096
-
1097
- ```ts
1098
- type TransactionRecordType =
1099
- | 'DEPOSIT'
1100
- | 'PAYOUT'
1101
- | 'WITHDRAWAL_REFUND'
1102
- | 'TRANSFER_IN'
1103
- | 'WITHDRAWAL'
1104
- | 'BET'
1105
- | 'TRANSFER_OUT'
1106
- | 'ROLLBACK'
1107
- | 'BET_REFUND'
1108
- | 'PAYOUT_REFUND'
1109
- | 'CASHBACK_BONUS'
1110
- | 'BONUS'
1111
- | 'RESERVE'
1112
- | 'REJECT_WITHDRAWAL'
1113
- | 'MANUAL_DEPOSIT'
1114
- | 'GCASH_DEPOSIT'
1115
- | 'MANUAL_WITHDRAWAL'
1116
- | 'BANK_WITHDRAWAL'
1117
- | 'GCASH_WITHDRAWAL'
1118
- | 'COMMIT_RESERVE'
1119
- | 'ROLLBACK_PAYOUT'
1120
- | 'ROLLBACK_RESERVE';
1121
-
1122
- interface TransactionRecordsInput {
1123
- first?: number;
1124
- after?: string;
1125
- filter?: {
1126
- type?: {
1127
- equal?: TransactionRecordType;
1128
- notEqual?: TransactionRecordType;
1129
- in?: TransactionRecordType[];
1130
- notIn?: TransactionRecordType[];
1131
- };
1132
- referenceNumber?: {
1133
- equal?: string;
1134
- notEqual?: string;
1135
- in?: string[];
1136
- notIn?: string[];
1137
- contains?: string;
1138
- startsWith?: string;
1139
- };
1140
- dateTimeCreated?: {
1141
- equal?: Date | string;
1142
- notEqual?: Date | string;
1143
- in?: Date | string[];
1144
- notIn?: Date | string[];
1145
- lesserThan?: Date | string;
1146
- lesserThanOrEqual?: Date | string;
1147
- greaterThan?: Date | string;
1148
- greaterThanOrEqual?: Date | string;
1149
- };
1150
- };
1151
- }
1152
-
1153
- interface TransactionRecord {
1154
- id: string;
1155
- type: TransactionRecordType;
1156
- amount: number;
1157
- content?: string;
1158
- currentBalance: number;
1159
- referenceNumber: string;
1160
- dateTimeCreated: Date;
1161
- dateTimeLastUpdated: Date;
1162
- }
1163
-
1164
- type TransactionRecordsReturn =
1165
- | {
1166
- ok: true;
1167
- data: {
1168
- transactionRecords: (TransactionRecord & { cursor: string })[];
1169
- totalCount: number;
1170
- hasNextPage: boolean;
1171
- endCursor?: string;
1172
- };
1173
- }
1174
- | {
1175
- ok: false;
1176
- error: HttpError;
1177
- };
1178
- ```
1179
-
1180
- - `promos` - Retrieve promos for current platform
1181
-
1182
- ```ts
1183
- promos(): Promise<PromosReturn>
1184
- ```
1185
-
1186
- ```ts
1187
- interface Promo {
1188
- id: string;
1189
- type: 'DEPOSIT';
1190
- name: string;
1191
- banner: {
1192
- id: string;
1193
- url: string;
1194
- status: 'READY';
1195
- dateTimeCreated: Date;
1196
- };
1197
- status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1198
- description: string;
1199
- minimumBonusAmount?: number;
1200
- maximumBonusAmount?: number;
1201
- minimumDepositAmount?: number;
1202
- maximumDepositAmount?: number;
1203
- activationStartDateTime: Date;
1204
- activationEndDateTime: Date;
1205
- dateTimeCreated: Date;
1206
- dateTimeLastUpdated: Date;
1207
- }
1208
-
1209
- type PromosReturn =
1210
- | {
1211
- ok: true;
1212
- data: Promo[];
1213
- }
1214
- | {
1215
- ok: false;
1216
- error: HttpError;
1217
- };
1218
- ```
1219
-
1220
- - `availablePromos` - Retrieve available promos for current user
1221
-
1222
- ```ts
1223
- availablePromos(): Promise<PromosReturn>
1224
- ```
1225
-
1226
- - `bonus` - Retrieve current user's bonus details
1227
-
1228
- ```ts
1229
- bonus(): Promise<BonusReturn>
1230
- ```
1231
-
1232
- ```ts
1233
- interface Bonus {
1234
- id: string;
1235
- promo: Promo;
1236
- deposit?: {
1237
- type: DepositRecordType;
1238
- status: DepositRecordStatus;
1239
- amount: number;
1240
- netAmount: number;
1241
- fee: number;
1242
- reference?: string;
1243
- dateTimeCreated: Date;
1244
- dateTimeLastUpdated: Date;
1245
- };
1246
- amount: number;
1247
- balance: number;
1248
- turnoverRequirement: number;
1249
- currentTurnoverRequirementContribution: number;
1250
- currentTurnoverRequirementContributionPercentage: number;
1251
- expiration: Date;
1252
- dateTimeCreated: Date;
1253
- dateTimeLastUpdated: Date;
1254
- }
1255
-
1256
- type BonusReturn =
1257
- | {
1258
- ok: true;
1259
- data: Bonus | null;
1260
- }
1261
- | {
1262
- ok: false;
1263
- error: HttpError;
1264
- };
1265
- ```
1266
-
1267
- - `cashbacks` - Retrieve cashbacks for current platform
1268
-
1269
- ```ts
1270
- cashbacks(): Promise<CashbackReturn>
1271
- ```
1272
-
1273
- ```ts
1274
- interface Cashback {
1275
- id: string;
1276
- name: string;
1277
- banner: {
1278
- id: string;
1279
- url: string;
1280
- status: 'READY';
1281
- dateTimeCreated: Date;
1282
- };
1283
- status: CashbackStatus;
1284
- description: string;
1285
- activationStartDateTime: Date;
1286
- activationEndDateTime: Date;
1287
- dateTimeCreated: Date;
1288
- dateTimeLastUpdated: Date;
1289
- }
1290
-
1291
- type CashbackReturn =
1292
- | {
1293
- ok: true;
1294
- data: Cashback[];
1295
- }
1296
- | {
1297
- ok: false;
1298
- error: HttpError;
1299
- };
1300
- ```
1301
-
1302
- - `cashbackBonuses` - Retrieve current user's cashback bonuses
1303
-
1304
- ```ts
1305
- cashbackBonuses(): Promise<CashbackBonusesReturn>
1306
- ```
1307
-
1308
- ```ts
1309
- interface CashbackBonus {
1310
- id: string;
1311
- balance: number;
1312
- cashback: Cashback;
1313
- dateTimeCreated: Date;
1314
- dateTimeLastUpdated: Date;
1315
- }
1316
-
1317
- type CashbackBonusesReturn =
1318
- | {
1319
- ok: true;
1320
- data: CashbackBonus[];
1321
- }
1322
- | {
1323
- ok: false;
1324
- error: HttpError;
1325
- };
1326
- ```
1327
-
1328
- - `claimCashbackBonus` - Claim cashback bonus
1329
-
1330
- ```ts
1331
- claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1332
- ```
1333
-
1334
- ```ts
1335
- type ClaimCashbackBonusReturn =
1336
- | {
1337
- ok: true;
1338
- }
1339
- | {
1340
- ok: false;
1341
- error:
1342
- | HttpError
1343
- | {
1344
- name: 'CashbackBonusDoesNotExistError';
1345
- message: string;
1346
- };
1347
- };
1348
- ```
1349
-
1350
- - `games` - Retrieve games
1351
-
1352
- ```ts
1353
- games(input?: GamesInput): Promise<GamesReturn>
1354
- ```
1355
-
1356
- ```ts
1357
- type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1358
- type GameProvider =
1359
- | 'JILI'
1360
- | 'PGSOFT'
1361
- | 'FACHAI'
1362
- | 'PLAYTECH'
1363
- | 'CQ9'
1364
- | 'JDB'
1365
- | 'BOOONGO'
1366
- | 'HABANERO'
1367
- | 'RELAXGAMING'
1368
- | 'DG'
1369
- | 'E2E'
1370
- | 'BTI'
1371
- | 'DARWIN'
1372
- | 'MEGABALL'
1373
- | 'DRBINGO'
1374
- | 'RTG';
1375
-
1376
- interface GamesInput {
1377
- after?: string;
1378
- first?: number;
1379
- filter?: {
1380
- id?: {
1381
- equal?: string;
1382
- notEqual?: string;
1383
- in?: string[];
1384
- notIn?: string[];
1385
- };
1386
- name?: {
1387
- equal?: string;
1388
- notEqual?: string;
1389
- in?: string[];
1390
- notIn?: string[];
1391
- contains?: string;
1392
- startsWith?: string;
1393
- };
1394
- type?: {
1395
- equal?: GameType;
1396
- notEqual?: GameType;
1397
- in?: GameType[];
1398
- notIn?: GameType[];
1399
- };
1400
- provider?: {
1401
- equal?: GameProvider;
1402
- notEqual?: GameProvider;
1403
- in?: GameProvider[];
1404
- notIn?: GameProvider[];
1405
- };
1406
- };
1407
- }
1408
-
1409
- interface Game {
1410
- id: string;
1411
- type: GameType;
1412
- name: string;
1413
- image: string;
1414
- provider: GameProvider;
1415
- }
1416
-
1417
- type GamesReturn =
1418
- | {
1419
- ok: true;
1420
- data: {
1421
- games: (Game & { cursor: string })[];
1422
- totalCount: number;
1423
- hasNextPage: boolean;
1424
- endCursor?: string;
1425
- };
1426
- }
1427
- | {
1428
- ok: false;
1429
- error: HttpError;
1430
- };
1431
- ```
1432
-
1433
- - `gameSession` - Retrieve game session details
1434
-
1435
- ```ts
1436
- gameSession(id: string): Promise<GameSessionReturn>
1437
- ```
1438
-
1439
- ```ts
1440
- type GameSession =
1441
- | {
1442
- id: string;
1443
- game: Game;
1444
- status: 'READY';
1445
- launchUrl: string;
1446
- dateTimeCreated: Date;
1447
- dateTimeLastUpdated: Date;
1448
- }
1449
- | {
1450
- id: string;
1451
- game: Game;
1452
- status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1453
- dateTimeCreated: Date;
1454
- dateTimeLastUpdated: Date;
1455
- };
1456
-
1457
- type GameSessionReturn =
1458
- | {
1459
- ok: true;
1460
- data: GameSession | null;
1461
- }
1462
- | {
1463
- ok: false;
1464
- error: HttpError;
1465
- };
1466
- ```
1467
-
1468
- - `createGameSession` - Create new game session
1469
-
1470
- ```ts
1471
- createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1472
- ```
1473
-
1474
- ```ts
1475
- interface CreateGameSessionInput {
1476
- id?: string;
1477
- game: string;
1478
- }
1479
-
1480
- type CreateGameSessionReturn =
1481
- | {
1482
- ok: true;
1483
- data: {
1484
- id: string;
1485
- };
1486
- }
1487
- | {
1488
- ok: false;
1489
- error:
1490
- | HttpError
1491
- | {
1492
- name: 'GameDoesNotExistError';
1493
- message: string;
1494
- };
1495
- };
1496
- ```
1497
-
1498
- - `endGameSession` - End game session
1499
-
1500
- ```ts
1501
- endGameSession(id: string): Promise<EndGameSessionReturn>
1502
- ```
1503
-
1504
- ```ts
1505
- type EndGameSessionReturn =
1506
- | {
1507
- ok: true;
1508
- }
1509
- | {
1510
- ok: false;
1511
- error: HttpError | UnknownError;
1512
- };
1513
- ```
1514
-
1515
- - `file` - Retrieve file details
1516
-
1517
- ```ts
1518
- file(id: string): Promise<FileReturn>
1519
- ```
1520
-
1521
- ```ts
1522
- type File =
1523
- | {
1524
- id: string;
1525
- url?: never;
1526
- status: 'UPLOADING' | 'FAILED';
1527
- dateTimeCreated: Date;
1528
- }
1529
- | {
1530
- id: string;
1531
- url: string;
1532
- status: 'READY';
1533
- dateTimeCreated: Date;
1534
- }
1535
- | {
1536
- id: string;
1537
- url?: string;
1538
- status: 'DELETED';
1539
- dateTimeCreated: Date;
1540
- };
1541
-
1542
- type FileReturn =
1543
- | {
1544
- ok: true;
1545
- data: File | null;
1546
- }
1547
- | {
1548
- ok: false;
1549
- error: HttpError;
1550
- };
1551
- ```
1552
-
1553
- - `uploadImageFile` - Upload image file
1554
-
1555
- ```ts
1556
- uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1557
- ```
1558
-
1559
- ```ts
1560
- type UploadImageFileReturn =
1561
- | {
1562
- ok: true;
1563
- data: {
1564
- id: string;
1565
- };
1566
- }
1567
- | {
1568
- ok: false;
1569
- error:
1570
- | HttpError
1571
- | {
1572
- name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1573
- message: string;
1574
- };
1575
- };
1576
- ```
1577
-
1578
- - `pointsWallet` - Retrieve current user's points wallet details
1579
-
1580
- ```ts
1581
- pointsWallet(): Promise<PointsWalletReturn>
1582
- ```
1583
-
1584
- ```ts
1585
- interface PointsWallet {
1586
- id: string;
1587
- points: number;
1588
- account: string;
1589
- dateTimeCreated: Date;
1590
- }
1591
-
1592
- type PointsWalletReturn =
1593
- | {
1594
- ok: true;
1595
- data: PointsWallet | null;
1596
- }
1597
- | {
1598
- ok: false;
1599
- error: HttpError;
1600
- };
1601
- ```
1602
-
1603
- - `pointsToCashConversion` - Convert points to cash
1604
-
1605
- ```ts
1606
- pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1607
- ```
1608
-
1609
- ```ts
1610
- type PointsToCashConversionReturn =
1611
- | {
1612
- ok: true;
1613
- }
1614
- | {
1615
- ok: false;
1616
- error:
1617
- | HttpError
1618
- | {
1619
- name: 'InsufficientPointsError';
1620
- message: string;
1621
- };
1622
- };
1623
- ```
1
+ ## Opexa Portal SDK
2
+
3
+ A library that provides a set of functions to interact with Opexa Portal API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @opexa/portal-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ - Create sdk instance
14
+
15
+ ```ts
16
+ // lib/sdk.js
17
+ import Sdk from '@opexa/portal-sdk';
18
+
19
+ export const sdk = new Sdk({
20
+ platform: 'Z892',
21
+ environment: 'development',
22
+ });
23
+ ```
24
+
25
+ - Use sdk instance
26
+
27
+ ```jsx
28
+ import { sdk } from '$lib/sdk';
29
+ import * as React from 'react';
30
+
31
+ function Page() {
32
+ const [account, setAccount] = React.useState();
33
+
34
+ React.useEffect(function () {
35
+ sdk.account().then(setAccount);
36
+ }, []);
37
+
38
+ return (
39
+ <pre>
40
+ <code>{JSON.stringify(account, null, 2)}</code>
41
+ </pre>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### `Sdk`
49
+
50
+ `Sdk` accepts the following options:
51
+
52
+ - `*site` - The site ID to be used
53
+ - `*sitePlatform` - The site platform ID to be used
54
+ - `*platform` - The platform code to be used
55
+ - `*environment` - Whether to use production/development api
56
+
57
+ , and returns the following methods:
58
+
59
+ - `signIn` - Start user session
60
+
61
+ ```ts
62
+ signIn(input: SignInInput): Promise<SignInReturn>
63
+ ```
64
+
65
+ ```ts
66
+ type SignInInput =
67
+ | {
68
+ type: 'NAME_AND_PASSWORD';
69
+ name: string;
70
+ password: string;
71
+ }
72
+ | {
73
+ type: 'MOBILE_NUMBER';
74
+ mobileNumber: string;
75
+ verificationCode: string;
76
+ };
77
+
78
+ type SignInReturn =
79
+ | {
80
+ ok: true;
81
+ }
82
+ | {
83
+ ok: false;
84
+ error:
85
+ | HttpError
86
+ | {
87
+ name: 'AccountNotFound';
88
+ message: string;
89
+ };
90
+ };
91
+ ```
92
+
93
+ - `signOut` - End current user session
94
+
95
+ ```ts
96
+ signOut(): Promise<void>
97
+ ```
98
+
99
+ - `site` - Retrieve site details
100
+
101
+ ```ts
102
+ site(): Promise<SiteReturn>
103
+ ```
104
+
105
+ ```ts
106
+ interface Site {
107
+ id: string;
108
+ name: string;
109
+ logo?: string;
110
+ }
111
+ ```
112
+
113
+ ```ts
114
+ type SiteReturn =
115
+ | {
116
+ ok: true;
117
+ data: Site;
118
+ }
119
+ | {
120
+ ok: false;
121
+ error: HttpError;
122
+ };
123
+ ```
124
+
125
+ - `platform` - Retrieve current platform details
126
+
127
+ ```ts
128
+ platform(): Promise<PlatformReturn>
129
+ ```
130
+
131
+ ```ts
132
+ interface Platform {
133
+ paymentSettings: {
134
+ minimumFirstDepositAmount?: number;
135
+ restrictWithdrawalsToVerifiedMembers: boolean;
136
+ depositGateway: {
137
+ bank: GatewaySettings;
138
+ gcash: GatewaySettings;
139
+ maya: GatewaySettings;
140
+ mayaApp: GatewaySettings;
141
+ };
142
+ withdrawalGateway: {
143
+ bank: GatewaySettings;
144
+ gcash: GatewaySettings;
145
+ maya: GatewaySettings;
146
+ mayaApp: GatewaySettings;
147
+ };
148
+ };
149
+ pointsClubSettings: {
150
+ multiplier: number;
151
+ };
152
+ }
153
+
154
+ type PlatformReturn =
155
+ | {
156
+ ok: true;
157
+ data: Platform;
158
+ }
159
+ | {
160
+ ok: false;
161
+ error: HttpError;
162
+ };
163
+ ```
164
+
165
+ - `account` - Retrieve current user's details
166
+
167
+ ```ts
168
+ account(): Promise<AccountReturn>
169
+ ```
170
+
171
+ ```ts
172
+ interface Account {
173
+ id: string;
174
+ name: string;
175
+ status: MemberAccountStatus;
176
+ realName?: string;
177
+ nickName?: string;
178
+ dateOfBirth?: Date;
179
+ validId?: string;
180
+ emailAddress?: string;
181
+ mobileNumber?: string;
182
+ verified: boolean;
183
+ verificationStatus: MemberAccountVerificationStatus;
184
+ mobileNumberVerified: boolean;
185
+ mobileNumberVerificationRequired: boolean;
186
+ transactionPassword: boolean;
187
+ dateTimeLastActive?: Date;
188
+ dateTimeCreated: Date;
189
+ dateTimeLastUpdated: Date;
190
+ }
191
+
192
+ type AccountReturn =
193
+ | {
194
+ ok: true;
195
+ data: Account;
196
+ }
197
+ | {
198
+ ok: false;
199
+ error: HttpError;
200
+ };
201
+ ```
202
+
203
+ - `createAccount` - Create new user account
204
+
205
+ ```ts
206
+ createAccount(input: CreateAccountInput): Promise<CreateAccountReturn>
207
+ ```
208
+
209
+ ```ts
210
+ interface CreateAccountInput {
211
+ id?: string;
212
+ name: string;
213
+ password: string;
214
+ mobileNumber: string;
215
+ dateOfBirth: string;
216
+ btag?: string;
217
+ domain?: string;
218
+ referralCode?: string;
219
+ verificationCode?: string;
220
+ reCAPTCHAResponse?: string;
221
+ }
222
+
223
+ type CreateAccountReturn =
224
+ | {
225
+ ok: true;
226
+ error?: never;
227
+ data: {
228
+ id: string;
229
+ };
230
+ }
231
+ | {
232
+ ok: false;
233
+ data?: never;
234
+ error:
235
+ | HttpError
236
+ | {
237
+ name:
238
+ | 'AccountNameNotAvailableError'
239
+ | 'InvalidPlatformError'
240
+ | 'InvalidReCAPTCHAResponseError'
241
+ | 'InvalidSMSVerificationCodeError'
242
+ | 'MinimumAgeRequirementError'
243
+ | 'MobileNumberNotAvailableError';
244
+ message: string;
245
+ };
246
+ };
247
+ ```
248
+
249
+ - `updateAccount` - Update current user's details
250
+
251
+ ```ts
252
+ updateAccount(input: UpdateAccountInput): Promise<UpdateAccountReturn>
253
+ ```
254
+
255
+ ```ts
256
+ type UpdateAccountReturn =
257
+ | {
258
+ ok: true;
259
+ data?: never;
260
+ error?: never;
261
+ }
262
+ | {
263
+ ok: false;
264
+ data?: never;
265
+ error: {
266
+ name:
267
+ | 'AccountNameNotAvailableError'
268
+ | 'EmailAddressNotAvailableError'
269
+ | 'InvalidTransactionPasswordError'
270
+ | 'MobileNumberNotAvailableError'
271
+ | 'NickNameNotAvailableError'
272
+ | 'RealNameAlreadySetError'
273
+ | 'ValidIdAlreadySetError';
274
+ message: string;
275
+ };
276
+ };
277
+ ```
278
+
279
+ - `deleteAccount` - Delete current user's account
280
+
281
+ ```ts
282
+ deleteAccount(id: string): Promise<DeleteAccountReturn>
283
+ ```
284
+
285
+ ```ts
286
+ type DeleteAccountReturn =
287
+ | {
288
+ ok: true;
289
+ }
290
+ | {
291
+ ok: false;
292
+ error: UnknownError | HttpError;
293
+ };
294
+ ```
295
+
296
+ - `resetPassword` - Reset user's password
297
+
298
+ ```ts
299
+ resetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>
300
+ ```
301
+
302
+ ```ts
303
+ interface ResetPasswordInput {
304
+ mobileNumber: string;
305
+ newPassword: string;
306
+ verificationCode: string;
307
+ }
308
+
309
+ type ResetPasswordReturn =
310
+ | {
311
+ ok: true;
312
+ }
313
+ | {
314
+ ok: false;
315
+ error:
316
+ | HttpError
317
+ | {
318
+ name: 'AccountNotFoundError' | 'InvalidVerificationCodeError';
319
+ message: string;
320
+ };
321
+ };
322
+ ```
323
+
324
+ - `verificationDetails` - Retrieve user's verification details
325
+
326
+ ```ts
327
+ verificationDetails(): Promise<VerificationDetailsReturn>
328
+ ```
329
+
330
+ ```ts
331
+ interface VerificationDetails {
332
+ id: string;
333
+ status: MemberVerificationStatus;
334
+ address: string;
335
+ sourceOfIncome: string;
336
+ natureOfWork: string;
337
+ nationality: string;
338
+ placeOfBirth: string;
339
+ idFrontImage: File;
340
+ selfieImage: File;
341
+ }
342
+
343
+ type VerificationDetailsReturn =
344
+ | {
345
+ ok: true;
346
+ data: VerificationDetails;
347
+ }
348
+ | {
349
+ ok: false;
350
+ error: HttpError;
351
+ };
352
+ ```
353
+
354
+ - `submitVerificationDetails` - Submit current user's verification details
355
+
356
+ ```ts
357
+ submitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>
358
+ ```
359
+
360
+ ```ts
361
+ interface SubmitVerificationDetailsInput {
362
+ id?: string;
363
+ idFrontImage: string;
364
+ selfieImage: string;
365
+ address: string;
366
+ sourceOfIncome: string;
367
+ natureOfWork: string;
368
+ nationality: string;
369
+ placeOfBirth: string;
370
+ }
371
+
372
+ type SubmitVerificationDetailsReturn =
373
+ | {
374
+ ok: true;
375
+ data: {
376
+ id: string;
377
+ };
378
+ }
379
+ | {
380
+ ok: false;
381
+ error:
382
+ | HttpError
383
+ | {
384
+ name:
385
+ | 'FileDoesNotExistError'
386
+ | 'FileNotReadyError'
387
+ | 'MemberVerificationAlreadyExistsError';
388
+ message: string;
389
+ };
390
+ };
391
+ ```
392
+
393
+ - `updateVerificationDetails` - Update current user's verification details
394
+
395
+ ```ts
396
+ updateVerificationDetails(input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>
397
+ ```
398
+
399
+ ```ts
400
+ interface UpdateVerificationDetailsInput {
401
+ idFrontImage: string;
402
+ selfieImage: string;
403
+ address: string;
404
+ permanentAddress: string;
405
+ sourceOfIncome: string;
406
+ natureOfWork: string;
407
+ nationality: string;
408
+ placeOfBirth: string;
409
+ }
410
+
411
+ type UpdateVerificationDetailsReturn =
412
+ | {
413
+ ok: true;
414
+ }
415
+ | {
416
+ ok: false;
417
+ error:
418
+ | HttpError
419
+ | {
420
+ name:
421
+ | 'FileDoesNotExistError'
422
+ | 'FileNotReadyError'
423
+ | 'MemberVerificationAlreadyApprovedError'
424
+ | 'MemberVerificationDoesNotExistError';
425
+ message: string;
426
+ };
427
+ };
428
+ ```
429
+
430
+ - `verifyMobileNumber` - Verify current user's mobile number
431
+
432
+ ```ts
433
+ verifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>
434
+ ```
435
+
436
+ ```ts
437
+ type VerifyMobileNumberReturn =
438
+ | {
439
+ ok: true;
440
+ }
441
+ | {
442
+ ok: false;
443
+ error:
444
+ | HttpError
445
+ | {
446
+ name: 'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError';
447
+ message: string;
448
+ };
449
+ };
450
+ ```
451
+
452
+ - `profileCompletion` - Retrieve current user's profile completion status
453
+
454
+ ```ts
455
+ profileCompletion(): Promise<ProfileCompletionReturn>
456
+ ```
457
+
458
+ ```ts
459
+ interface ProfileCompletion {
460
+ completionPercentage: number;
461
+ personalInformation: boolean;
462
+ accountVerification: boolean;
463
+ mobileNumberVerification: boolean;
464
+ transactionPassword: boolean;
465
+ accountPassword: boolean;
466
+ }
467
+
468
+ type ProfileCompletionReturn =
469
+ | {
470
+ ok: true;
471
+ data: ProfileCompletion;
472
+ }
473
+ | {
474
+ ok: false;
475
+ error: HttpError;
476
+ };
477
+ ```
478
+
479
+ - `sendVerificationCode` - Send verification code to mobile number or email address
480
+
481
+ ```ts
482
+ sendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>
483
+ ```
484
+
485
+ ```ts
486
+ type SendVerificationCodeReturn =
487
+ | {
488
+ ok: true;
489
+ }
490
+ | {
491
+ ok: false;
492
+ error:
493
+ | HttpError
494
+ | {
495
+ name: 'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError';
496
+ message: string;
497
+ };
498
+ };
499
+ ```
500
+
501
+ - `wallet` - Retrieve current user's wallet details
502
+
503
+ ```ts
504
+ wallet(): Promise<WalletReturn>
505
+ ```
506
+
507
+ ```ts
508
+ interface Wallet {
509
+ id: string;
510
+ balance: number;
511
+ currency: Currency;
512
+ dateTimeCreated: Date;
513
+ dateTimeLastUpdated: Date;
514
+ }
515
+
516
+ type WalletReturn =
517
+ | {
518
+ ok: true;
519
+ data: Wallet | null;
520
+ }
521
+ | {
522
+ ok: false;
523
+ error: HttpError;
524
+ };
525
+ ```
526
+
527
+ - `announcements` - Retrieve announcements for current platform
528
+
529
+ ```ts
530
+ announcements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>
531
+ ```
532
+
533
+ ```ts
534
+ interface AnnouncementsInput {
535
+ first?: number;
536
+ after?: string;
537
+ }
538
+
539
+ interface Announcement {
540
+ id: string;
541
+ type: 'RELEASE' | 'SCHEDULED_MAINTENANCE';
542
+ title: string;
543
+ status: 'ACTIVE' | 'INACTIVE';
544
+ message: string;
545
+ activationStartDateTime: Date;
546
+ activationEndDateTime: Date;
547
+ dateTimeCreated: Date;
548
+ dateTimeLastUpdated: Date;
549
+ }
550
+
551
+ type AnnouncementsReturn =
552
+ | {
553
+ ok: true;
554
+ data: {
555
+ announcements: (Announcement & { cursor: string })[];
556
+ totalCount: number;
557
+ hasNextPage: boolean;
558
+ endCursor?: string;
559
+ };
560
+ }
561
+ | {
562
+ ok: false;
563
+ error: HttpError;
564
+ };
565
+ ```
566
+
567
+ - `createWithdrawal` - Create new withdrawal request
568
+
569
+ ```ts
570
+ createWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>
571
+ ```
572
+
573
+ ```ts
574
+ interface CreateBankWithdrawalInput {
575
+ id?: string;
576
+ type: 'BANK';
577
+ amount: number;
578
+ transactionPassword: string;
579
+ }
580
+
581
+ interface CreateGCashWithdrawalInput {
582
+ id?: string;
583
+ type: 'GCASH';
584
+ amount: number;
585
+ transactionPassword: string;
586
+ recipientMobileNumber: string;
587
+ }
588
+
589
+ interface CreateMayaWithdrawalInput {
590
+ id?: string;
591
+ type: 'MAYA';
592
+ amount: number;
593
+ transactionPassword: string;
594
+ recipientMobileNumber: string;
595
+ }
596
+
597
+ interface CreateMayaAppWithdrawalInput {
598
+ id?: string;
599
+ type: 'MAYA_APP';
600
+ amount: number;
601
+ transactionPassword: string;
602
+ }
603
+
604
+ type CreateWithdrawalInput =
605
+ | CreateBankWithdrawalInput
606
+ | CreateGCashWithdrawalInput
607
+ | CreateMayaWithdrawalInput
608
+ | CreateMayaAppWithdrawalInput;
609
+
610
+ type CreateWithdrawalReturn =
611
+ | {
612
+ ok: true;
613
+ data: {
614
+ id: string;
615
+ };
616
+ }
617
+ | {
618
+ ok: false;
619
+ error:
620
+ | HttpError
621
+ | {
622
+ name:
623
+ | 'MobileNumberNotVerifiedError'
624
+ | 'AccountNotVerifiedError'
625
+ | 'InvalidWithdrawalAmountError'
626
+ | 'WithdrawalDailyLimitExceededError'
627
+ | 'InvalidTransactionPasswordError'
628
+ | 'NotEnoughBalanceError';
629
+ message: string;
630
+ };
631
+ };
632
+ ```
633
+
634
+ - `withdrawalRecords` - Retrieve current user's withdrawal records
635
+
636
+ ```ts
637
+ withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>
638
+ ```
639
+
640
+ ```ts
641
+ type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA';
642
+ type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
643
+
644
+ interface WithdrawalRecordsInput {
645
+ first?: number;
646
+ after?: string;
647
+ filter?: {
648
+ type?: {
649
+ equal?: WithdrawalRecordType;
650
+ notEqual?: WithdrawalRecordType;
651
+ in?: WithdrawalRecordType[];
652
+ notIn?: WithdrawalRecordType[];
653
+ };
654
+ status?: {
655
+ equal?: WithdrawalRecordStatus;
656
+ notEqual?: WithdrawalRecordStatus;
657
+ in?: WithdrawalRecordStatus[];
658
+ notIn?: WithdrawalRecordStatus[];
659
+ };
660
+ reference?: {
661
+ equal?: string;
662
+ notEqual?: string;
663
+ in?: string[];
664
+ notIn?: string[];
665
+ contains?: string;
666
+ startsWith?: string;
667
+ };
668
+ withdrawalNumber?: {
669
+ equal?: string;
670
+ notEqual?: string;
671
+ in?: string[];
672
+ notIn?: string[];
673
+ contains?: string;
674
+ startsWith?: string;
675
+ };
676
+ dateTimeCreated?: {
677
+ equal?: Date | string;
678
+ notEqual?: Date | string;
679
+ in?: Date | string[];
680
+ notIn?: Date | string[];
681
+ lesserThan?: Date | string;
682
+ lesserThanOrEqual?: Date | string;
683
+ greaterThan?: Date | string;
684
+ greaterThanOrEqual?: Date | string;
685
+ };
686
+ dateTimeLastUpdated?: {
687
+ equal?: Date | string;
688
+ notEqual?: Date | string;
689
+ in?: Date | string[];
690
+ notIn?: Date | string[];
691
+ lesserThan?: Date | string;
692
+ lesserThanOrEqual?: Date | string;
693
+ greaterThan?: Date | string;
694
+ greaterThanOrEqual?: Date | string;
695
+ };
696
+ };
697
+ }
698
+
699
+ interface WithdrawalRecord {
700
+ id: string;
701
+ type: WithdrawalRecordType;
702
+ bank?: 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
703
+ fee: number;
704
+ amount: number;
705
+ netAmount: number;
706
+ status: WithdrawalRecordStatus;
707
+ reference?: string;
708
+ withdrawalNumber: string;
709
+ recipientMobileNumber?: string;
710
+ dateTimeConfirmed?: Date;
711
+ dateTimeCreated: Date;
712
+ dateTimeLastUpdated: Date;
713
+ }
714
+
715
+ type WithdrawalRecordsReturn =
716
+ | {
717
+ ok: true;
718
+ data: {
719
+ withdrawalRecords: (WithdrawalRecord & { cursor: string })[];
720
+ totalCount: number;
721
+ hasNextPage: boolean;
722
+ endCursor?: string;
723
+ };
724
+ }
725
+ | {
726
+ ok: false;
727
+ error: HttpError;
728
+ };
729
+ ```
730
+
731
+ - `remainingDailyWithdrawalsCount` - Retrieve current user's remaining daily withdrawals count
732
+
733
+ ```ts
734
+ remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>
735
+ ```
736
+
737
+ ```ts
738
+ type RemainingDailyWithdrawalsCountReturn =
739
+ | {
740
+ ok: true;
741
+ data: number;
742
+ }
743
+ | {
744
+ ok: false;
745
+ error: HttpError;
746
+ };
747
+ ```
748
+
749
+ - `createDeposit` - Create new deposit request
750
+
751
+ ```ts
752
+ createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>
753
+ ```
754
+
755
+ ```ts
756
+ interface CreateMayaDepositInput {
757
+ id?: string;
758
+ type: 'MAYA';
759
+ amount: number;
760
+ promo?: string;
761
+ }
762
+
763
+ interface CreateGCashDepositInput {
764
+ id?: string;
765
+ type: 'GCASH';
766
+ amount: number;
767
+ promo?: string;
768
+ }
769
+
770
+ interface CreateMayaAppDepositInput {
771
+ id?: string;
772
+ type: 'MAYA_APP';
773
+ amount: number;
774
+ promo?: string;
775
+ }
776
+
777
+ type CreateDepositInput =
778
+ | CreateMayaDepositInput
779
+ | CreateGCashDepositInput
780
+ | CreateMayaAppDepositInput;
781
+
782
+ type CreateDepositReturn =
783
+ | {
784
+ ok: true;
785
+ data: {
786
+ id: string;
787
+ };
788
+ }
789
+ | {
790
+ ok: false;
791
+ error:
792
+ | HttpError
793
+ | {
794
+ name:
795
+ | 'DepositPromoMaximumAmountExceededError'
796
+ | 'DepositPromoMinimumAmountNotMetError'
797
+ | 'MaximumDepositAmountExceededError'
798
+ | 'MinimumDepositAmountNotMetError'
799
+ | 'MinimumFirstDepositAmountNotMetError'
800
+ | 'PromoNotEnabledError'
801
+ | 'WalletDoesNotExistError';
802
+ message: string;
803
+ };
804
+ };
805
+ ```
806
+
807
+ - `deposit` - Retrieve deposit details
808
+
809
+ ```ts
810
+ deposit(id: string): Promise<DepositReturn>
811
+ ```
812
+
813
+ ```ts
814
+ interface Deposit {
815
+ id: string;
816
+ type: 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
817
+ status: 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
818
+ amount: number;
819
+ netAmount: number;
820
+ fee: number;
821
+ reference?: string;
822
+ checkoutUrl?: string;
823
+ dateTimeCreated: Date;
824
+ dateTimeLastUpdated: Date;
825
+ }
826
+
827
+ type DepositReturn =
828
+ | {
829
+ ok: true;
830
+ data: Deposit | null;
831
+ }
832
+ | {
833
+ ok: false;
834
+ error: HttpError;
835
+ };
836
+ ```
837
+
838
+ - `depositRecords` - Retrieve current user's deposit records
839
+
840
+ ```ts
841
+ depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>
842
+ ```
843
+
844
+ ```ts
845
+ type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
846
+ type DepositRecordStatus =
847
+ | 'PENDING'
848
+ | 'ACCEPTED'
849
+ | 'APPROVED'
850
+ | 'REJECTED'
851
+ | 'CONFIRMED'
852
+ | 'CANCELLED';
853
+
854
+ interface DepositRecordsInput {
855
+ first?: number;
856
+ after?: string;
857
+ filter?: {
858
+ type?: {
859
+ equal?: DepositRecordType;
860
+ notEqual?: DepositRecordType;
861
+ in?: DepositRecordType[];
862
+ notIn?: DepositRecordType[];
863
+ };
864
+ status?: {
865
+ equal?: DepositRecordStatus;
866
+ notEqual?: DepositRecordStatus;
867
+ in?: DepositRecordStatus[];
868
+ notIn?: DepositRecordStatus[];
869
+ };
870
+ reference?: {
871
+ equal?: string;
872
+ notEqual?: string;
873
+ in?: string[];
874
+ notIn?: string[];
875
+ contains?: string;
876
+ startsWith?: string;
877
+ };
878
+ depositNumber?: {
879
+ equal?: string;
880
+ notEqual?: string;
881
+ in?: string[];
882
+ notIn?: string[];
883
+ contains?: string;
884
+ startsWith?: string;
885
+ };
886
+ dateTimeCreated?: {
887
+ equal?: Date | string;
888
+ notEqual?: Date | string;
889
+ in?: Date | string[];
890
+ notIn?: Date | string[];
891
+ lesserThan?: Date | string;
892
+ lesserThanOrEqual?: Date | string;
893
+ greaterThan?: Date | string;
894
+ greaterThanOrEqual?: Date | string;
895
+ };
896
+ dateTimeLastUpdated?: {
897
+ equal?: Date | string;
898
+ notEqual?: Date | string;
899
+ in?: Date | string[];
900
+ notIn?: Date | string[];
901
+ lesserThan?: Date | string;
902
+ lesserThanOrEqual?: Date | string;
903
+ greaterThan?: Date | string;
904
+ greaterThanOrEqual?: Date | string;
905
+ };
906
+ };
907
+ }
908
+
909
+ interface DepositRecord {
910
+ id: string;
911
+ type: DepositRecordType;
912
+ status: DepositRecordStatus;
913
+ amount: number;
914
+ netAmount: number;
915
+ fee: number;
916
+ reference?: string;
917
+ depositNumber: string;
918
+ dateTimeCreated: Date;
919
+ dateTimeLastUpdated: Date;
920
+ }
921
+
922
+ type DepositRecordsReturn =
923
+ | {
924
+ ok: true;
925
+ data: {
926
+ depositRecords: (DepositRecord & { cursor: string })[];
927
+ totalCount: number;
928
+ hasNextPage: boolean;
929
+ endCursor?: string;
930
+ };
931
+ }
932
+ | {
933
+ ok: false;
934
+ error: HttpError;
935
+ };
936
+ ```
937
+
938
+ - `depositsCount` - Retrieve current user's deposits count
939
+
940
+ ```ts
941
+ depositsCount(): Promise<DepositsCountReturn>
942
+ ```
943
+
944
+ ```ts
945
+ type DepositsCountReturn =
946
+ | {
947
+ ok: true;
948
+ data: number;
949
+ }
950
+ | {
951
+ ok: false;
952
+ error: HttpError;
953
+ };
954
+ ```
955
+
956
+ - `betRecords` - Retrieve current user's bet records
957
+
958
+ ```ts
959
+ betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>
960
+ ```
961
+
962
+ ```ts
963
+ type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
964
+
965
+ interface BetRecordsInput {
966
+ first?: number;
967
+ after?: string;
968
+ sort?: SortOrder;
969
+ filter?: {
970
+ serialCode?: {
971
+ equal?: string;
972
+ notEqual?: string;
973
+ in?: string[];
974
+ notIn?: string[];
975
+ contains?: string;
976
+ startsWith?: string;
977
+ };
978
+ game?: {
979
+ equal?: string;
980
+ notEqual?: string;
981
+ in?: string[];
982
+ notIn?: string[];
983
+ };
984
+ game__externalId?: {
985
+ equal?: string;
986
+ notEqual?: string;
987
+ in?: string[];
988
+ notIn?: string[];
989
+ contains?: string;
990
+ startsWith?: string;
991
+ };
992
+ game__type?: {
993
+ equal?: GameType;
994
+ notEqual?: GameType;
995
+ in?: GameType[];
996
+ notIn?: GameType[];
997
+ };
998
+ game__provider?: {
999
+ equal?: GameProvider;
1000
+ notEqual?: GameProvider;
1001
+ in?: GameProvider[];
1002
+ notIn?: GameProvider[];
1003
+ };
1004
+ dateTimeCreated?: {
1005
+ equal?: Date | string;
1006
+ notEqual?: Date | string;
1007
+ in?: Date | string[];
1008
+ notIn?: Date | string[];
1009
+ lesserThan?: Date | string;
1010
+ lesserThanOrEqual?: Date | string;
1011
+ greaterThan?: Date | string;
1012
+ greaterThanOrEqual?: Date | string;
1013
+ };
1014
+ vendorRoundId?: {
1015
+ equal?: string;
1016
+ notEqual?: string;
1017
+ in?: string[];
1018
+ notIn?: string[];
1019
+ contains?: string;
1020
+ startsWith?: string;
1021
+ };
1022
+ status?: {
1023
+ equal?: BetRecordStatus;
1024
+ notEqual?: BetRecordStatus;
1025
+ in?: BetRecordStatus[];
1026
+ notIn?: BetRecordStatus[];
1027
+ };
1028
+ };
1029
+ startDateTime?: {
1030
+ equal?: Date | string;
1031
+ notEqual?: Date | string;
1032
+ in?: Date | string[];
1033
+ notIn?: Date | string[];
1034
+ lesserThan?: Date | string;
1035
+ lesserThanOrEqual?: Date | string;
1036
+ greaterThan?: Date | string;
1037
+ greaterThanOrEqual?: Date | string;
1038
+ };
1039
+ endDateTime?: {
1040
+ equal?: Date | string;
1041
+ notEqual?: Date | string;
1042
+ in?: Date | string[];
1043
+ notIn?: Date | string[];
1044
+ lesserThan?: Date | string;
1045
+ lesserThanOrEqual?: Date | string;
1046
+ greaterThan?: Date | string;
1047
+ greaterThanOrEqual?: Date | string;
1048
+ };
1049
+ }
1050
+
1051
+ interface BetRecord {
1052
+ id: string;
1053
+ game: Game;
1054
+ status: BetRecordStatus;
1055
+ serialCode: string;
1056
+ vendorRoundId?: string;
1057
+ bet: number;
1058
+ payout: number;
1059
+ validBet: number;
1060
+ jackpotContribution: number;
1061
+ jackpotPayout: number;
1062
+ winloss?: number;
1063
+ betContent?: string;
1064
+ contestName?: string;
1065
+ externalCategory?: string;
1066
+ dateTimeSettled?: Date;
1067
+ dateTimeCreated: Date;
1068
+ dateTimeLastUpdated: Date;
1069
+ metadata: {
1070
+ odds?: string;
1071
+ validBet?: number;
1072
+ };
1073
+ }
1074
+
1075
+ type BetRecordsReturn =
1076
+ | {
1077
+ ok: true;
1078
+ data: {
1079
+ betRecords: (BetRecord & { cursor: string })[];
1080
+ totalCount: number;
1081
+ hasNextPage: boolean;
1082
+ endCursor?: string;
1083
+ };
1084
+ }
1085
+ | {
1086
+ ok: false;
1087
+ error: HttpError;
1088
+ };
1089
+ ```
1090
+
1091
+ - `transactionRecords` - Retrieve current user's transaction records
1092
+
1093
+ ```ts
1094
+ transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>
1095
+ ```
1096
+
1097
+ ```ts
1098
+ type TransactionRecordType =
1099
+ | 'DEPOSIT'
1100
+ | 'PAYOUT'
1101
+ | 'WITHDRAWAL_REFUND'
1102
+ | 'TRANSFER_IN'
1103
+ | 'WITHDRAWAL'
1104
+ | 'BET'
1105
+ | 'TRANSFER_OUT'
1106
+ | 'ROLLBACK'
1107
+ | 'BET_REFUND'
1108
+ | 'PAYOUT_REFUND'
1109
+ | 'CASHBACK_BONUS'
1110
+ | 'BONUS'
1111
+ | 'RESERVE'
1112
+ | 'REJECT_WITHDRAWAL'
1113
+ | 'MANUAL_DEPOSIT'
1114
+ | 'GCASH_DEPOSIT'
1115
+ | 'MANUAL_WITHDRAWAL'
1116
+ | 'BANK_WITHDRAWAL'
1117
+ | 'GCASH_WITHDRAWAL'
1118
+ | 'COMMIT_RESERVE'
1119
+ | 'ROLLBACK_PAYOUT'
1120
+ | 'ROLLBACK_RESERVE';
1121
+
1122
+ interface TransactionRecordsInput {
1123
+ first?: number;
1124
+ after?: string;
1125
+ filter?: {
1126
+ type?: {
1127
+ equal?: TransactionRecordType;
1128
+ notEqual?: TransactionRecordType;
1129
+ in?: TransactionRecordType[];
1130
+ notIn?: TransactionRecordType[];
1131
+ };
1132
+ referenceNumber?: {
1133
+ equal?: string;
1134
+ notEqual?: string;
1135
+ in?: string[];
1136
+ notIn?: string[];
1137
+ contains?: string;
1138
+ startsWith?: string;
1139
+ };
1140
+ dateTimeCreated?: {
1141
+ equal?: Date | string;
1142
+ notEqual?: Date | string;
1143
+ in?: Date | string[];
1144
+ notIn?: Date | string[];
1145
+ lesserThan?: Date | string;
1146
+ lesserThanOrEqual?: Date | string;
1147
+ greaterThan?: Date | string;
1148
+ greaterThanOrEqual?: Date | string;
1149
+ };
1150
+ };
1151
+ }
1152
+
1153
+ interface TransactionRecord {
1154
+ id: string;
1155
+ type: TransactionRecordType;
1156
+ amount: number;
1157
+ content?: string;
1158
+ currentBalance: number;
1159
+ referenceNumber: string;
1160
+ dateTimeCreated: Date;
1161
+ dateTimeLastUpdated: Date;
1162
+ }
1163
+
1164
+ type TransactionRecordsReturn =
1165
+ | {
1166
+ ok: true;
1167
+ data: {
1168
+ transactionRecords: (TransactionRecord & { cursor: string })[];
1169
+ totalCount: number;
1170
+ hasNextPage: boolean;
1171
+ endCursor?: string;
1172
+ };
1173
+ }
1174
+ | {
1175
+ ok: false;
1176
+ error: HttpError;
1177
+ };
1178
+ ```
1179
+
1180
+ - `promos` - Retrieve promos for current platform
1181
+
1182
+ ```ts
1183
+ promos(): Promise<PromosReturn>
1184
+ ```
1185
+
1186
+ ```ts
1187
+ interface Promo {
1188
+ id: string;
1189
+ type: 'DEPOSIT';
1190
+ name: string;
1191
+ banner: {
1192
+ id: string;
1193
+ url: string;
1194
+ status: 'READY';
1195
+ dateTimeCreated: Date;
1196
+ };
1197
+ status: 'ACTIVE' | 'INACTIVE' | 'DISABLED' | 'EXPIRED';
1198
+ description: string;
1199
+ minimumBonusAmount?: number;
1200
+ maximumBonusAmount?: number;
1201
+ minimumDepositAmount?: number;
1202
+ maximumDepositAmount?: number;
1203
+ activationStartDateTime: Date;
1204
+ activationEndDateTime: Date;
1205
+ dateTimeCreated: Date;
1206
+ dateTimeLastUpdated: Date;
1207
+ }
1208
+
1209
+ type PromosReturn =
1210
+ | {
1211
+ ok: true;
1212
+ data: Promo[];
1213
+ }
1214
+ | {
1215
+ ok: false;
1216
+ error: HttpError;
1217
+ };
1218
+ ```
1219
+
1220
+ - `availablePromos` - Retrieve available promos for current user
1221
+
1222
+ ```ts
1223
+ availablePromos(): Promise<PromosReturn>
1224
+ ```
1225
+
1226
+ - `bonus` - Retrieve current user's bonus details
1227
+
1228
+ ```ts
1229
+ bonus(): Promise<BonusReturn>
1230
+ ```
1231
+
1232
+ ```ts
1233
+ interface Bonus {
1234
+ id: string;
1235
+ promo: Promo;
1236
+ deposit?: {
1237
+ type: DepositRecordType;
1238
+ status: DepositRecordStatus;
1239
+ amount: number;
1240
+ netAmount: number;
1241
+ fee: number;
1242
+ reference?: string;
1243
+ dateTimeCreated: Date;
1244
+ dateTimeLastUpdated: Date;
1245
+ };
1246
+ amount: number;
1247
+ balance: number;
1248
+ turnoverRequirement: number;
1249
+ currentTurnoverRequirementContribution: number;
1250
+ currentTurnoverRequirementContributionPercentage: number;
1251
+ expiration: Date;
1252
+ dateTimeCreated: Date;
1253
+ dateTimeLastUpdated: Date;
1254
+ }
1255
+
1256
+ type BonusReturn =
1257
+ | {
1258
+ ok: true;
1259
+ data: Bonus | null;
1260
+ }
1261
+ | {
1262
+ ok: false;
1263
+ error: HttpError;
1264
+ };
1265
+ ```
1266
+
1267
+ - `cashbacks` - Retrieve cashbacks for current platform
1268
+
1269
+ ```ts
1270
+ cashbacks(): Promise<CashbackReturn>
1271
+ ```
1272
+
1273
+ ```ts
1274
+ interface Cashback {
1275
+ id: string;
1276
+ name: string;
1277
+ banner: {
1278
+ id: string;
1279
+ url: string;
1280
+ status: 'READY';
1281
+ dateTimeCreated: Date;
1282
+ };
1283
+ status: CashbackStatus;
1284
+ description: string;
1285
+ activationStartDateTime: Date;
1286
+ activationEndDateTime: Date;
1287
+ dateTimeCreated: Date;
1288
+ dateTimeLastUpdated: Date;
1289
+ }
1290
+
1291
+ type CashbackReturn =
1292
+ | {
1293
+ ok: true;
1294
+ data: Cashback[];
1295
+ }
1296
+ | {
1297
+ ok: false;
1298
+ error: HttpError;
1299
+ };
1300
+ ```
1301
+
1302
+ - `cashbackBonuses` - Retrieve current user's cashback bonuses
1303
+
1304
+ ```ts
1305
+ cashbackBonuses(): Promise<CashbackBonusesReturn>
1306
+ ```
1307
+
1308
+ ```ts
1309
+ interface CashbackBonus {
1310
+ id: string;
1311
+ balance: number;
1312
+ cashback: Cashback;
1313
+ dateTimeCreated: Date;
1314
+ dateTimeLastUpdated: Date;
1315
+ }
1316
+
1317
+ type CashbackBonusesReturn =
1318
+ | {
1319
+ ok: true;
1320
+ data: CashbackBonus[];
1321
+ }
1322
+ | {
1323
+ ok: false;
1324
+ error: HttpError;
1325
+ };
1326
+ ```
1327
+
1328
+ - `claimCashbackBonus` - Claim cashback bonus
1329
+
1330
+ ```ts
1331
+ claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>
1332
+ ```
1333
+
1334
+ ```ts
1335
+ type ClaimCashbackBonusReturn =
1336
+ | {
1337
+ ok: true;
1338
+ }
1339
+ | {
1340
+ ok: false;
1341
+ error:
1342
+ | HttpError
1343
+ | {
1344
+ name: 'CashbackBonusDoesNotExistError';
1345
+ message: string;
1346
+ };
1347
+ };
1348
+ ```
1349
+
1350
+ - `games` - Retrieve games
1351
+
1352
+ ```ts
1353
+ games(input?: GamesInput): Promise<GamesReturn>
1354
+ ```
1355
+
1356
+ ```ts
1357
+ type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
1358
+ type GameProvider =
1359
+ | 'JILI'
1360
+ | 'PGSOFT'
1361
+ | 'FACHAI'
1362
+ | 'PLAYTECH'
1363
+ | 'CQ9'
1364
+ | 'JDB'
1365
+ | 'BOOONGO'
1366
+ | 'HABANERO'
1367
+ | 'RELAXGAMING'
1368
+ | 'DG'
1369
+ | 'E2E'
1370
+ | 'BTI'
1371
+ | 'DARWIN'
1372
+ | 'MEGABALL'
1373
+ | 'DRBINGO'
1374
+ | 'RTG';
1375
+
1376
+ interface GamesInput {
1377
+ after?: string;
1378
+ first?: number;
1379
+ filter?: {
1380
+ id?: {
1381
+ equal?: string;
1382
+ notEqual?: string;
1383
+ in?: string[];
1384
+ notIn?: string[];
1385
+ };
1386
+ name?: {
1387
+ equal?: string;
1388
+ notEqual?: string;
1389
+ in?: string[];
1390
+ notIn?: string[];
1391
+ contains?: string;
1392
+ startsWith?: string;
1393
+ };
1394
+ type?: {
1395
+ equal?: GameType;
1396
+ notEqual?: GameType;
1397
+ in?: GameType[];
1398
+ notIn?: GameType[];
1399
+ };
1400
+ provider?: {
1401
+ equal?: GameProvider;
1402
+ notEqual?: GameProvider;
1403
+ in?: GameProvider[];
1404
+ notIn?: GameProvider[];
1405
+ };
1406
+ };
1407
+ }
1408
+
1409
+ interface Game {
1410
+ id: string;
1411
+ type: GameType;
1412
+ name: string;
1413
+ image: string;
1414
+ provider: GameProvider;
1415
+ }
1416
+
1417
+ type GamesReturn =
1418
+ | {
1419
+ ok: true;
1420
+ data: {
1421
+ games: (Game & { cursor: string })[];
1422
+ totalCount: number;
1423
+ hasNextPage: boolean;
1424
+ endCursor?: string;
1425
+ };
1426
+ }
1427
+ | {
1428
+ ok: false;
1429
+ error: HttpError;
1430
+ };
1431
+ ```
1432
+
1433
+ - `gameSession` - Retrieve game session details
1434
+
1435
+ ```ts
1436
+ gameSession(id: string): Promise<GameSessionReturn>
1437
+ ```
1438
+
1439
+ ```ts
1440
+ type GameSession =
1441
+ | {
1442
+ id: string;
1443
+ game: Game;
1444
+ status: 'READY';
1445
+ launchUrl: string;
1446
+ dateTimeCreated: Date;
1447
+ dateTimeLastUpdated: Date;
1448
+ }
1449
+ | {
1450
+ id: string;
1451
+ game: Game;
1452
+ status: 'PENDING' | 'STARTING' | 'ENDED' | 'CANCELLED';
1453
+ dateTimeCreated: Date;
1454
+ dateTimeLastUpdated: Date;
1455
+ };
1456
+
1457
+ type GameSessionReturn =
1458
+ | {
1459
+ ok: true;
1460
+ data: GameSession | null;
1461
+ }
1462
+ | {
1463
+ ok: false;
1464
+ error: HttpError;
1465
+ };
1466
+ ```
1467
+
1468
+ - `createGameSession` - Create new game session
1469
+
1470
+ ```ts
1471
+ createGameSession(input:CreateGameSessionInput): Promise<CreateGameSessionReturn>
1472
+ ```
1473
+
1474
+ ```ts
1475
+ interface CreateGameSessionInput {
1476
+ id?: string;
1477
+ game: string;
1478
+ }
1479
+
1480
+ type CreateGameSessionReturn =
1481
+ | {
1482
+ ok: true;
1483
+ data: {
1484
+ id: string;
1485
+ };
1486
+ }
1487
+ | {
1488
+ ok: false;
1489
+ error:
1490
+ | HttpError
1491
+ | {
1492
+ name: 'GameDoesNotExistError';
1493
+ message: string;
1494
+ };
1495
+ };
1496
+ ```
1497
+
1498
+ - `endGameSession` - End game session
1499
+
1500
+ ```ts
1501
+ endGameSession(id: string): Promise<EndGameSessionReturn>
1502
+ ```
1503
+
1504
+ ```ts
1505
+ type EndGameSessionReturn =
1506
+ | {
1507
+ ok: true;
1508
+ }
1509
+ | {
1510
+ ok: false;
1511
+ error: HttpError | UnknownError;
1512
+ };
1513
+ ```
1514
+
1515
+ - `file` - Retrieve file details
1516
+
1517
+ ```ts
1518
+ file(id: string): Promise<FileReturn>
1519
+ ```
1520
+
1521
+ ```ts
1522
+ type File =
1523
+ | {
1524
+ id: string;
1525
+ url?: never;
1526
+ status: 'UPLOADING' | 'FAILED';
1527
+ dateTimeCreated: Date;
1528
+ }
1529
+ | {
1530
+ id: string;
1531
+ url: string;
1532
+ status: 'READY';
1533
+ dateTimeCreated: Date;
1534
+ }
1535
+ | {
1536
+ id: string;
1537
+ url?: string;
1538
+ status: 'DELETED';
1539
+ dateTimeCreated: Date;
1540
+ };
1541
+
1542
+ type FileReturn =
1543
+ | {
1544
+ ok: true;
1545
+ data: File | null;
1546
+ }
1547
+ | {
1548
+ ok: false;
1549
+ error: HttpError;
1550
+ };
1551
+ ```
1552
+
1553
+ - `uploadImageFile` - Upload image file
1554
+
1555
+ ```ts
1556
+ uploadImageFile(input: globalThis.File): Promise<UploadImageFileReturn>
1557
+ ```
1558
+
1559
+ ```ts
1560
+ type UploadImageFileReturn =
1561
+ | {
1562
+ ok: true;
1563
+ data: {
1564
+ id: string;
1565
+ };
1566
+ }
1567
+ | {
1568
+ ok: false;
1569
+ error:
1570
+ | HttpError
1571
+ | {
1572
+ name: 'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError';
1573
+ message: string;
1574
+ };
1575
+ };
1576
+ ```
1577
+
1578
+ - `pointsWallet` - Retrieve current user's points wallet details
1579
+
1580
+ ```ts
1581
+ pointsWallet(): Promise<PointsWalletReturn>
1582
+ ```
1583
+
1584
+ ```ts
1585
+ interface PointsWallet {
1586
+ id: string;
1587
+ points: number;
1588
+ account: string;
1589
+ dateTimeCreated: Date;
1590
+ }
1591
+
1592
+ type PointsWalletReturn =
1593
+ | {
1594
+ ok: true;
1595
+ data: PointsWallet | null;
1596
+ }
1597
+ | {
1598
+ ok: false;
1599
+ error: HttpError;
1600
+ };
1601
+ ```
1602
+
1603
+ - `pointsToCashConversion` - Convert points to cash
1604
+
1605
+ ```ts
1606
+ pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>
1607
+ ```
1608
+
1609
+ ```ts
1610
+ type PointsToCashConversionReturn =
1611
+ | {
1612
+ ok: true;
1613
+ }
1614
+ | {
1615
+ ok: false;
1616
+ error:
1617
+ | HttpError
1618
+ | {
1619
+ name: 'InsufficientPointsError';
1620
+ message: string;
1621
+ };
1622
+ };
1623
+ ```