@gr4vy/sdk 2.3.27 → 2.3.29

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 (76) hide show
  1. package/README.md +10 -0
  2. package/funcs/giftCardsActivationsCreate.d.ts +18 -0
  3. package/funcs/giftCardsActivationsCreate.d.ts.map +1 -0
  4. package/funcs/giftCardsActivationsCreate.js +129 -0
  5. package/funcs/giftCardsActivationsCreate.js.map +1 -0
  6. package/funcs/giftCardsIssuancesCreate.d.ts +18 -0
  7. package/funcs/giftCardsIssuancesCreate.d.ts.map +1 -0
  8. package/funcs/giftCardsIssuancesCreate.js +129 -0
  9. package/funcs/giftCardsIssuancesCreate.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/models/components/buyer.d.ts +4 -0
  14. package/models/components/buyer.d.ts.map +1 -1
  15. package/models/components/buyer.js +2 -0
  16. package/models/components/buyer.js.map +1 -1
  17. package/models/components/giftcardactivationcreate.d.ts +38 -0
  18. package/models/components/giftcardactivationcreate.d.ts.map +1 -0
  19. package/models/components/giftcardactivationcreate.js +58 -0
  20. package/models/components/giftcardactivationcreate.js.map +1 -0
  21. package/models/components/giftcardissuance.d.ts +51 -0
  22. package/models/components/giftcardissuance.d.ts.map +1 -0
  23. package/models/components/giftcardissuance.js +71 -0
  24. package/models/components/giftcardissuance.js.map +1 -0
  25. package/models/components/giftcardissuancecreate.d.ts +33 -0
  26. package/models/components/giftcardissuancecreate.d.ts.map +1 -0
  27. package/models/components/giftcardissuancecreate.js +57 -0
  28. package/models/components/giftcardissuancecreate.js.map +1 -0
  29. package/models/components/index.d.ts +3 -0
  30. package/models/components/index.d.ts.map +1 -1
  31. package/models/components/index.js +3 -0
  32. package/models/components/index.js.map +1 -1
  33. package/models/components/transactionbuyer.d.ts +4 -0
  34. package/models/components/transactionbuyer.d.ts.map +1 -1
  35. package/models/components/transactionbuyer.js +2 -0
  36. package/models/components/transactionbuyer.js.map +1 -1
  37. package/models/operations/activategiftcard.d.ts +26 -0
  38. package/models/operations/activategiftcard.d.ts.map +1 -0
  39. package/models/operations/activategiftcard.js +58 -0
  40. package/models/operations/activategiftcard.js.map +1 -0
  41. package/models/operations/index.d.ts +2 -0
  42. package/models/operations/index.d.ts.map +1 -1
  43. package/models/operations/index.js +2 -0
  44. package/models/operations/index.js.map +1 -1
  45. package/models/operations/issuegiftcard.d.ts +26 -0
  46. package/models/operations/issuegiftcard.d.ts.map +1 -0
  47. package/models/operations/issuegiftcard.js +58 -0
  48. package/models/operations/issuegiftcard.js.map +1 -0
  49. package/package.json +1 -1
  50. package/sdk/activations.d.ts +12 -0
  51. package/sdk/activations.d.ts.map +1 -0
  52. package/sdk/activations.js +22 -0
  53. package/sdk/activations.js.map +1 -0
  54. package/sdk/giftcards.d.ts +6 -0
  55. package/sdk/giftcards.d.ts.map +1 -1
  56. package/sdk/giftcards.js +8 -0
  57. package/sdk/giftcards.js.map +1 -1
  58. package/sdk/issuances.d.ts +12 -0
  59. package/sdk/issuances.d.ts.map +1 -0
  60. package/sdk/issuances.js +22 -0
  61. package/sdk/issuances.js.map +1 -0
  62. package/src/funcs/giftCardsActivationsCreate.ts +240 -0
  63. package/src/funcs/giftCardsIssuancesCreate.ts +240 -0
  64. package/src/lib/config.ts +3 -3
  65. package/src/models/components/buyer.ts +6 -0
  66. package/src/models/components/giftcardactivationcreate.ts +66 -0
  67. package/src/models/components/giftcardissuance.ts +95 -0
  68. package/src/models/components/giftcardissuancecreate.ts +60 -0
  69. package/src/models/components/index.ts +3 -0
  70. package/src/models/components/transactionbuyer.ts +6 -0
  71. package/src/models/operations/activategiftcard.ts +54 -0
  72. package/src/models/operations/index.ts +2 -0
  73. package/src/models/operations/issuegiftcard.ts +54 -0
  74. package/src/sdk/activations.ts +31 -0
  75. package/src/sdk/giftcards.ts +12 -0
  76. package/src/sdk/issuances.ts +31 -0
