@puntjes/sdk 0.0.0-stage → 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.
Files changed (63) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +152 -2
  3. package/dist/auth/token-source.d.ts +20 -0
  4. package/dist/auth/token-source.js +105 -0
  5. package/dist/auth/token-store.d.ts +21 -0
  6. package/dist/auth/token-store.js +13 -0
  7. package/dist/create-puntjes.d.ts +25 -0
  8. package/dist/create-puntjes.js +48 -0
  9. package/dist/errors.d.ts +55 -0
  10. package/dist/errors.js +60 -0
  11. package/dist/generated/client/client.gen.d.ts +2 -0
  12. package/dist/generated/client/client.gen.js +216 -0
  13. package/dist/generated/client/index.d.ts +10 -0
  14. package/dist/generated/client/index.js +6 -0
  15. package/dist/generated/client/types.gen.d.ts +120 -0
  16. package/dist/generated/client/types.gen.js +2 -0
  17. package/dist/generated/client/utils.gen.d.ts +37 -0
  18. package/dist/generated/client/utils.gen.js +228 -0
  19. package/dist/generated/client.gen.d.ts +12 -0
  20. package/dist/generated/client.gen.js +3 -0
  21. package/dist/generated/core/auth.gen.d.ts +25 -0
  22. package/dist/generated/core/auth.gen.js +14 -0
  23. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  24. package/dist/generated/core/bodySerializer.gen.js +57 -0
  25. package/dist/generated/core/params.gen.d.ts +43 -0
  26. package/dist/generated/core/params.gen.js +109 -0
  27. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  28. package/dist/generated/core/pathSerializer.gen.js +106 -0
  29. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  30. package/dist/generated/core/queryKeySerializer.gen.js +92 -0
  31. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  32. package/dist/generated/core/serverSentEvents.gen.js +132 -0
  33. package/dist/generated/core/types.gen.d.ts +83 -0
  34. package/dist/generated/core/types.gen.js +2 -0
  35. package/dist/generated/core/utils.gen.d.ts +19 -0
  36. package/dist/generated/core/utils.gen.js +87 -0
  37. package/dist/generated/error-codes.gen.d.ts +56 -0
  38. package/dist/generated/error-codes.gen.js +110 -0
  39. package/dist/generated/index.d.ts +2 -0
  40. package/dist/generated/index.js +2 -0
  41. package/dist/generated/sdk.gen.d.ts +69 -0
  42. package/dist/generated/sdk.gen.js +323 -0
  43. package/dist/generated/types.gen.d.ts +2794 -0
  44. package/dist/generated/types.gen.js +2 -0
  45. package/dist/http/auth-fetch.d.ts +8 -0
  46. package/dist/http/auth-fetch.js +24 -0
  47. package/dist/http/error-body.d.ts +18 -0
  48. package/dist/http/error-body.js +75 -0
  49. package/dist/http/error-fetch.d.ts +3 -0
  50. package/dist/http/error-fetch.js +22 -0
  51. package/dist/http/fetch.d.ts +9 -0
  52. package/dist/http/fetch.js +4 -0
  53. package/dist/http/retry-fetch.d.ts +16 -0
  54. package/dist/http/retry-fetch.js +93 -0
  55. package/dist/idempotency-key.d.ts +2 -0
  56. package/dist/idempotency-key.js +4 -0
  57. package/dist/index.d.ts +9 -0
  58. package/dist/index.js +8 -0
  59. package/dist/paginate.d.ts +10 -0
  60. package/dist/paginate.js +16 -0
  61. package/dist/wallet-pass.d.ts +5 -0
  62. package/dist/wallet-pass.js +12 -0
  63. package/package.json +45 -4
