@footballbingo/client 1.0.0
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 +420 -0
- package/dist/FootballBingoClient.d.ts +88 -0
- package/dist/FootballBingoClient.js +100 -0
- package/dist/core/ApiError.d.ts +10 -0
- package/dist/core/ApiError.js +15 -0
- package/dist/core/ApiRequestOptions.d.ts +13 -0
- package/dist/core/ApiRequestOptions.js +2 -0
- package/dist/core/ApiResult.d.ts +7 -0
- package/dist/core/ApiResult.js +2 -0
- package/dist/core/BaseHttpRequest.d.ts +8 -0
- package/dist/core/BaseHttpRequest.js +9 -0
- package/dist/core/CancelablePromise.d.ts +20 -0
- package/dist/core/CancelablePromise.js +116 -0
- package/dist/core/FetchHttpRequest.d.ts +14 -0
- package/dist/core/FetchHttpRequest.js +20 -0
- package/dist/core/OpenAPI.d.ts +16 -0
- package/dist/core/OpenAPI.js +14 -0
- package/dist/core/request.d.ts +30 -0
- package/dist/core/request.js +294 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.js +139 -0
- package/dist/models/Achievement.d.ts +12 -0
- package/dist/models/Achievement.js +2 -0
- package/dist/models/ApiError.d.ts +2 -0
- package/dist/models/ApiError.js +2 -0
- package/dist/models/ApiErrorDTO.d.ts +9 -0
- package/dist/models/ApiErrorDTO.js +2 -0
- package/dist/models/ApiResponse.d.ts +2 -0
- package/dist/models/ApiResponse.js +2 -0
- package/dist/models/ApiResponseDTO.d.ts +10 -0
- package/dist/models/ApiResponseDTO.js +2 -0
- package/dist/models/BingoBoard.d.ts +8 -0
- package/dist/models/BingoBoard.js +2 -0
- package/dist/models/BingoGame.d.ts +19 -0
- package/dist/models/BingoGame.js +13 -0
- package/dist/models/BingoTile.d.ts +8 -0
- package/dist/models/BingoTile.js +2 -0
- package/dist/models/Challenge.d.ts +24 -0
- package/dist/models/Challenge.js +18 -0
- package/dist/models/ChatMessage.d.ts +17 -0
- package/dist/models/ChatMessage.js +12 -0
- package/dist/models/ChatSession.d.ts +13 -0
- package/dist/models/ChatSession.js +2 -0
- package/dist/models/CommunityChallengeDTO.d.ts +32 -0
- package/dist/models/CommunityChallengeDTO.js +19 -0
- package/dist/models/CompletedLine.d.ts +12 -0
- package/dist/models/CompletedLine.js +12 -0
- package/dist/models/CountryDTO.d.ts +5 -0
- package/dist/models/CountryDTO.js +2 -0
- package/dist/models/CreateChallengeRequestDTO.d.ts +22 -0
- package/dist/models/CreateChallengeRequestDTO.js +19 -0
- package/dist/models/CreatePredictionRequestDTO.d.ts +24 -0
- package/dist/models/CreatePredictionRequestDTO.js +12 -0
- package/dist/models/CurrencyTransaction.d.ts +27 -0
- package/dist/models/CurrencyTransaction.js +21 -0
- package/dist/models/DailyLoginRewardDTO.d.ts +13 -0
- package/dist/models/DailyLoginRewardDTO.js +2 -0
- package/dist/models/ErrorResponse.d.ts +5 -0
- package/dist/models/ErrorResponse.js +2 -0
- package/dist/models/FixtureDTO.d.ts +36 -0
- package/dist/models/FixtureDTO.js +16 -0
- package/dist/models/FixtureDetailDTO.d.ts +13 -0
- package/dist/models/FixtureDetailDTO.js +2 -0
- package/dist/models/GameChatMessageDTO.d.ts +20 -0
- package/dist/models/GameChatMessageDTO.js +13 -0
- package/dist/models/GetLeaderboardResponseDTO.d.ts +29 -0
- package/dist/models/GetLeaderboardResponseDTO.js +22 -0
- package/dist/models/GetUserInventoryResponseDTO.d.ts +28 -0
- package/dist/models/GetUserInventoryResponseDTO.js +2 -0
- package/dist/models/LeaderboardEntry.d.ts +10 -0
- package/dist/models/LeaderboardEntry.js +2 -0
- package/dist/models/LeaderboardResponseDTO.d.ts +26 -0
- package/dist/models/LeaderboardResponseDTO.js +13 -0
- package/dist/models/League.d.ts +7 -0
- package/dist/models/League.js +2 -0
- package/dist/models/LeagueDetailDTO.d.ts +17 -0
- package/dist/models/LeagueDetailDTO.js +2 -0
- package/dist/models/LineupDTO.d.ts +25 -0
- package/dist/models/LineupDTO.js +2 -0
- package/dist/models/LineupPrediction.d.ts +9 -0
- package/dist/models/LineupPrediction.js +2 -0
- package/dist/models/MatchEvent.d.ts +27 -0
- package/dist/models/MatchEvent.js +13 -0
- package/dist/models/NewsArticleDTO.d.ts +13 -0
- package/dist/models/NewsArticleDTO.js +2 -0
- package/dist/models/PaginationMeta.d.ts +2 -0
- package/dist/models/PaginationMeta.js +2 -0
- package/dist/models/PaginationMetaDTO.d.ts +7 -0
- package/dist/models/PaginationMetaDTO.js +2 -0
- package/dist/models/PlayerDTO.d.ts +18 -0
- package/dist/models/PlayerDTO.js +2 -0
- package/dist/models/PlayerStatisticsDTO.d.ts +25 -0
- package/dist/models/PlayerStatisticsDTO.js +2 -0
- package/dist/models/PredictionDTO.d.ts +31 -0
- package/dist/models/PredictionDTO.js +18 -0
- package/dist/models/PredictionWithLineupDTO.d.ts +8 -0
- package/dist/models/PredictionWithLineupDTO.js +2 -0
- package/dist/models/Pundit.d.ts +8 -0
- package/dist/models/Pundit.js +2 -0
- package/dist/models/Purchase.d.ts +16 -0
- package/dist/models/Purchase.js +12 -0
- package/dist/models/PurchaseResponseDTO.d.ts +25 -0
- package/dist/models/PurchaseResponseDTO.js +12 -0
- package/dist/models/Score.d.ts +4 -0
- package/dist/models/Score.js +2 -0
- package/dist/models/SendChatMessageRequestDTO.d.ts +12 -0
- package/dist/models/SendChatMessageRequestDTO.js +12 -0
- package/dist/models/ShareGameRequestDTO.d.ts +6 -0
- package/dist/models/ShareGameRequestDTO.js +2 -0
- package/dist/models/SharedGameDTO.d.ts +17 -0
- package/dist/models/SharedGameDTO.js +2 -0
- package/dist/models/StandingsDTO.d.ts +19 -0
- package/dist/models/StandingsDTO.js +2 -0
- package/dist/models/StoreItemDTO.d.ts +47 -0
- package/dist/models/StoreItemDTO.js +29 -0
- package/dist/models/TacticsBoardDTO.d.ts +32 -0
- package/dist/models/TacticsBoardDTO.js +2 -0
- package/dist/models/Team.d.ts +6 -0
- package/dist/models/Team.js +2 -0
- package/dist/models/TeamDetailDTO.d.ts +16 -0
- package/dist/models/TeamDetailDTO.js +2 -0
- package/dist/models/TeamStatisticsDTO.d.ts +12 -0
- package/dist/models/TeamStatisticsDTO.js +2 -0
- package/dist/models/TransactionHistoryDTO.d.ts +9 -0
- package/dist/models/TransactionHistoryDTO.js +2 -0
- package/dist/models/TransferDTO.d.ts +14 -0
- package/dist/models/TransferDTO.js +2 -0
- package/dist/models/TransferPlanDTO.d.ts +45 -0
- package/dist/models/TransferPlanDTO.js +12 -0
- package/dist/models/TrophyDTO.d.ts +6 -0
- package/dist/models/TrophyDTO.js +2 -0
- package/dist/models/UserDTO.d.ts +11 -0
- package/dist/models/UserDTO.js +2 -0
- package/dist/models/UserProfileDTO.d.ts +13 -0
- package/dist/models/UserProfileDTO.js +2 -0
- package/dist/models/UserPurchaseDTO.d.ts +26 -0
- package/dist/models/UserPurchaseDTO.js +19 -0
- package/dist/models/WalletBalance.d.ts +5 -0
- package/dist/models/WalletBalance.js +2 -0
- package/dist/models/WalletSummaryDTO.d.ts +16 -0
- package/dist/models/WalletSummaryDTO.js +2 -0
- package/dist/services/AchievementsDeprecatedService.d.ts +148 -0
- package/dist/services/AchievementsDeprecatedService.js +183 -0
- package/dist/services/AchievementsService.d.ts +204 -0
- package/dist/services/AchievementsService.js +197 -0
- package/dist/services/ActivitiesService.d.ts +27 -0
- package/dist/services/ActivitiesService.js +29 -0
- package/dist/services/AdminPurchasesService.d.ts +64 -0
- package/dist/services/AdminPurchasesService.js +109 -0
- package/dist/services/AdminService.d.ts +349 -0
- package/dist/services/AdminService.js +232 -0
- package/dist/services/AdminUsersService.d.ts +64 -0
- package/dist/services/AdminUsersService.js +103 -0
- package/dist/services/AiChatService.d.ts +70 -0
- package/dist/services/AiChatService.js +52 -0
- package/dist/services/ChallengesService.d.ts +215 -0
- package/dist/services/ChallengesService.js +215 -0
- package/dist/services/CommunityChallengesService.d.ts +111 -0
- package/dist/services/CommunityChallengesService.js +150 -0
- package/dist/services/CommunityGameChatService.d.ts +105 -0
- package/dist/services/CommunityGameChatService.js +150 -0
- package/dist/services/CommunityLineupsService.d.ts +197 -0
- package/dist/services/CommunityLineupsService.js +264 -0
- package/dist/services/CommunitySharedGamesService.d.ts +124 -0
- package/dist/services/CommunitySharedGamesService.js +172 -0
- package/dist/services/CommunityTacticsBoardsService.d.ts +230 -0
- package/dist/services/CommunityTacticsBoardsService.js +272 -0
- package/dist/services/CommunityTransferPlansService.d.ts +231 -0
- package/dist/services/CommunityTransferPlansService.js +291 -0
- package/dist/services/ContentCountriesService.d.ts +30 -0
- package/dist/services/ContentCountriesService.js +53 -0
- package/dist/services/ContentFixturesService.d.ts +51 -0
- package/dist/services/ContentFixturesService.js +88 -0
- package/dist/services/ContentLeaguesService.d.ts +32 -0
- package/dist/services/ContentLeaguesService.js +57 -0
- package/dist/services/ContentNewsService.d.ts +158 -0
- package/dist/services/ContentNewsService.js +255 -0
- package/dist/services/ContentOddsService.d.ts +81 -0
- package/dist/services/ContentOddsService.js +137 -0
- package/dist/services/ContentPlayersService.d.ts +64 -0
- package/dist/services/ContentPlayersService.js +104 -0
- package/dist/services/ContentStandingsService.d.ts +20 -0
- package/dist/services/ContentStandingsService.js +33 -0
- package/dist/services/ContentStatisticsService.d.ts +51 -0
- package/dist/services/ContentStatisticsService.js +83 -0
- package/dist/services/ContentTeamsService.d.ts +67 -0
- package/dist/services/ContentTeamsService.js +106 -0
- package/dist/services/ContentTransfersService.d.ts +23 -0
- package/dist/services/ContentTransfersService.js +38 -0
- package/dist/services/ContentTrophiesService.d.ts +23 -0
- package/dist/services/ContentTrophiesService.js +38 -0
- package/dist/services/DailyChallengeCompletionsDeprecatedService.d.ts +78 -0
- package/dist/services/DailyChallengeCompletionsDeprecatedService.js +130 -0
- package/dist/services/DailyChallengesDeprecatedService.d.ts +117 -0
- package/dist/services/DailyChallengesDeprecatedService.js +179 -0
- package/dist/services/DailyLoginService.d.ts +109 -0
- package/dist/services/DailyLoginService.js +111 -0
- package/dist/services/DailyStreaksDeprecatedService.d.ts +80 -0
- package/dist/services/DailyStreaksDeprecatedService.js +130 -0
- package/dist/services/EventPoolsService.d.ts +104 -0
- package/dist/services/EventPoolsService.js +118 -0
- package/dist/services/LeaderboardService.d.ts +18 -0
- package/dist/services/LeaderboardService.js +35 -0
- package/dist/services/NotificationsService.d.ts +143 -0
- package/dist/services/NotificationsService.js +159 -0
- package/dist/services/PredictionsService.d.ts +223 -0
- package/dist/services/PredictionsService.js +204 -0
- package/dist/services/ProgressionService.d.ts +163 -0
- package/dist/services/ProgressionService.js +149 -0
- package/dist/services/SponsorsService.d.ts +105 -0
- package/dist/services/SponsorsService.js +118 -0
- package/dist/services/StoreService.d.ts +92 -0
- package/dist/services/StoreService.js +147 -0
- package/dist/services/UserAchievementsDeprecatedService.d.ts +146 -0
- package/dist/services/UserAchievementsDeprecatedService.js +209 -0
- package/dist/services/UserActivitiesService.d.ts +48 -0
- package/dist/services/UserActivitiesService.js +65 -0
- package/dist/services/UsersService.d.ts +156 -0
- package/dist/services/UsersService.js +244 -0
- package/dist/services/WalletService.d.ts +31 -0
- package/dist/services/WalletService.js +53 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
# @football-bingo/client
|
|
2
|
+
|
|
3
|
+
> Auto-generated TypeScript client for the Football Bingo API
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@football-bingo/client)
|
|
6
|
+
[](https://github.com/football-bingo/client/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
✅ **100% API Coverage** - Generated directly from OpenAPI specification
|
|
11
|
+
✅ **Fully Typed** - Complete TypeScript support with IntelliSense
|
|
12
|
+
✅ **Auto-Generated** - Stays in sync with API changes
|
|
13
|
+
✅ **Promise-based** - Modern async/await support
|
|
14
|
+
✅ **Tree-shakeable** - Import only what you need
|
|
15
|
+
✅ **Zero Dependencies** - Uses native fetch API
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @football-bingo/client
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { createClient } from '@football-bingo/client';
|
|
27
|
+
|
|
28
|
+
// Initialize the client
|
|
29
|
+
const client = createClient({
|
|
30
|
+
BASE: 'https://api.footballbingo.com',
|
|
31
|
+
TOKEN: async () => {
|
|
32
|
+
// Return your auth token (from Clerk, Auth0, etc.)
|
|
33
|
+
return await getAuthToken();
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Use the client
|
|
38
|
+
const user = await client.users.getUsersMe();
|
|
39
|
+
const fixtures = await client.contentFixtures.getContentFixtures({
|
|
40
|
+
status: 'live',
|
|
41
|
+
limit: 20,
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
### Basic Configuration
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const client = createClient({
|
|
51
|
+
BASE: 'https://api.footballbingo.com', // API base URL
|
|
52
|
+
VERSION: '1.0.0', // API version
|
|
53
|
+
TOKEN: async () => string, // Auth token provider
|
|
54
|
+
USERNAME: 'user', // Basic auth username
|
|
55
|
+
PASSWORD: 'pass', // Basic auth password
|
|
56
|
+
HEADERS: {}, // Additional headers
|
|
57
|
+
ENCODE_PATH: (path) => path, // Custom path encoding
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### With Clerk Authentication
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { useAuth } from '@clerk/clerk-react';
|
|
65
|
+
import { createClient } from '@football-bingo/client';
|
|
66
|
+
|
|
67
|
+
function useFootballBingoClient() {
|
|
68
|
+
const { getToken } = useAuth();
|
|
69
|
+
|
|
70
|
+
return createClient({
|
|
71
|
+
BASE: process.env.REACT_APP_API_URL!,
|
|
72
|
+
TOKEN: () => getToken(),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### With Auth0
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { useAuth0 } from '@auth0/auth0-react';
|
|
81
|
+
import { createClient } from '@football-bingo/client';
|
|
82
|
+
|
|
83
|
+
function useFootballBingoClient() {
|
|
84
|
+
const { getAccessTokenSilently } = useAuth0();
|
|
85
|
+
|
|
86
|
+
return createClient({
|
|
87
|
+
BASE: process.env.REACT_APP_API_URL!,
|
|
88
|
+
TOKEN: () => getAccessTokenSilently(),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## API Services
|
|
94
|
+
|
|
95
|
+
The client provides access to **40 service modules** covering all API endpoints:
|
|
96
|
+
|
|
97
|
+
### Core Services
|
|
98
|
+
|
|
99
|
+
- **users** - User management and profiles
|
|
100
|
+
- **predictor** - Match predictions and stats
|
|
101
|
+
- **contentFixtures** - Football match fixtures
|
|
102
|
+
- **bingo** - Bingo game management
|
|
103
|
+
- **wallet** - User wallet and transactions
|
|
104
|
+
- **store** - In-app purchases and inventory
|
|
105
|
+
- **leaderboards** - Global and category leaderboards
|
|
106
|
+
|
|
107
|
+
### Content Services
|
|
108
|
+
|
|
109
|
+
- **contentCountries** - Countries data
|
|
110
|
+
- **contentLeagues** - League information
|
|
111
|
+
- **contentTeams** - Team data and stats
|
|
112
|
+
- **contentPlayers** - Player profiles and statistics
|
|
113
|
+
- **contentNews** - Football news articles
|
|
114
|
+
- **contentOdds** - Betting odds and markets
|
|
115
|
+
- **contentStandings** - League standings
|
|
116
|
+
- **contentStatistics** - Match and player stats
|
|
117
|
+
- **contentTransfers** - Transfer news and history
|
|
118
|
+
- **contentTrophies** - Trophy and honors data
|
|
119
|
+
|
|
120
|
+
### Community Services
|
|
121
|
+
|
|
122
|
+
- **communityLineups** - Share and browse lineups
|
|
123
|
+
- **communityTacticsBoards** - Tactical analysis boards
|
|
124
|
+
- **communityTransferPlans** - Transfer planning tool
|
|
125
|
+
- **communitySharedGames** - Share bingo games
|
|
126
|
+
- **communityChallenges** - Community challenges
|
|
127
|
+
- **communityGameChat** - In-game chat
|
|
128
|
+
|
|
129
|
+
### Game Services
|
|
130
|
+
|
|
131
|
+
- **bingo** - Bingo game creation and management
|
|
132
|
+
- **bingoGames** - Active games and sessions
|
|
133
|
+
- **bingoBoards** - Player boards and tiles
|
|
134
|
+
- **bingoParticipations** - Game participation
|
|
135
|
+
- **eventPools** - Event pool management
|
|
136
|
+
- **sponsors** - Sponsor management
|
|
137
|
+
|
|
138
|
+
### Progression Services
|
|
139
|
+
|
|
140
|
+
- **achievements** - Achievement system
|
|
141
|
+
- **challenges** - Daily and weekly challenges
|
|
142
|
+
- **progression** - User progression and XP
|
|
143
|
+
- **activities** - User activity tracking
|
|
144
|
+
|
|
145
|
+
### AI & Support Services
|
|
146
|
+
|
|
147
|
+
- **aiChat** - AI pundit conversations
|
|
148
|
+
- **notifications** - Push notifications
|
|
149
|
+
- **admin** - Admin operations (requires admin role)
|
|
150
|
+
|
|
151
|
+
## Usage Examples
|
|
152
|
+
|
|
153
|
+
### Get Current User
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const user = await client.users.getUsersMe();
|
|
157
|
+
console.log(`Welcome ${user.username}!`);
|
|
158
|
+
console.log(`Level: ${user.level}, Coins: ${user.coins}`);
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Create a Prediction
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
const prediction = await client.predictor.postPredictions({
|
|
165
|
+
requestBody: {
|
|
166
|
+
fixtureId: 'fixture-123',
|
|
167
|
+
homeScore: 2,
|
|
168
|
+
awayScore: 1,
|
|
169
|
+
result: 'home',
|
|
170
|
+
confidence: 4,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
console.log('Prediction created:', prediction.id);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Get Live Fixtures
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
const liveFixtures = await client.contentFixtures.getContentFixtures({
|
|
180
|
+
status: 'live',
|
|
181
|
+
limit: 10,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
liveFixtures.data.forEach(fixture => {
|
|
185
|
+
console.log(`${fixture.homeTeam.name} vs ${fixture.awayTeam.name}`);
|
|
186
|
+
console.log(`Score: ${fixture.goals.home}-${fixture.goals.away}`);
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Join a Bingo Game
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
const game = await client.bingo.postBingoGames({
|
|
194
|
+
requestBody: {
|
|
195
|
+
fixtureId: 'fixture-123',
|
|
196
|
+
isPublic: true,
|
|
197
|
+
entryFee: 100,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
console.log(`Game created! Session code: ${game.sessionCode}`);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Get Leaderboard
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const leaderboard = await client.leaderboards.getLeaderboards({
|
|
208
|
+
category: 'predictions',
|
|
209
|
+
period: 'week',
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
leaderboard.entries.forEach((entry, index) => {
|
|
213
|
+
console.log(`${index + 1}. ${entry.username} - ${entry.score} points`);
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Purchase Store Item
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
const purchase = await client.monetization.postStoreItemsItemIdPurchaseWithCoins({
|
|
221
|
+
itemId: 'item-uuid',
|
|
222
|
+
requestBody: { quantity: 1 },
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
console.log('Purchase successful!');
|
|
226
|
+
console.log('New balance:', purchase.newBalance.coins);
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Get Wallet Balance
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
const balance = await client.wallet.getWallet();
|
|
233
|
+
console.log(`Coins: ${balance.coins}`);
|
|
234
|
+
console.log(`XP: ${balance.xp}`);
|
|
235
|
+
console.log(`Level: ${balance.level}`);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Error Handling
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { ApiError } from '@football-bingo/client';
|
|
242
|
+
|
|
243
|
+
try {
|
|
244
|
+
await client.predictor.postPredictions({
|
|
245
|
+
requestBody: predictionData,
|
|
246
|
+
});
|
|
247
|
+
} catch (error) {
|
|
248
|
+
if (error instanceof ApiError) {
|
|
249
|
+
console.error('API Error:', error.status, error.body);
|
|
250
|
+
|
|
251
|
+
// Handle specific error codes
|
|
252
|
+
if (error.status === 400) {
|
|
253
|
+
console.error('Validation error:', error.body.error.message);
|
|
254
|
+
} else if (error.status === 401) {
|
|
255
|
+
// Redirect to login
|
|
256
|
+
window.location.href = '/login';
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
console.error('Unknown error:', error);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## React Integration
|
|
265
|
+
|
|
266
|
+
### Custom Hook
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
import { useMemo } from 'react';
|
|
270
|
+
import { useAuth } from '@clerk/clerk-react';
|
|
271
|
+
import { createClient } from '@football-bingo/client';
|
|
272
|
+
|
|
273
|
+
export function useFootballBingoClient() {
|
|
274
|
+
const { getToken } = useAuth();
|
|
275
|
+
|
|
276
|
+
return useMemo(
|
|
277
|
+
() =>
|
|
278
|
+
createClient({
|
|
279
|
+
BASE: process.env.REACT_APP_API_URL!,
|
|
280
|
+
TOKEN: () => getToken(),
|
|
281
|
+
}),
|
|
282
|
+
[getToken]
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### With React Query
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { useQuery } from '@tanstack/react-query';
|
|
291
|
+
import { useFootballBingoClient } from './useFootballBingoClient';
|
|
292
|
+
|
|
293
|
+
function useUser() {
|
|
294
|
+
const client = useFootballBingoClient();
|
|
295
|
+
|
|
296
|
+
return useQuery({
|
|
297
|
+
queryKey: ['user'],
|
|
298
|
+
queryFn: () => client.users.getUsersMe(),
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function useLiveFixtures() {
|
|
303
|
+
const client = useFootballBingoClient();
|
|
304
|
+
|
|
305
|
+
return useQuery({
|
|
306
|
+
queryKey: ['fixtures', 'live'],
|
|
307
|
+
queryFn: () => client.contentFixtures.getContentFixtures({ status: 'live' }),
|
|
308
|
+
refetchInterval: 30000, // Refetch every 30s
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Component Example
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
function PredictionsPage() {
|
|
317
|
+
const client = useFootballBingoClient();
|
|
318
|
+
const [predictions, setPredictions] = useState([]);
|
|
319
|
+
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
async function loadPredictions() {
|
|
322
|
+
const result = await client.predictor.getPredictions();
|
|
323
|
+
setPredictions(result.data);
|
|
324
|
+
}
|
|
325
|
+
loadPredictions();
|
|
326
|
+
}, [client]);
|
|
327
|
+
|
|
328
|
+
return (
|
|
329
|
+
<div>
|
|
330
|
+
{predictions.map(prediction => (
|
|
331
|
+
<PredictionCard key={prediction.id} prediction={prediction} />
|
|
332
|
+
))}
|
|
333
|
+
</div>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Advanced Usage
|
|
339
|
+
|
|
340
|
+
### Custom Request Configuration
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
// Set global headers
|
|
344
|
+
client.request.config.HEADERS = {
|
|
345
|
+
'X-Custom-Header': 'value',
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Update base URL at runtime
|
|
349
|
+
client.request.config.BASE = 'https://api-staging.footballbingo.com';
|
|
350
|
+
|
|
351
|
+
// Update auth token
|
|
352
|
+
client.request.config.TOKEN = async () => newGetTokenFunction();
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Canceling Requests
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
import { CancelablePromise } from '@football-bingo/client';
|
|
359
|
+
|
|
360
|
+
const request: CancelablePromise<any> = client.contentFixtures.getContentFixtures();
|
|
361
|
+
|
|
362
|
+
// Cancel the request
|
|
363
|
+
request.cancel();
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## TypeScript Support
|
|
367
|
+
|
|
368
|
+
All types are automatically inferred:
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
import type {
|
|
372
|
+
UserProfileDTO,
|
|
373
|
+
PredictionDTO,
|
|
374
|
+
FixtureDTO
|
|
375
|
+
} from '@football-bingo/client';
|
|
376
|
+
|
|
377
|
+
const user: UserProfileDTO = await client.users.getUsersMe();
|
|
378
|
+
const predictions: PredictionDTO[] = (await client.predictor.getPredictions()).data;
|
|
379
|
+
const fixture: FixtureDetailDTO = await client.contentFixtures.getContentFixturesId({ id: 123 });
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Regenerating the Client
|
|
383
|
+
|
|
384
|
+
If the API changes, regenerate the client:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
cd sdk
|
|
388
|
+
npm run generate
|
|
389
|
+
npm run build
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
This will:
|
|
393
|
+
|
|
394
|
+
1. Export the latest OpenAPI spec from the backend
|
|
395
|
+
2. Generate fresh TypeScript client code
|
|
396
|
+
3. Compile to JavaScript
|
|
397
|
+
|
|
398
|
+
## Best Practices
|
|
399
|
+
|
|
400
|
+
1. **Create client instance once** - Initialize at app root
|
|
401
|
+
2. **Use React Query** - Combine with React Query for caching and state management
|
|
402
|
+
3. **Handle errors globally** - Set up global error handling
|
|
403
|
+
4. **Type everything** - Leverage TypeScript for compile-time safety
|
|
404
|
+
5. **Keep token fresh** - Ensure `TOKEN` function returns valid tokens
|
|
405
|
+
|
|
406
|
+
## API Documentation
|
|
407
|
+
|
|
408
|
+
Full API documentation is available at:
|
|
409
|
+
|
|
410
|
+
- **Development**: <http://localhost:3004/docs>
|
|
411
|
+
- **Production**: <https://api.footballbingo.com/docs>
|
|
412
|
+
|
|
413
|
+
## Support
|
|
414
|
+
|
|
415
|
+
- **Issues**: [GitHub Issues](https://github.com/football-bingo/api/issues)
|
|
416
|
+
- **Docs**: [API Documentation](https://docs.footballbingo.com)
|
|
417
|
+
|
|
418
|
+
## License
|
|
419
|
+
|
|
420
|
+
ISC
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
2
|
+
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
3
|
+
import { AchievementsService } from './services/AchievementsService';
|
|
4
|
+
import { AchievementsDeprecatedService } from './services/AchievementsDeprecatedService';
|
|
5
|
+
import { ActivitiesService } from './services/ActivitiesService';
|
|
6
|
+
import { AdminService } from './services/AdminService';
|
|
7
|
+
import { AdminPurchasesService } from './services/AdminPurchasesService';
|
|
8
|
+
import { AdminUsersService } from './services/AdminUsersService';
|
|
9
|
+
import { AiChatService } from './services/AiChatService';
|
|
10
|
+
import { ChallengesService } from './services/ChallengesService';
|
|
11
|
+
import { CommunityChallengesService } from './services/CommunityChallengesService';
|
|
12
|
+
import { CommunityGameChatService } from './services/CommunityGameChatService';
|
|
13
|
+
import { CommunityLineupsService } from './services/CommunityLineupsService';
|
|
14
|
+
import { CommunitySharedGamesService } from './services/CommunitySharedGamesService';
|
|
15
|
+
import { CommunityTacticsBoardsService } from './services/CommunityTacticsBoardsService';
|
|
16
|
+
import { CommunityTransferPlansService } from './services/CommunityTransferPlansService';
|
|
17
|
+
import { ContentCountriesService } from './services/ContentCountriesService';
|
|
18
|
+
import { ContentFixturesService } from './services/ContentFixturesService';
|
|
19
|
+
import { ContentLeaguesService } from './services/ContentLeaguesService';
|
|
20
|
+
import { ContentNewsService } from './services/ContentNewsService';
|
|
21
|
+
import { ContentOddsService } from './services/ContentOddsService';
|
|
22
|
+
import { ContentPlayersService } from './services/ContentPlayersService';
|
|
23
|
+
import { ContentStandingsService } from './services/ContentStandingsService';
|
|
24
|
+
import { ContentStatisticsService } from './services/ContentStatisticsService';
|
|
25
|
+
import { ContentTeamsService } from './services/ContentTeamsService';
|
|
26
|
+
import { ContentTransfersService } from './services/ContentTransfersService';
|
|
27
|
+
import { ContentTrophiesService } from './services/ContentTrophiesService';
|
|
28
|
+
import { DailyChallengeCompletionsDeprecatedService } from './services/DailyChallengeCompletionsDeprecatedService';
|
|
29
|
+
import { DailyChallengesDeprecatedService } from './services/DailyChallengesDeprecatedService';
|
|
30
|
+
import { DailyLoginService } from './services/DailyLoginService';
|
|
31
|
+
import { DailyStreaksDeprecatedService } from './services/DailyStreaksDeprecatedService';
|
|
32
|
+
import { EventPoolsService } from './services/EventPoolsService';
|
|
33
|
+
import { LeaderboardService } from './services/LeaderboardService';
|
|
34
|
+
import { NotificationsService } from './services/NotificationsService';
|
|
35
|
+
import { PredictionsService } from './services/PredictionsService';
|
|
36
|
+
import { ProgressionService } from './services/ProgressionService';
|
|
37
|
+
import { SponsorsService } from './services/SponsorsService';
|
|
38
|
+
import { StoreService } from './services/StoreService';
|
|
39
|
+
import { UserAchievementsDeprecatedService } from './services/UserAchievementsDeprecatedService';
|
|
40
|
+
import { UserActivitiesService } from './services/UserActivitiesService';
|
|
41
|
+
import { UsersService } from './services/UsersService';
|
|
42
|
+
import { WalletService } from './services/WalletService';
|
|
43
|
+
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
44
|
+
export declare class FootballBingoClient {
|
|
45
|
+
readonly achievements: AchievementsService;
|
|
46
|
+
readonly achievementsDeprecated: AchievementsDeprecatedService;
|
|
47
|
+
readonly activities: ActivitiesService;
|
|
48
|
+
readonly admin: AdminService;
|
|
49
|
+
readonly adminPurchases: AdminPurchasesService;
|
|
50
|
+
readonly adminUsers: AdminUsersService;
|
|
51
|
+
readonly aiChat: AiChatService;
|
|
52
|
+
readonly challenges: ChallengesService;
|
|
53
|
+
readonly communityChallenges: CommunityChallengesService;
|
|
54
|
+
readonly communityGameChat: CommunityGameChatService;
|
|
55
|
+
readonly communityLineups: CommunityLineupsService;
|
|
56
|
+
readonly communitySharedGames: CommunitySharedGamesService;
|
|
57
|
+
readonly communityTacticsBoards: CommunityTacticsBoardsService;
|
|
58
|
+
readonly communityTransferPlans: CommunityTransferPlansService;
|
|
59
|
+
readonly contentCountries: ContentCountriesService;
|
|
60
|
+
readonly contentFixtures: ContentFixturesService;
|
|
61
|
+
readonly contentLeagues: ContentLeaguesService;
|
|
62
|
+
readonly contentNews: ContentNewsService;
|
|
63
|
+
readonly contentOdds: ContentOddsService;
|
|
64
|
+
readonly contentPlayers: ContentPlayersService;
|
|
65
|
+
readonly contentStandings: ContentStandingsService;
|
|
66
|
+
readonly contentStatistics: ContentStatisticsService;
|
|
67
|
+
readonly contentTeams: ContentTeamsService;
|
|
68
|
+
readonly contentTransfers: ContentTransfersService;
|
|
69
|
+
readonly contentTrophies: ContentTrophiesService;
|
|
70
|
+
readonly dailyChallengeCompletionsDeprecated: DailyChallengeCompletionsDeprecatedService;
|
|
71
|
+
readonly dailyChallengesDeprecated: DailyChallengesDeprecatedService;
|
|
72
|
+
readonly dailyLogin: DailyLoginService;
|
|
73
|
+
readonly dailyStreaksDeprecated: DailyStreaksDeprecatedService;
|
|
74
|
+
readonly eventPools: EventPoolsService;
|
|
75
|
+
readonly leaderboard: LeaderboardService;
|
|
76
|
+
readonly notifications: NotificationsService;
|
|
77
|
+
readonly predictions: PredictionsService;
|
|
78
|
+
readonly progression: ProgressionService;
|
|
79
|
+
readonly sponsors: SponsorsService;
|
|
80
|
+
readonly store: StoreService;
|
|
81
|
+
readonly userAchievementsDeprecated: UserAchievementsDeprecatedService;
|
|
82
|
+
readonly userActivities: UserActivitiesService;
|
|
83
|
+
readonly users: UsersService;
|
|
84
|
+
readonly wallet: WalletService;
|
|
85
|
+
readonly request: BaseHttpRequest;
|
|
86
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FootballBingoClient = void 0;
|
|
4
|
+
const FetchHttpRequest_1 = require("./core/FetchHttpRequest");
|
|
5
|
+
const AchievementsService_1 = require("./services/AchievementsService");
|
|
6
|
+
const AchievementsDeprecatedService_1 = require("./services/AchievementsDeprecatedService");
|
|
7
|
+
const ActivitiesService_1 = require("./services/ActivitiesService");
|
|
8
|
+
const AdminService_1 = require("./services/AdminService");
|
|
9
|
+
const AdminPurchasesService_1 = require("./services/AdminPurchasesService");
|
|
10
|
+
const AdminUsersService_1 = require("./services/AdminUsersService");
|
|
11
|
+
const AiChatService_1 = require("./services/AiChatService");
|
|
12
|
+
const ChallengesService_1 = require("./services/ChallengesService");
|
|
13
|
+
const CommunityChallengesService_1 = require("./services/CommunityChallengesService");
|
|
14
|
+
const CommunityGameChatService_1 = require("./services/CommunityGameChatService");
|
|
15
|
+
const CommunityLineupsService_1 = require("./services/CommunityLineupsService");
|
|
16
|
+
const CommunitySharedGamesService_1 = require("./services/CommunitySharedGamesService");
|
|
17
|
+
const CommunityTacticsBoardsService_1 = require("./services/CommunityTacticsBoardsService");
|
|
18
|
+
const CommunityTransferPlansService_1 = require("./services/CommunityTransferPlansService");
|
|
19
|
+
const ContentCountriesService_1 = require("./services/ContentCountriesService");
|
|
20
|
+
const ContentFixturesService_1 = require("./services/ContentFixturesService");
|
|
21
|
+
const ContentLeaguesService_1 = require("./services/ContentLeaguesService");
|
|
22
|
+
const ContentNewsService_1 = require("./services/ContentNewsService");
|
|
23
|
+
const ContentOddsService_1 = require("./services/ContentOddsService");
|
|
24
|
+
const ContentPlayersService_1 = require("./services/ContentPlayersService");
|
|
25
|
+
const ContentStandingsService_1 = require("./services/ContentStandingsService");
|
|
26
|
+
const ContentStatisticsService_1 = require("./services/ContentStatisticsService");
|
|
27
|
+
const ContentTeamsService_1 = require("./services/ContentTeamsService");
|
|
28
|
+
const ContentTransfersService_1 = require("./services/ContentTransfersService");
|
|
29
|
+
const ContentTrophiesService_1 = require("./services/ContentTrophiesService");
|
|
30
|
+
const DailyChallengeCompletionsDeprecatedService_1 = require("./services/DailyChallengeCompletionsDeprecatedService");
|
|
31
|
+
const DailyChallengesDeprecatedService_1 = require("./services/DailyChallengesDeprecatedService");
|
|
32
|
+
const DailyLoginService_1 = require("./services/DailyLoginService");
|
|
33
|
+
const DailyStreaksDeprecatedService_1 = require("./services/DailyStreaksDeprecatedService");
|
|
34
|
+
const EventPoolsService_1 = require("./services/EventPoolsService");
|
|
35
|
+
const LeaderboardService_1 = require("./services/LeaderboardService");
|
|
36
|
+
const NotificationsService_1 = require("./services/NotificationsService");
|
|
37
|
+
const PredictionsService_1 = require("./services/PredictionsService");
|
|
38
|
+
const ProgressionService_1 = require("./services/ProgressionService");
|
|
39
|
+
const SponsorsService_1 = require("./services/SponsorsService");
|
|
40
|
+
const StoreService_1 = require("./services/StoreService");
|
|
41
|
+
const UserAchievementsDeprecatedService_1 = require("./services/UserAchievementsDeprecatedService");
|
|
42
|
+
const UserActivitiesService_1 = require("./services/UserActivitiesService");
|
|
43
|
+
const UsersService_1 = require("./services/UsersService");
|
|
44
|
+
const WalletService_1 = require("./services/WalletService");
|
|
45
|
+
class FootballBingoClient {
|
|
46
|
+
constructor(config, HttpRequest = FetchHttpRequest_1.FetchHttpRequest) {
|
|
47
|
+
this.request = new HttpRequest({
|
|
48
|
+
BASE: config?.BASE ?? 'http://localhost:3004',
|
|
49
|
+
VERSION: config?.VERSION ?? '1.0.0',
|
|
50
|
+
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
51
|
+
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
52
|
+
TOKEN: config?.TOKEN,
|
|
53
|
+
USERNAME: config?.USERNAME,
|
|
54
|
+
PASSWORD: config?.PASSWORD,
|
|
55
|
+
HEADERS: config?.HEADERS,
|
|
56
|
+
ENCODE_PATH: config?.ENCODE_PATH,
|
|
57
|
+
});
|
|
58
|
+
this.achievements = new AchievementsService_1.AchievementsService(this.request);
|
|
59
|
+
this.achievementsDeprecated = new AchievementsDeprecatedService_1.AchievementsDeprecatedService(this.request);
|
|
60
|
+
this.activities = new ActivitiesService_1.ActivitiesService(this.request);
|
|
61
|
+
this.admin = new AdminService_1.AdminService(this.request);
|
|
62
|
+
this.adminPurchases = new AdminPurchasesService_1.AdminPurchasesService(this.request);
|
|
63
|
+
this.adminUsers = new AdminUsersService_1.AdminUsersService(this.request);
|
|
64
|
+
this.aiChat = new AiChatService_1.AiChatService(this.request);
|
|
65
|
+
this.challenges = new ChallengesService_1.ChallengesService(this.request);
|
|
66
|
+
this.communityChallenges = new CommunityChallengesService_1.CommunityChallengesService(this.request);
|
|
67
|
+
this.communityGameChat = new CommunityGameChatService_1.CommunityGameChatService(this.request);
|
|
68
|
+
this.communityLineups = new CommunityLineupsService_1.CommunityLineupsService(this.request);
|
|
69
|
+
this.communitySharedGames = new CommunitySharedGamesService_1.CommunitySharedGamesService(this.request);
|
|
70
|
+
this.communityTacticsBoards = new CommunityTacticsBoardsService_1.CommunityTacticsBoardsService(this.request);
|
|
71
|
+
this.communityTransferPlans = new CommunityTransferPlansService_1.CommunityTransferPlansService(this.request);
|
|
72
|
+
this.contentCountries = new ContentCountriesService_1.ContentCountriesService(this.request);
|
|
73
|
+
this.contentFixtures = new ContentFixturesService_1.ContentFixturesService(this.request);
|
|
74
|
+
this.contentLeagues = new ContentLeaguesService_1.ContentLeaguesService(this.request);
|
|
75
|
+
this.contentNews = new ContentNewsService_1.ContentNewsService(this.request);
|
|
76
|
+
this.contentOdds = new ContentOddsService_1.ContentOddsService(this.request);
|
|
77
|
+
this.contentPlayers = new ContentPlayersService_1.ContentPlayersService(this.request);
|
|
78
|
+
this.contentStandings = new ContentStandingsService_1.ContentStandingsService(this.request);
|
|
79
|
+
this.contentStatistics = new ContentStatisticsService_1.ContentStatisticsService(this.request);
|
|
80
|
+
this.contentTeams = new ContentTeamsService_1.ContentTeamsService(this.request);
|
|
81
|
+
this.contentTransfers = new ContentTransfersService_1.ContentTransfersService(this.request);
|
|
82
|
+
this.contentTrophies = new ContentTrophiesService_1.ContentTrophiesService(this.request);
|
|
83
|
+
this.dailyChallengeCompletionsDeprecated = new DailyChallengeCompletionsDeprecatedService_1.DailyChallengeCompletionsDeprecatedService(this.request);
|
|
84
|
+
this.dailyChallengesDeprecated = new DailyChallengesDeprecatedService_1.DailyChallengesDeprecatedService(this.request);
|
|
85
|
+
this.dailyLogin = new DailyLoginService_1.DailyLoginService(this.request);
|
|
86
|
+
this.dailyStreaksDeprecated = new DailyStreaksDeprecatedService_1.DailyStreaksDeprecatedService(this.request);
|
|
87
|
+
this.eventPools = new EventPoolsService_1.EventPoolsService(this.request);
|
|
88
|
+
this.leaderboard = new LeaderboardService_1.LeaderboardService(this.request);
|
|
89
|
+
this.notifications = new NotificationsService_1.NotificationsService(this.request);
|
|
90
|
+
this.predictions = new PredictionsService_1.PredictionsService(this.request);
|
|
91
|
+
this.progression = new ProgressionService_1.ProgressionService(this.request);
|
|
92
|
+
this.sponsors = new SponsorsService_1.SponsorsService(this.request);
|
|
93
|
+
this.store = new StoreService_1.StoreService(this.request);
|
|
94
|
+
this.userAchievementsDeprecated = new UserAchievementsDeprecatedService_1.UserAchievementsDeprecatedService(this.request);
|
|
95
|
+
this.userActivities = new UserActivitiesService_1.UserActivitiesService(this.request);
|
|
96
|
+
this.users = new UsersService_1.UsersService(this.request);
|
|
97
|
+
this.wallet = new WalletService_1.WalletService(this.request);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.FootballBingoClient = FootballBingoClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly body: any;
|
|
8
|
+
readonly request: ApiRequestOptions;
|
|
9
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor(request, response, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ApiError';
|
|
8
|
+
this.url = response.url;
|
|
9
|
+
this.status = response.status;
|
|
10
|
+
this.statusText = response.statusText;
|
|
11
|
+
this.body = response.body;
|
|
12
|
+
this.request = request;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiRequestOptions = {
|
|
2
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly path?: Record<string, any>;
|
|
5
|
+
readonly cookies?: Record<string, any>;
|
|
6
|
+
readonly headers?: Record<string, any>;
|
|
7
|
+
readonly query?: Record<string, any>;
|
|
8
|
+
readonly formData?: Record<string, any>;
|
|
9
|
+
readonly body?: any;
|
|
10
|
+
readonly mediaType?: string;
|
|
11
|
+
readonly responseHeader?: string;
|
|
12
|
+
readonly errors?: Record<number, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { CancelablePromise } from './CancelablePromise';
|
|
3
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
4
|
+
export declare abstract class BaseHttpRequest {
|
|
5
|
+
readonly config: OpenAPIConfig;
|
|
6
|
+
constructor(config: OpenAPIConfig);
|
|
7
|
+
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
8
|
+
}
|