@@ -2,10 +2,16 @@ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
2
  import * as components from "../models/components/index.js";
3
3
  import * as operations from "../models/operations/index.js";
4
4
  import { PageIterator } from "../types/operations.js";
5
+ import { Activations } from "./activations.js";
5
6
  import { Balances } from "./balances.js";
7
+ import { Issuances } from "./issuances.js";
6
8
  export declare class GiftCards extends ClientSDK {
7
9
  private _balances?;
8
10
  get balances(): Balances;
11
+ private _activations?;
12
+ get activations(): Activations;
13
+ private _issuances?;
14
+ get issuances(): Issuances;
9
15
  /**
10
16
  * Get gift card
11
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"giftcards.d.ts","sourceRoot":"","sources":["../src/sdk/giftcards.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAwB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,qBAAa,SAAU,SAAQ,SAAS;IACtC,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED;;;;;OAKG;IACG,GAAG,CACP,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;IAS/B;;;;;OAKG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC;IAShB;;;;;OAKG;IACG,MAAM,CACV,cAAc,EAAE,UAAU,CAAC,cAAc,EACzC,iBAAiB,CAAC,EAAE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M,CACV,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC;IAShB;;;;;OAKG;IACG,MAAM,CACV,cAAc,EAAE,UAAU,CAAC,cAAc,EACzC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;IAS/B;;;;;OAKG;IACG,IAAI,CACR,OAAO,CAAC,EAAE,UAAU,CAAC,oBAAoB,GAAG,SAAS,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,YAAY,CAAC,UAAU,CAAC,qBAAqB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CACnE;CAOF"}
package/sdk/giftcards.js CHANGED
@@ -11,11 +11,19 @@ const giftCardsList_js_1 = require("../funcs/giftCardsList.js");
11
11
  const sdks_js_1 = require("../lib/sdks.js");
12
12
  const fp_js_1 = require("../types/fp.js");
13
13
  const operations_js_1 = require("../types/operations.js");
14
+ const activations_js_1 = require("./activations.js");
14
15
  const balances_js_1 = require("./balances.js");
16
+ const issuances_js_1 = require("./issuances.js");
15
17
  class GiftCards extends sdks_js_1.ClientSDK {
16
18
  get balances() {
17
19
  return (this._balances ?? (this._balances = new balances_js_1.Balances(this._options)));
18
20
  }
21
+ get activations() {
22
+ return (this._activations ?? (this._activations = new activations_js_1.Activations(this._options)));
23
+ }
24
+ get issuances() {
25
+ return (this._issuances ?? (this._issuances = new issuances_js_1.Issuances(this._options)));
26
+ }
19
27
  /**
20
28
  * Get gift card
21
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"giftcards.js","sourceRoot":"","sources":["../src/sdk/giftcards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oEAA8D;AAC9D,oEAA8D;AAC9D,8DAAwD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D,OAAwB;QAIxB,OAAO,IAAA,oCAAoB,EAAC,IAAA,gCAAa,EACvC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AA3FD,8BA2FC"}
@@ -0,0 +1,12 @@
1
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
+ import * as components from "../models/components/index.js";
3
+ export declare class Issuances extends ClientSDK {
4
+ /**
5
+ * Issue a gift card
6
+ *
7
+ * @remarks
8
+ * Issue a new virtual gift card through the primary gift card service.
9
+ */
10
+ create(giftCardIssuanceCreate: components.GiftCardIssuanceCreate, idempotencyKey?: string | null | undefined, merchantAccountId?: string | null | undefined, options?: RequestOptions): Promise<components.GiftCardIssuance>;
11
+ }
12
+ //# sourceMappingURL=issuances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuances.d.ts","sourceRoot":"","sources":["../src/sdk/issuances.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,SAAU,SAAQ,SAAS;IACtC;;;;;OAKG;IACG,MAAM,CACV,sBAAsB,EAAE,UAAU,CAAC,sBAAsB,EACzD,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC;CASxC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Issuances = void 0;
7
+ const giftCardsIssuancesCreate_js_1 = require("../funcs/giftCardsIssuancesCreate.js");
8
+ const sdks_js_1 = require("../lib/sdks.js");
9
+ const fp_js_1 = require("../types/fp.js");
10
+ class Issuances extends sdks_js_1.ClientSDK {
11
+ /**
12
+ * Issue a gift card
13
+ *
14
+ * @remarks
15
+ * Issue a new virtual gift card through the primary gift card service.
16
+ */
17
+ async create(giftCardIssuanceCreate, idempotencyKey, merchantAccountId, options) {
18
+ return (0, fp_js_1.unwrapAsync)((0, giftCardsIssuancesCreate_js_1.giftCardsIssuancesCreate)(this, giftCardIssuanceCreate, idempotencyKey, merchantAccountId, options));
19
+ }
20
+ }
21
+ exports.Issuances = Issuances;
22
+ //# sourceMappingURL=issuances.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuances.js","sourceRoot":"","sources":["../src/sdk/issuances.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,SAAU,SAAQ,mBAAS;IACtC;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,sBAAyD,EACzD,cAA0C,EAC1C,iBAA6C,EAC7C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AArBD,8BAqBC"}
@@ -0,0 +1,240 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { Gr4vyError } from "../models/errors/gr4vyerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Activate a gift card
32
+ *
33
+ * @remarks
34
+ * Activate a physical gift card through the primary gift card service.
35
+ */
36
+ export function giftCardsActivationsCreate(
37
+ client: Gr4vyCore,
38
+ giftCardActivationCreate: components.GiftCardActivationCreate,
39
+ idempotencyKey?: string | null | undefined,
40
+ merchantAccountId?: string | null | undefined,
41
+ options?: RequestOptions,
42
+ ): APIPromise<
43
+ Result<
44
+ components.GiftCard,
45
+ | errors.Error400
46
+ | errors.Error401
47
+ | errors.Error403
48
+ | errors.Error404
49
+ | errors.Error405
50
+ | errors.Error409
51
+ | errors.HTTPValidationError
52
+ | errors.Error425
53
+ | errors.Error429
54
+ | errors.Error500
55
+ | errors.Error502
56
+ | errors.Error504
57
+ | Gr4vyError
58
+ | ResponseValidationError
59
+ | ConnectionError
60
+ | RequestAbortedError
61
+ | RequestTimeoutError
62
+ | InvalidRequestError
63
+ | UnexpectedClientError
64
+ | SDKValidationError
65
+ >
66
+ > {
67
+ return new APIPromise($do(
68
+ client,
69
+ giftCardActivationCreate,
70
+ idempotencyKey,
71
+ merchantAccountId,
72
+ options,
73
+ ));
74
+ }
75
+
76
+ async function $do(
77
+ client: Gr4vyCore,
78
+ giftCardActivationCreate: components.GiftCardActivationCreate,
79
+ idempotencyKey?: string | null | undefined,
80
+ merchantAccountId?: string | null | undefined,
81
+ options?: RequestOptions,
82
+ ): Promise<
83
+ [
84
+ Result<
85
+ components.GiftCard,
86
+ | errors.Error400
87
+ | errors.Error401
88
+ | errors.Error403
89
+ | errors.Error404
90
+ | errors.Error405
91
+ | errors.Error409
92
+ | errors.HTTPValidationError
93
+ | errors.Error425
94
+ | errors.Error429
95
+ | errors.Error500
96
+ | errors.Error502
97
+ | errors.Error504
98
+ | Gr4vyError
99
+ | ResponseValidationError
100
+ | ConnectionError
101
+ | RequestAbortedError
102
+ | RequestTimeoutError
103
+ | InvalidRequestError
104
+ | UnexpectedClientError
105
+ | SDKValidationError
106
+ >,
107
+ APICall,
108
+ ]
109
+ > {
110
+ const input: operations.ActivateGiftCardRequest = {
111
+ giftCardActivationCreate: giftCardActivationCreate,
112
+ idempotencyKey: idempotencyKey,
113
+ merchantAccountId: merchantAccountId,
114
+ };
115
+
116
+ const parsed = safeParse(
117
+ input,
118
+ (value) => operations.ActivateGiftCardRequest$outboundSchema.parse(value),
119
+ "Input validation failed",
120
+ );
121
+ if (!parsed.ok) {
122
+ return [parsed, { status: "invalid" }];
123
+ }
124
+ const payload = parsed.value;
125
+ const body = encodeJSON("body", payload.GiftCardActivationCreate, {
126
+ explode: true,
127
+ });
128
+
129
+ const path = pathToFunc("/gift-cards/activations")();
130
+
131
+ const headers = new Headers(compactMap({
132
+ "Content-Type": "application/json",
133
+ Accept: "application/json",
134
+ "idempotency-key": encodeSimple(
135
+ "idempotency-key",
136
+ payload["idempotency-key"],
137
+ { explode: false, charEncoding: "none" },
138
+ ),
139
+ "x-gr4vy-merchant-account-id": encodeSimple(
140
+ "x-gr4vy-merchant-account-id",
141
+ payload.merchantAccountId ?? client._options.merchantAccountId,
142
+ { explode: false, charEncoding: "none" },
143
+ ),
144
+ }));
145
+
146
+ const secConfig = await extractSecurity(client._options.bearerAuth);
147
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
148
+ const requestSecurity = resolveGlobalSecurity(securityInput);
149
+
150
+ const context = {
151
+ options: client._options,
152
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
153
+ operationID: "activate_gift_card",
154
+ oAuth2Scopes: null,
155
+
156
+ resolvedSecurity: requestSecurity,
157
+
158
+ securitySource: client._options.bearerAuth,
159
+ retryConfig: options?.retries
160
+ || client._options.retryConfig
161
+ || { strategy: "none" },
162
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
163
+ };
164
+
165
+ const requestRes = client._createRequest(context, {
166
+ security: requestSecurity,
167
+ method: "POST",
168
+ baseURL: options?.serverURL,
169
+ path: path,
170
+ headers: headers,
171
+ body: body,
172
+ userAgent: client._options.userAgent,
173
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
174
+ }, options);
175
+ if (!requestRes.ok) {
176
+ return [requestRes, { status: "invalid" }];
177
+ }
178
+ const req = requestRes.value;
179
+
180
+ const doResult = await client._do(req, {
181
+ context,
182
+ isErrorStatusCode: (statusCode: number) =>
183
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
184
+ retryConfig: context.retryConfig,
185
+ retryCodes: context.retryCodes,
186
+ });
187
+ if (!doResult.ok) {
188
+ return [doResult, { status: "request-error", request: req }];
189
+ }
190
+ const response = doResult.value;
191
+
192
+ const responseFields = {
193
+ HttpMeta: { Response: response, Request: req },
194
+ };
195
+
196
+ const [result] = await M.match<
197
+ components.GiftCard,
198
+ | errors.Error400
199
+ | errors.Error401
200
+ | errors.Error403
201
+ | errors.Error404
202
+ | errors.Error405
203
+ | errors.Error409
204
+ | errors.HTTPValidationError
205
+ | errors.Error425
206
+ | errors.Error429
207
+ | errors.Error500
208
+ | errors.Error502
209
+ | errors.Error504
210
+ | Gr4vyError
211
+ | ResponseValidationError
212
+ | ConnectionError
213
+ | RequestAbortedError
214
+ | RequestTimeoutError
215
+ | InvalidRequestError
216
+ | UnexpectedClientError
217
+ | SDKValidationError
218
+ >(
219
+ M.json(201, components.GiftCard$inboundSchema),
220
+ M.jsonErr(400, errors.Error400$inboundSchema),
221
+ M.jsonErr(401, errors.Error401$inboundSchema),
222
+ M.jsonErr(403, errors.Error403$inboundSchema),
223
+ M.jsonErr(404, errors.Error404$inboundSchema),
224
+ M.jsonErr(405, errors.Error405$inboundSchema),
225
+ M.jsonErr(409, errors.Error409$inboundSchema),
226
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
227
+ M.jsonErr(425, errors.Error425$inboundSchema),
228
+ M.jsonErr(429, errors.Error429$inboundSchema),
229
+ M.jsonErr(500, errors.Error500$inboundSchema),
230
+ M.jsonErr(502, errors.Error502$inboundSchema),
231
+ M.jsonErr(504, errors.Error504$inboundSchema),
232
+ M.fail("4XX"),
233
+ M.fail("5XX"),
234
+ )(response, req, { extraFields: responseFields });
235
+ if (!result.ok) {
236
+ return [result, { status: "complete", request: req, response }];
237
+ }
238
+
239
+ return [result, { status: "complete", request: req, response }];
240
+ }
@@ -0,0 +1,240 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { Gr4vyError } from "../models/errors/gr4vyerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Issue a gift card
32
+ *
33
+ * @remarks
34
+ * Issue a new virtual gift card through the primary gift card service.
35
+ */
36
+ export function giftCardsIssuancesCreate(
37
+ client: Gr4vyCore,
38
+ giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
39
+ idempotencyKey?: string | null | undefined,
40
+ merchantAccountId?: string | null | undefined,
41
+ options?: RequestOptions,
42
+ ): APIPromise<
43
+ Result<
44
+ components.GiftCardIssuance,
45
+ | errors.Error400
46
+ | errors.Error401
47
+ | errors.Error403
48
+ | errors.Error404
49
+ | errors.Error405
50
+ | errors.Error409
51
+ | errors.HTTPValidationError
52
+ | errors.Error425
53
+ | errors.Error429
54
+ | errors.Error500
55
+ | errors.Error502
56
+ | errors.Error504
57
+ | Gr4vyError
58
+ | ResponseValidationError
59
+ | ConnectionError
60
+ | RequestAbortedError
61
+ | RequestTimeoutError
62
+ | InvalidRequestError
63
+ | UnexpectedClientError
64
+ | SDKValidationError
65
+ >
66
+ > {
67
+ return new APIPromise($do(
68
+ client,
69
+ giftCardIssuanceCreate,
70
+ idempotencyKey,
71
+ merchantAccountId,
72
+ options,
73
+ ));
74
+ }
75
+
76
+ async function $do(
77
+ client: Gr4vyCore,
78
+ giftCardIssuanceCreate: components.GiftCardIssuanceCreate,
79
+ idempotencyKey?: string | null | undefined,
80
+ merchantAccountId?: string | null | undefined,
81
+ options?: RequestOptions,
82
+ ): Promise<
83
+ [
84
+ Result<
85
+ components.GiftCardIssuance,
86
+ | errors.Error400
87
+ | errors.Error401
88
+ | errors.Error403
89
+ | errors.Error404
90
+ | errors.Error405
91
+ | errors.Error409
92
+ | errors.HTTPValidationError
93
+ | errors.Error425
94
+ | errors.Error429
95
+ | errors.Error500
96
+ | errors.Error502
97
+ | errors.Error504
98
+ | Gr4vyError
99
+ | ResponseValidationError
100
+ | ConnectionError
101
+ | RequestAbortedError
102
+ | RequestTimeoutError
103
+ | InvalidRequestError
104
+ | UnexpectedClientError
105
+ | SDKValidationError
106
+ >,
107
+ APICall,
108
+ ]
109
+ > {
110
+ const input: operations.IssueGiftCardRequest = {
111
+ giftCardIssuanceCreate: giftCardIssuanceCreate,
112
+ idempotencyKey: idempotencyKey,
113
+ merchantAccountId: merchantAccountId,
114
+ };
115
+
116
+ const parsed = safeParse(
117
+ input,
118
+ (value) => operations.IssueGiftCardRequest$outboundSchema.parse(value),
119
+ "Input validation failed",
120
+ );
121
+ if (!parsed.ok) {
122
+ return [parsed, { status: "invalid" }];
123
+ }
124
+ const payload = parsed.value;
125
+ const body = encodeJSON("body", payload.GiftCardIssuanceCreate, {
126
+ explode: true,
127
+ });
128
+
129
+ const path = pathToFunc("/gift-cards/issuances")();
130
+
131
+ const headers = new Headers(compactMap({
132
+ "Content-Type": "application/json",
133
+ Accept: "application/json",
134
+ "idempotency-key": encodeSimple(
135
+ "idempotency-key",
136
+ payload["idempotency-key"],
137
+ { explode: false, charEncoding: "none" },
138
+ ),
139
+ "x-gr4vy-merchant-account-id": encodeSimple(
140
+ "x-gr4vy-merchant-account-id",
141
+ payload.merchantAccountId ?? client._options.merchantAccountId,
142
+ { explode: false, charEncoding: "none" },
143
+ ),
144
+ }));
145
+
146
+ const secConfig = await extractSecurity(client._options.bearerAuth);
147
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
148
+ const requestSecurity = resolveGlobalSecurity(securityInput);
149
+
150
+ const context = {
151
+ options: client._options,
152
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
153
+ operationID: "issue_gift_card",
154
+ oAuth2Scopes: null,
155
+
156
+ resolvedSecurity: requestSecurity,
157
+
158
+ securitySource: client._options.bearerAuth,
159
+ retryConfig: options?.retries
160
+ || client._options.retryConfig
161
+ || { strategy: "none" },
162
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
163
+ };
164
+
165
+ const requestRes = client._createRequest(context, {
166
+ security: requestSecurity,
167
+ method: "POST",
168
+ baseURL: options?.serverURL,
169
+ path: path,
170
+ headers: headers,
171
+ body: body,
172
+ userAgent: client._options.userAgent,
173
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
174
+ }, options);
175
+ if (!requestRes.ok) {
176
+ return [requestRes, { status: "invalid" }];
177
+ }
178
+ const req = requestRes.value;
179
+
180
+ const doResult = await client._do(req, {
181
+ context,
182
+ isErrorStatusCode: (statusCode: number) =>
183
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
184
+ retryConfig: context.retryConfig,
185
+ retryCodes: context.retryCodes,
186
+ });
187
+ if (!doResult.ok) {
188
+ return [doResult, { status: "request-error", request: req }];
189
+ }
190
+ const response = doResult.value;
191
+
192
+ const responseFields = {
193
+ HttpMeta: { Response: response, Request: req },
194
+ };
195
+
196
+ const [result] = await M.match<
197
+ components.GiftCardIssuance,
198
+ | errors.Error400
199
+ | errors.Error401
200
+ | errors.Error403
201
+ | errors.Error404
202
+ | errors.Error405
203
+ | errors.Error409
204
+ | errors.HTTPValidationError
205
+ | errors.Error425
206
+ | errors.Error429
207
+ | errors.Error500
208
+ | errors.Error502
209
+ | errors.Error504
210
+ | Gr4vyError
211
+ | ResponseValidationError
212
+ | ConnectionError
213
+ | RequestAbortedError
214
+ | RequestTimeoutError
215
+ | InvalidRequestError
216
+ | UnexpectedClientError
217
+ | SDKValidationError
218
+ >(
219
+ M.json(201, components.GiftCardIssuance$inboundSchema),
220
+ M.jsonErr(400, errors.Error400$inboundSchema),
221
+ M.jsonErr(401, errors.Error401$inboundSchema),
222
+ M.jsonErr(403, errors.Error403$inboundSchema),
223
+ M.jsonErr(404, errors.Error404$inboundSchema),
224
+ M.jsonErr(405, errors.Error405$inboundSchema),
225
+ M.jsonErr(409, errors.Error409$inboundSchema),
226
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
227
+ M.jsonErr(425, errors.Error425$inboundSchema),
228
+ M.jsonErr(429, errors.Error429$inboundSchema),
229
+ M.jsonErr(500, errors.Error500$inboundSchema),
230
+ M.jsonErr(502, errors.Error502$inboundSchema),
231
+ M.jsonErr(504, errors.Error504$inboundSchema),
232
+ M.fail("4XX"),
233
+ M.fail("5XX"),
234
+ )(response, req, { extraFields: responseFields });
235
+ if (!result.ok) {
236
+ return [result, { status: "complete", request: req, response }];
237
+ }
238
+
239
+ return [result, { status: "complete", request: req, response }];
240
+ }
package/src/lib/config.ts CHANGED
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
77
77
  export const SDK_METADATA = {
78
78
  language: "typescript",
79
79
  openapiDocVersion: "1.0.0",
80
- sdkVersion: "2.3.27",
81
- genVersion: "2.918.4",
82
- userAgent: "speakeasy-sdk/typescript 2.3.27 2.918.4 1.0.0 @gr4vy/sdk",
80
+ sdkVersion: "2.3.29",
81
+ genVersion: "2.924.0",
82
+ userAgent: "speakeasy-sdk/typescript 2.3.29 2.924.0 1.0.0 @gr4vy/sdk",
83
83
  } as const;
