@opexa/portal-sdk 0.0.1
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 +1591 -0
- package/dist/graphql/account.service.d.ts +24 -0
- package/dist/graphql/announcement.d.ts +29 -0
- package/dist/graphql/auth.service.d.ts +16 -0
- package/dist/graphql/bet-record.d.ts +71 -0
- package/dist/graphql/bonus.d.ts +43 -0
- package/dist/graphql/cashback.d.ts +22 -0
- package/dist/graphql/deposit.d.ts +94 -0
- package/dist/graphql/file.d.ts +38 -0
- package/dist/graphql/file.service.d.ts +11 -0
- package/dist/graphql/game.d.ts +84 -0
- package/dist/graphql/game.service.d.ts +14 -0
- package/dist/graphql/index.d.ts +23 -0
- package/dist/graphql/member.d.ts +182 -0
- package/dist/graphql/platform.d.ts +38 -0
- package/dist/graphql/points.d.ts +22 -0
- package/dist/graphql/portal.service.d.ts +9 -0
- package/dist/graphql/promo.d.ts +35 -0
- package/dist/graphql/report.service.d.ts +18 -0
- package/dist/graphql/session.d.ts +25 -0
- package/dist/graphql/static.service.d.ts +12 -0
- package/dist/graphql/transaction.d.ts +26 -0
- package/dist/graphql/types.d.ts +93 -0
- package/dist/graphql/wallet.d.ts +14 -0
- package/dist/graphql/wallet.service.d.ts +30 -0
- package/dist/graphql/withdrawal.d.ts +106 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1007 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2916 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/object-id.d.ts +1 -0
- package/dist/object-type.d.ts +9 -0
- package/dist/sdk.d.ts +228 -0
- package/dist/session-service.d.ts +25 -0
- package/dist/transformer.d.ts +52 -0
- package/dist/types.d.ts +839 -0
- package/dist/utils/add-days.d.ts +1 -0
- package/dist/utils/add-minutes.d.ts +1 -0
- package/dist/utils/clone-date.d.ts +1 -0
- package/dist/utils/gql.d.ts +1 -0
- package/dist/utils/graphql-client.d.ts +29 -0
- package/dist/utils/http-error.d.ts +6 -0
- package/dist/utils/is-after.d.ts +4 -0
- package/dist/utils/parse-decimal.d.ts +2 -0
- package/dist/utils/sha256.d.ts +1 -0
- package/dist/utils/sub-minutes.d.ts +1 -0
- package/dist/utils/types.d.ts +5 -0
- package/package.json +81 -0
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { AccountReturn, AnnouncementsInput, AnnouncementsReturn, AvailablePromosReturn, BetRecordsInput, BetRecordsReturn, BonusReturn, CashbackBonusReturn, CashbacksReturn, ClaimCashbackBonusReturn, CreateAccountInput, CreateAccountReturn, CreateDepositInput, CreateDepositReturn, CreateGameSessionInput, CreateGameSessionReturn, CreateWithdrawalInput, CreateWithdrawalReturn, DeleteAccountReturn, DepositRecordsInput, DepositRecordsReturn, DepositReturn, DepositsCountReturn, EndGameSessionReturn, FileReturn, GameSessionReturn, GamesByNameInput, GamesByNameInput__Next, GamesByNameReturn, GamesInput, GamesInput__Next, GamesReturn, LatestBetRecordsReturn, PlatformReturn, PointsToCashConversionReturn, PointsWalletReturn, ProfileCompletionReturn, PromosReturn, RemainingDailyWithdrawalsCountReturn, ResetPasswordInput, ResetPasswordReturn, SendVerificationCodeReturn, SessionReturn, SignInInput, SignInReturn, SubmitVerificationDetailsInput, SubmitVerificationDetailsReturn, TransactionRecordsInput, TransactionRecordsReturn, UpdateAccountInput, UpdateAccountReturn, UpdateVerificationDetailsInput, UpdateVerificationDetailsReturn, UploadImageFileInput, UploadImageFileReturn, VerificationDetailsReturn, VerifyMobileNumberReturn, WalletReturn, WithdrawalRecordsInput, WithdrawalRecordsReturn } from './types';
|
|
2
|
+
|
|
3
|
+
export interface SdkConfig {
|
|
4
|
+
platform: string;
|
|
5
|
+
/**
|
|
6
|
+
* @description Whether to use production or development endpoints.
|
|
7
|
+
* @default "development"
|
|
8
|
+
*/
|
|
9
|
+
environment?: 'production' | 'development';
|
|
10
|
+
/**
|
|
11
|
+
* @description Enables/disables logging.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
log?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class Sdk {
|
|
17
|
+
private gameService;
|
|
18
|
+
private fileService;
|
|
19
|
+
private walletService;
|
|
20
|
+
private reportService;
|
|
21
|
+
private portalService;
|
|
22
|
+
private accountService;
|
|
23
|
+
private sessionService;
|
|
24
|
+
private transformer;
|
|
25
|
+
private logger;
|
|
26
|
+
constructor(config: SdkConfig);
|
|
27
|
+
private get authMiddleware();
|
|
28
|
+
signIn(input: SignInInput): Promise<SignInReturn>;
|
|
29
|
+
signOut(): Promise<void>;
|
|
30
|
+
session(): Promise<SessionReturn>;
|
|
31
|
+
platform(): Promise<PlatformReturn>;
|
|
32
|
+
account(): Promise<AccountReturn>;
|
|
33
|
+
/**
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const res = await sdk.createAccount({
|
|
37
|
+
* id: ObjectId.generate(ObjectType.Account).toString(),
|
|
38
|
+
* name: data.name,
|
|
39
|
+
* password: data.password,
|
|
40
|
+
* dateOfBirth: new Date(data.dateOfBirth),
|
|
41
|
+
* mobileNumber: data.mobileNumber,
|
|
42
|
+
* domain: data.domain,
|
|
43
|
+
* verificationCode: data.verificationCode,
|
|
44
|
+
* reCAPTCHAResponse: data.reCAPTCHAResponse,
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* if (!res.ok) {
|
|
48
|
+
* window.alert(res.error.message);
|
|
49
|
+
* } else {
|
|
50
|
+
* // Do something
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
createAccount(input: CreateAccountInput): Promise<CreateAccountReturn>;
|
|
55
|
+
/**
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const res = await sdk.updateAccount(user.id, {
|
|
59
|
+
* validId: data.validId,
|
|
60
|
+
* realName: data.realName,
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* if (!res.ok) {
|
|
64
|
+
* window.alert(res.error.message);
|
|
65
|
+
* } else {
|
|
66
|
+
* // Do something
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
updateAccount(id: string, input: UpdateAccountInput): Promise<UpdateAccountReturn>;
|
|
71
|
+
deleteAccount(id: string): Promise<DeleteAccountReturn>;
|
|
72
|
+
verificationDetails(): Promise<VerificationDetailsReturn>;
|
|
73
|
+
/**
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const res = await sdk.submitVerificationDetails({
|
|
77
|
+
* id: ObjectId.generate(ObjectType.Verification).toString(),
|
|
78
|
+
* idFrontImage: data.idFrontImage,
|
|
79
|
+
* selfieImage: data.selfieImage,
|
|
80
|
+
* address: data.address,
|
|
81
|
+
* sourceOfIncome: data.sourceOfIncome,
|
|
82
|
+
* natureOfWork: data.natureOfWork,
|
|
83
|
+
* placeOfBirth: data.placeOfBirth,
|
|
84
|
+
* nationality: data.nationality,
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* if (!res.ok) {
|
|
88
|
+
* window.alert(res.error.message);
|
|
89
|
+
* } else {
|
|
90
|
+
* // Do something
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
submitVerificationDetails(input: SubmitVerificationDetailsInput): Promise<SubmitVerificationDetailsReturn>;
|
|
95
|
+
/**
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const res = await sdk.submitVerificationDetails(verificationDetails.id, {
|
|
99
|
+
* idFrontImage: data.idFrontImage,
|
|
100
|
+
* selfieImage: data.selfieImage,
|
|
101
|
+
* });
|
|
102
|
+
*
|
|
103
|
+
* if (!res.ok) {
|
|
104
|
+
* window.alert(res.error.message);
|
|
105
|
+
* } else {
|
|
106
|
+
* // Do something
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
updateVerificationDetails(id: string, input: UpdateVerificationDetailsInput): Promise<UpdateVerificationDetailsReturn>;
|
|
111
|
+
resetPassword(input: ResetPasswordInput): Promise<ResetPasswordReturn>;
|
|
112
|
+
verifyMobileNumber(verificationCode: string): Promise<VerifyMobileNumberReturn>;
|
|
113
|
+
profileCompletion(): Promise<ProfileCompletionReturn>;
|
|
114
|
+
sendVerificationCode(mobileNumber: string): Promise<SendVerificationCodeReturn>;
|
|
115
|
+
wallet(): Promise<WalletReturn>;
|
|
116
|
+
announcements(input?: AnnouncementsInput): Promise<AnnouncementsReturn>;
|
|
117
|
+
/**
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const res = await sdk.createWithdrawal({
|
|
121
|
+
* id: ObjectId.generate(ObjectType.Withdrawal).toString(),
|
|
122
|
+
* type: 'BANK',
|
|
123
|
+
* amount: data.amount,
|
|
124
|
+
* transactionPassword: data.transactionPassword,
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* if (!res.ok) {
|
|
128
|
+
* window.alert(res.error.message);
|
|
129
|
+
* } else {
|
|
130
|
+
* // Do something
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
createWithdrawal(input: CreateWithdrawalInput): Promise<CreateWithdrawalReturn>;
|
|
135
|
+
withdrawalRecords(input?: WithdrawalRecordsInput): Promise<WithdrawalRecordsReturn>;
|
|
136
|
+
remainingDailyWithdrawalsCount(): Promise<RemainingDailyWithdrawalsCountReturn>;
|
|
137
|
+
/**
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const res = await sdk.createDeposit({
|
|
141
|
+
* id: ObjectId.generate(ObjectType.Deposit).toString(),
|
|
142
|
+
* type: 'GCASH',
|
|
143
|
+
* amount: data.amount,
|
|
144
|
+
* promo: data.promo,
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* if (!res.ok) {
|
|
148
|
+
* window.alert(res.error.message);
|
|
149
|
+
* } else {
|
|
150
|
+
* // Do something
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
createDeposit(input: CreateDepositInput): Promise<CreateDepositReturn>;
|
|
155
|
+
deposit(id: string): Promise<DepositReturn>;
|
|
156
|
+
depositRecords(input?: DepositRecordsInput): Promise<DepositRecordsReturn>;
|
|
157
|
+
depositsCount(): Promise<DepositsCountReturn>;
|
|
158
|
+
betRecords(input?: BetRecordsInput): Promise<BetRecordsReturn>;
|
|
159
|
+
latestBetRecords(): Promise<LatestBetRecordsReturn>;
|
|
160
|
+
transactionRecords(input?: TransactionRecordsInput): Promise<TransactionRecordsReturn>;
|
|
161
|
+
promos(): Promise<PromosReturn>;
|
|
162
|
+
availablePromos(): Promise<AvailablePromosReturn>;
|
|
163
|
+
cashbacks(): Promise<CashbacksReturn>;
|
|
164
|
+
bonus(): Promise<BonusReturn>;
|
|
165
|
+
cashbackBonuses(): Promise<CashbackBonusReturn>;
|
|
166
|
+
claimCashbackBonus(id: string): Promise<ClaimCashbackBonusReturn>;
|
|
167
|
+
games(input?: GamesInput): Promise<GamesReturn>;
|
|
168
|
+
gamesByName(input: GamesByNameInput): Promise<GamesByNameReturn>;
|
|
169
|
+
gamesByName__next(input: GamesByNameInput__Next): Promise<GamesByNameReturn>;
|
|
170
|
+
games__next(input?: GamesInput__Next): Promise<GamesReturn>;
|
|
171
|
+
/**
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const res = await sdk.createGameSession({
|
|
175
|
+
* id: ObjectId.generate(ObjectType.GameSession).toString(),
|
|
176
|
+
* game: game.id,
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* if (!res.ok) {
|
|
180
|
+
* window.alert(res.error.message);
|
|
181
|
+
* } else {
|
|
182
|
+
* // Do something
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
createGameSession(input: CreateGameSessionInput): Promise<CreateGameSessionReturn>;
|
|
187
|
+
/**
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const res = await sdk.createGameSession({
|
|
191
|
+
* id: ObjectId.generate(ObjectType.GameSession).toString(),
|
|
192
|
+
* game: game.id,
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* if (!res.ok) {
|
|
196
|
+
* window.alert(res.error.message);
|
|
197
|
+
* } else {
|
|
198
|
+
* // Do something
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
createGameSession__next(input: CreateGameSessionInput): Promise<CreateGameSessionReturn>;
|
|
203
|
+
gameSession(id: string): Promise<GameSessionReturn>;
|
|
204
|
+
gameSession__next(id: string): Promise<GameSessionReturn>;
|
|
205
|
+
endGameSession(id: string): Promise<EndGameSessionReturn>;
|
|
206
|
+
endGameSession__next(id: string): Promise<EndGameSessionReturn>;
|
|
207
|
+
file(id: string): Promise<FileReturn>;
|
|
208
|
+
/**
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* const res = await sdk.uploadImageFile({
|
|
212
|
+
* id: ObjectId.generate(ObjectType.File).toString(),
|
|
213
|
+
* file: data.file,
|
|
214
|
+
* });
|
|
215
|
+
*
|
|
216
|
+
* if (!res.ok) {
|
|
217
|
+
* window.alert(res.error.message);
|
|
218
|
+
* } else {
|
|
219
|
+
* // Do something
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
uploadImageFile(input: UploadImageFileInput): Promise<UploadImageFileReturn>;
|
|
224
|
+
pointsWallet(): Promise<PointsWalletReturn>;
|
|
225
|
+
pointsToCashConversion(amount: number): Promise<PointsToCashConversionReturn>;
|
|
226
|
+
private addAreaCode;
|
|
227
|
+
}
|
|
228
|
+
export default Sdk;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AuthServiceConfig, CreateSessionInput } from './graphql';
|
|
2
|
+
import { Session } from './types';
|
|
3
|
+
|
|
4
|
+
export declare class SessionService {
|
|
5
|
+
private logger;
|
|
6
|
+
private storageKey;
|
|
7
|
+
private authService;
|
|
8
|
+
constructor(config: AuthServiceConfig);
|
|
9
|
+
create(input: CreateSessionInput): Promise<{
|
|
10
|
+
ok: false;
|
|
11
|
+
data?: never;
|
|
12
|
+
error: import('./utils/http-error').HttpError | import('./graphql').CreateSessionError;
|
|
13
|
+
} | {
|
|
14
|
+
ok: true;
|
|
15
|
+
}>;
|
|
16
|
+
session(): Promise<{
|
|
17
|
+
session: Session;
|
|
18
|
+
accessToken: string;
|
|
19
|
+
accessTokenExpiresAt: number;
|
|
20
|
+
refreshToken: string;
|
|
21
|
+
refreshTokenExpiresAt: number;
|
|
22
|
+
} | null>;
|
|
23
|
+
destroy(): Promise<void>;
|
|
24
|
+
private get isServer();
|
|
25
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type * as Internal from './graphql';
|
|
2
|
+
import type * as External from './types';
|
|
3
|
+
interface TransformerConfig {
|
|
4
|
+
environment?: 'development' | 'production';
|
|
5
|
+
}
|
|
6
|
+
export declare class Transformer {
|
|
7
|
+
private staticService;
|
|
8
|
+
constructor(config?: TransformerConfig);
|
|
9
|
+
get transform(): {
|
|
10
|
+
platform: (data: Internal.Platform) => External.Platform;
|
|
11
|
+
account: (data: Internal.MemberAccount & Internal.Member) => External.Account;
|
|
12
|
+
wallet: (data: Internal.Wallet) => External.Wallet;
|
|
13
|
+
verificationDetails: (data: Internal.MemberVerification) => External.VerificationDetails;
|
|
14
|
+
profileCompletion: (data: Internal.ProfileCompletion) => External.ProfileCompletion;
|
|
15
|
+
announcement: (data: Internal.Announcement) => External.Announcement;
|
|
16
|
+
withdrawalRecord: (data: Internal.WithdrawalRecord) => External.WithdrawalRecord;
|
|
17
|
+
deposit: (data: Internal.Deposit) => External.Deposit;
|
|
18
|
+
depositRecord: (data: Internal.DepositRecord) => External.DepositRecord;
|
|
19
|
+
betRecord: (data: Internal.BetRecord) => External.BetRecord;
|
|
20
|
+
latestBetRecord: (data: Internal.LatestBetRecord) => External.LatestBetRecord;
|
|
21
|
+
transactionRecord: (data: Internal.TransactionRecord) => External.TransactionRecord;
|
|
22
|
+
game: (data: Internal.Game) => External.Game;
|
|
23
|
+
gameSession: (data: Internal.GameSession) => External.GameSession;
|
|
24
|
+
promo: (data: Internal.Promo) => External.Promo;
|
|
25
|
+
cashback: (data: Internal.Cashback) => External.Cashback;
|
|
26
|
+
bonus: (data: Internal.Bonus) => External.Bonus;
|
|
27
|
+
cashbackBonus: (data: Internal.CashbackBonus) => External.CashbackBonus;
|
|
28
|
+
file: (data: Internal.File) => External.File;
|
|
29
|
+
pointsWallet: (data: Internal.PointsWallet) => External.PointsWallet;
|
|
30
|
+
};
|
|
31
|
+
private platform;
|
|
32
|
+
private account;
|
|
33
|
+
private wallet;
|
|
34
|
+
private verificationDetails;
|
|
35
|
+
private profileCompletion;
|
|
36
|
+
private announcement;
|
|
37
|
+
private withdrawalRecord;
|
|
38
|
+
private deposit;
|
|
39
|
+
private depositRecord;
|
|
40
|
+
private betRecord;
|
|
41
|
+
private latestBetRecord;
|
|
42
|
+
private transactionRecord;
|
|
43
|
+
private game;
|
|
44
|
+
private gameSession;
|
|
45
|
+
private promo;
|
|
46
|
+
private cashback;
|
|
47
|
+
private bonus;
|
|
48
|
+
private cashbackBonus;
|
|
49
|
+
private file;
|
|
50
|
+
private pointsWallet;
|
|
51
|
+
}
|
|
52
|
+
export {};
|