@@ -0,0 +1,323 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { client } from './client.gen.js';
3
+ class HeyApiClient {
4
+ client;
5
+ constructor(args) {
6
+ this.client = args?.client ?? client;
7
+ }
8
+ }
9
+ class HeyApiRegistry {
10
+ defaultKey = 'default';
11
+ instances = new Map();
12
+ get(key) {
13
+ const instance = this.instances.get(key ?? this.defaultKey);
14
+ if (!instance) {
15
+ throw new Error(`No SDK client found. Create one with "new PuntjesApi()" to fix this error.`);
16
+ }
17
+ return instance;
18
+ }
19
+ set(value, key) {
20
+ this.instances.set(key ?? this.defaultKey, value);
21
+ }
22
+ }
23
+ export class PuntjesApi extends HeyApiClient {
24
+ static __registry = new HeyApiRegistry();
25
+ constructor(args) {
26
+ super(args);
27
+ PuntjesApi.__registry.set(this, args?.key);
28
+ }
29
+ lookupCustomer(options) {
30
+ return (options?.client ?? this.client).get({
31
+ security: [{ scheme: 'bearer', type: 'http' }],
32
+ url: '/customers/lookup',
33
+ ...options
34
+ });
35
+ }
36
+ registerCustomer(options) {
37
+ return (options.client ?? this.client).post({
38
+ security: [{ scheme: 'bearer', type: 'http' }],
39
+ url: '/customers',
40
+ ...options,
41
+ headers: {
42
+ 'Content-Type': 'application/json',
43
+ ...options.headers
44
+ }
45
+ });
46
+ }
47
+ updateCustomerByExternalId(options) {
48
+ return (options.client ?? this.client).patch({
49
+ security: [{ scheme: 'bearer', type: 'http' }],
50
+ url: '/customers/by-external-id/{externalId}',
51
+ ...options,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ ...options.headers
55
+ }
56
+ });
57
+ }
58
+ replaceCustomerByExternalId(options) {
59
+ return (options.client ?? this.client).put({
60
+ security: [{ scheme: 'bearer', type: 'http' }],
61
+ url: '/customers/by-external-id/{externalId}',
62
+ ...options,
63
+ headers: {
64
+ 'Content-Type': 'application/json',
65
+ ...options.headers
66
+ }
67
+ });
68
+ }
69
+ linkCustomerExternalId(options) {
70
+ return (options.client ?? this.client).post({
71
+ security: [{ scheme: 'bearer', type: 'http' }],
72
+ url: '/customers/link-external-id',
73
+ ...options,
74
+ headers: {
75
+ 'Content-Type': 'application/json',
76
+ ...options.headers
77
+ }
78
+ });
79
+ }
80
+ sendLoyaltyCardByExternalId(options) {
81
+ return (options.client ?? this.client).post({
82
+ security: [{ scheme: 'bearer', type: 'http' }],
83
+ url: '/customers/by-external-id/{externalId}/send-card',
84
+ ...options,
85
+ headers: {
86
+ 'Content-Type': 'application/json',
87
+ ...options.headers
88
+ }
89
+ });
90
+ }
91
+ sendLoyaltyCard(options) {
92
+ return (options.client ?? this.client).post({
93
+ security: [{ scheme: 'bearer', type: 'http' }],
94
+ url: '/customers/{customer}/send-card',
95
+ ...options,
96
+ headers: {
97
+ 'Content-Type': 'application/json',
98
+ ...options.headers
99
+ }
100
+ });
101
+ }
102
+ showCustomer(options) {
103
+ return (options.client ?? this.client).get({
104
+ security: [{ scheme: 'bearer', type: 'http' }],
105
+ url: '/customers/{customer}',
106
+ ...options
107
+ });
108
+ }
109
+ submitTransaction(options) {
110
+ return (options.client ?? this.client).post({
111
+ security: [{ scheme: 'bearer', type: 'http' }],
112
+ url: '/transactions',
113
+ ...options,
114
+ headers: {
115
+ 'Content-Type': 'application/json',
116
+ ...options.headers
117
+ }
118
+ });
119
+ }
120
+ listCustomerTransactions(options) {
121
+ return (options.client ?? this.client).get({
122
+ security: [{ scheme: 'bearer', type: 'http' }],
123
+ url: '/customers/{customer}/transactions',
124
+ ...options
125
+ });
126
+ }
127
+ showWallet(options) {
128
+ return (options.client ?? this.client).get({
129
+ security: [{ scheme: 'bearer', type: 'http' }],
130
+ url: '/customers/{customer}/wallet',
131
+ ...options
132
+ });
133
+ }
134
+ listLedgerEntries(options) {
135
+ return (options.client ?? this.client).get({
136
+ security: [{ scheme: 'bearer', type: 'http' }],
137
+ url: '/customers/{customer}/ledger',
138
+ ...options
139
+ });
140
+ }
141
+ downloadWalletPass(options) {
142
+ return (options.client ?? this.client).get({
143
+ security: [{ scheme: 'bearer', type: 'http' }],
144
+ url: '/customers/{customer}/wallet-pass',
145
+ ...options
146
+ });
147
+ }
148
+ adjustWallet(options) {
149
+ return (options.client ?? this.client).post({
150
+ security: [{ scheme: 'bearer', type: 'http' }],
151
+ url: '/customers/{customer}/wallet/adjust',
152
+ ...options,
153
+ headers: {
154
+ 'Content-Type': 'application/json',
155
+ ...options.headers
156
+ }
157
+ });
158
+ }
159
+ listRewards(options) {
160
+ return (options?.client ?? this.client).get({
161
+ security: [{ scheme: 'bearer', type: 'http' }],
162
+ url: '/rewards',
163
+ ...options
164
+ });
165
+ }
166
+ listCustomerRedemptions(options) {
167
+ return (options.client ?? this.client).get({
168
+ security: [{ scheme: 'bearer', type: 'http' }],
169
+ url: '/customers/{customer}/redemptions',
170
+ ...options
171
+ });
172
+ }
173
+ redeemReward(options) {
174
+ return (options.client ?? this.client).post({
175
+ security: [{ scheme: 'bearer', type: 'http' }],
176
+ url: '/redemptions',
177
+ ...options,
178
+ headers: {
179
+ 'Content-Type': 'application/json',
180
+ ...options.headers
181
+ }
182
+ });
183
+ }
184
+ lookupRedemption(options) {
185
+ return (options.client ?? this.client).get({
186
+ security: [{ scheme: 'bearer', type: 'http' }],
187
+ url: '/redemptions/{code}',
188
+ ...options
189
+ });
190
+ }
191
+ verifyRedemption(options) {
192
+ return (options.client ?? this.client).post({
193
+ security: [{ scheme: 'bearer', type: 'http' }],
194
+ url: '/redemptions/{code}/verify',
195
+ ...options
196
+ });
197
+ }
198
+ listProducts(options) {
199
+ return (options?.client ?? this.client).get({
200
+ security: [{ scheme: 'bearer', type: 'http' }],
201
+ url: '/products',
202
+ ...options
203
+ });
204
+ }
205
+ createProduct(options) {
206
+ return (options.client ?? this.client).post({
207
+ security: [{ scheme: 'bearer', type: 'http' }],
208
+ url: '/products',
209
+ ...options,
210
+ headers: {
211
+ 'Content-Type': 'application/json',
212
+ ...options.headers
213
+ }
214
+ });
215
+ }
216
+ bulkUpsertProducts(options) {
217
+ return (options.client ?? this.client).post({
218
+ security: [{ scheme: 'bearer', type: 'http' }],
219
+ url: '/products/batch',
220
+ ...options,
221
+ headers: {
222
+ 'Content-Type': 'application/json',
223
+ ...options.headers
224
+ }
225
+ });
226
+ }
227
+ createRewardFromProduct(options) {
228
+ return (options.client ?? this.client).post({
229
+ security: [{ scheme: 'bearer', type: 'http' }],
230
+ url: '/products/{externalId}/reward',
231
+ ...options,
232
+ headers: {
233
+ 'Content-Type': 'application/json',
234
+ ...options.headers
235
+ }
236
+ });
237
+ }
238
+ deleteProduct(options) {
239
+ return (options.client ?? this.client).delete({
240
+ security: [{ scheme: 'bearer', type: 'http' }],
241
+ url: '/products/{externalId}',
242
+ ...options
243
+ });
244
+ }
245
+ showProduct(options) {
246
+ return (options.client ?? this.client).get({
247
+ security: [{ scheme: 'bearer', type: 'http' }],
248
+ url: '/products/{externalId}',
249
+ ...options
250
+ });
251
+ }
252
+ updateProduct(options) {
253
+ return (options.client ?? this.client).patch({
254
+ security: [{ scheme: 'bearer', type: 'http' }],
255
+ url: '/products/{externalId}',
256
+ ...options,
257
+ headers: {
258
+ 'Content-Type': 'application/json',
259
+ ...options.headers
260
+ }
261
+ });
262
+ }
263
+ upsertProduct(options) {
264
+ return (options.client ?? this.client).put({
265
+ security: [{ scheme: 'bearer', type: 'http' }],
266
+ url: '/products/{externalId}',
267
+ ...options,
268
+ headers: {
269
+ 'Content-Type': 'application/json',
270
+ ...options.headers
271
+ }
272
+ });
273
+ }
274
+ listCampaigns(options) {
275
+ return (options?.client ?? this.client).get({
276
+ security: [{ scheme: 'bearer', type: 'http' }],
277
+ url: '/campaigns',
278
+ ...options
279
+ });
280
+ }
281
+ listCustomerVouchers(options) {
282
+ return (options.client ?? this.client).get({
283
+ security: [{ scheme: 'bearer', type: 'http' }],
284
+ url: '/customers/{customer}/vouchers',
285
+ ...options
286
+ });
287
+ }
288
+ lookupVoucher(options) {
289
+ return (options.client ?? this.client).get({
290
+ security: [{ scheme: 'bearer', type: 'http' }],
291
+ url: '/vouchers/{code}',
292
+ ...options
293
+ });
294
+ }
295
+ verifyVoucher(options) {
296
+ return (options.client ?? this.client).post({
297
+ security: [{ scheme: 'bearer', type: 'http' }],
298
+ url: '/vouchers/{code}/verify',
299
+ ...options,
300
+ headers: {
301
+ 'Content-Type': 'application/json',
302
+ ...options.headers
303
+ }
304
+ });
305
+ }
306
+ showStatistics(options) {
307
+ return (options?.client ?? this.client).get({
308
+ security: [{ scheme: 'bearer', type: 'http' }],
309
+ url: '/statistics',
310
+ ...options
311
+ });
312
+ }
313
+ showMe(options) {
314
+ return (options?.client ?? this.client).get({
315
+ security: [{ scheme: 'bearer', type: 'http' }],
316
+ url: '/me',
317
+ ...options
318
+ });
319
+ }
320
+ checkHealth(options) {
321
+ return (options?.client ?? this.client).get({ url: '/health', ...options });
322
+ }
323
+ }