@@ -21,6 +21,10 @@ export type Buyer = {
21
21
  * The ID for the buyer.
22
22
  */
23
23
  id: string;
24
+ /**
25
+ * The base62 encoded buyer ID. This represents a shorter version of this buyer's `id` which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's buyer against our system.
26
+ */
27
+ reconciliationId: string;
24
28
  /**
25
29
  * The ID of the merchant account this buyer belongs to.
26
30
  */
@@ -56,6 +60,7 @@ export const Buyer$inboundSchema: z.ZodType<Buyer, z.ZodTypeDef, unknown> = z
56
60
  .object({
57
61
  type: z.literal("buyer").default("buyer"),
58
62
  id: z.string(),
63
+ reconciliation_id: z.string(),
59
64
  merchant_account_id: z.string(),
60
65
  display_name: z.nullable(z.string()).optional(),
61
66
  external_identifier: z.nullable(z.string()).optional(),
@@ -69,6 +74,7 @@ export const Buyer$inboundSchema: z.ZodType<Buyer, z.ZodTypeDef, unknown> = z
69
74
  ),
70
75
  }).transform((v) => {
71
76
  return remap$(v, {
77
+ "reconciliation_id": "reconciliationId",
72
78
  "merchant_account_id": "merchantAccountId",
73
79
  "display_name": "displayName",
74
80
  "external_identifier": "externalIdentifier",
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ /**
9
+ * The details used to activate a physical gift card.
10
+ */
11
+ export type GiftCardActivationCreate = {
12
+ /**
13
+ * The 16-19 digit number for the gift card.
14
+ */
15
+ number: string;
16
+ /**
17
+ * The PIN for this gift card.
18
+ */
19
+ pin?: string | null | undefined;
20
+ /**
21
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if `currency` is provided.
22
+ */
23
+ amount?: number | null | undefined;
24
+ /**
25
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
26
+ */
27
+ currency?: string | null | undefined;
28
+ /**
29
+ * An optional external identifier for this activation.
30
+ */
31
+ externalIdentifier?: string | null | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export type GiftCardActivationCreate$Outbound = {
36
+ number: string;
37
+ pin?: string | null | undefined;
38
+ amount?: number | null | undefined;
39
+ currency?: string | null | undefined;
40
+ external_identifier?: string | null | undefined;
41
+ };
42
+
43
+ /** @internal */
44
+ export const GiftCardActivationCreate$outboundSchema: z.ZodType<
45
+ GiftCardActivationCreate$Outbound,
46
+ z.ZodTypeDef,
47
+ GiftCardActivationCreate
48
+ > = z.object({
49
+ number: z.string(),
50
+ pin: z.nullable(z.string()).optional(),
51
+ amount: z.nullable(z.number().int()).optional(),
52
+ currency: z.nullable(z.string()).optional(),
53
+ externalIdentifier: z.nullable(z.string()).optional(),
54
+ }).transform((v) => {
55
+ return remap$(v, {
56
+ externalIdentifier: "external_identifier",
57
+ });
58
+ });
59
+
60
+ export function giftCardActivationCreateToJSON(
61
+ giftCardActivationCreate: GiftCardActivationCreate,
62
+ ): string {
63
+ return JSON.stringify(
64
+ GiftCardActivationCreate$outboundSchema.parse(giftCardActivationCreate),
65
+ );
66
+ }