@gr4vy/sdk 2.3.28 → 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.
- package/README.md +5 -0
- package/funcs/giftCardsIssuancesCreate.d.ts +18 -0
- package/funcs/giftCardsIssuancesCreate.d.ts.map +1 -0
- package/funcs/giftCardsIssuancesCreate.js +129 -0
- package/funcs/giftCardsIssuancesCreate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/giftcardissuance.d.ts +51 -0
- package/models/components/giftcardissuance.d.ts.map +1 -0
- package/models/components/giftcardissuance.js +71 -0
- package/models/components/giftcardissuance.js.map +1 -0
- package/models/components/giftcardissuancecreate.d.ts +33 -0
- package/models/components/giftcardissuancecreate.d.ts.map +1 -0
- package/models/components/giftcardissuancecreate.js +57 -0
- package/models/components/giftcardissuancecreate.js.map +1 -0
- package/models/components/index.d.ts +2 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +2 -0
- package/models/components/index.js.map +1 -1
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/issuegiftcard.d.ts +26 -0
- package/models/operations/issuegiftcard.d.ts.map +1 -0
- package/models/operations/issuegiftcard.js +58 -0
- package/models/operations/issuegiftcard.js.map +1 -0
- package/package.json +1 -1
- package/sdk/giftcards.d.ts +3 -0
- package/sdk/giftcards.d.ts.map +1 -1
- package/sdk/giftcards.js +4 -0
- package/sdk/giftcards.js.map +1 -1
- package/sdk/issuances.d.ts +12 -0
- package/sdk/issuances.d.ts.map +1 -0
- package/sdk/issuances.js +22 -0
- package/sdk/issuances.js.map +1 -0
- package/src/funcs/giftCardsIssuancesCreate.ts +240 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/giftcardissuance.ts +95 -0
- package/src/models/components/giftcardissuancecreate.ts +60 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/issuegiftcard.ts +54 -0
- package/src/sdk/giftcards.ts +6 -0
- package/src/sdk/issuances.ts +31 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.IssueGiftCardRequest$outboundSchema = void 0;
|
|
40
|
+
exports.issueGiftCardRequestToJSON = issueGiftCardRequestToJSON;
|
|
41
|
+
const z = __importStar(require("zod/v3"));
|
|
42
|
+
const primitives_js_1 = require("../../lib/primitives.js");
|
|
43
|
+
const components = __importStar(require("../components/index.js"));
|
|
44
|
+
/** @internal */
|
|
45
|
+
exports.IssueGiftCardRequest$outboundSchema = z.object({
|
|
46
|
+
idempotencyKey: z.nullable(z.string()).optional(),
|
|
47
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
48
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate$outboundSchema,
|
|
49
|
+
}).transform((v) => {
|
|
50
|
+
return (0, primitives_js_1.remap)(v, {
|
|
51
|
+
idempotencyKey: "idempotency-key",
|
|
52
|
+
giftCardIssuanceCreate: "GiftCardIssuanceCreate",
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
function issueGiftCardRequestToJSON(issueGiftCardRequest) {
|
|
56
|
+
return JSON.stringify(exports.IssueGiftCardRequest$outboundSchema.parse(issueGiftCardRequest));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=issuegiftcard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuegiftcard.js","sourceRoot":"","sources":["../../src/models/operations/issuegiftcard.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CH,gEAMC;AAjDD,0CAA4B;AAC5B,2DAA0D;AAC1D,mEAAqD;AAyBrD,gBAAgB;AACH,QAAA,mCAAmC,GAI5C,CAAC,CAAC,MAAM,CAAC;IACX,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACjD,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,sBAAsB,EAAE,UAAU,CAAC,qCAAqC;CACzE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,IAAA,qBAAM,EAAC,CAAC,EAAE;QACf,cAAc,EAAE,iBAAiB;QACjC,sBAAsB,EAAE,wBAAwB;KACjD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,0BAA0B,CACxC,oBAA0C;IAE1C,OAAO,IAAI,CAAC,SAAS,CACnB,2CAAmC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAChE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/sdk/giftcards.d.ts
CHANGED
|
@@ -4,11 +4,14 @@ import * as operations from "../models/operations/index.js";
|
|
|
4
4
|
import { PageIterator } from "../types/operations.js";
|
|
5
5
|
import { Activations } from "./activations.js";
|
|
6
6
|
import { Balances } from "./balances.js";
|
|
7
|
+
import { Issuances } from "./issuances.js";
|
|
7
8
|
export declare class GiftCards extends ClientSDK {
|
|
8
9
|
private _balances?;
|
|
9
10
|
get balances(): Balances;
|
|
10
11
|
private _activations?;
|
|
11
12
|
get activations(): Activations;
|
|
13
|
+
private _issuances?;
|
|
14
|
+
get issuances(): Issuances;
|
|
12
15
|
/**
|
|
13
16
|
* Get gift card
|
|
14
17
|
*
|
package/sdk/giftcards.d.ts.map
CHANGED
|
@@ -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;AAE5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V,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
|
@@ -13,6 +13,7 @@ const fp_js_1 = require("../types/fp.js");
|
|
|
13
13
|
const operations_js_1 = require("../types/operations.js");
|
|
14
14
|
const activations_js_1 = require("./activations.js");
|
|
15
15
|
const balances_js_1 = require("./balances.js");
|
|
16
|
+
const issuances_js_1 = require("./issuances.js");
|
|
16
17
|
class GiftCards extends sdks_js_1.ClientSDK {
|
|
17
18
|
get balances() {
|
|
18
19
|
return (this._balances ?? (this._balances = new balances_js_1.Balances(this._options)));
|
|
@@ -20,6 +21,9 @@ class GiftCards extends sdks_js_1.ClientSDK {
|
|
|
20
21
|
get activations() {
|
|
21
22
|
return (this._activations ?? (this._activations = new activations_js_1.Activations(this._options)));
|
|
22
23
|
}
|
|
24
|
+
get issuances() {
|
|
25
|
+
return (this._issuances ?? (this._issuances = new issuances_js_1.Issuances(this._options)));
|
|
26
|
+
}
|
|
23
27
|
/**
|
|
24
28
|
* Get gift card
|
|
25
29
|
*
|
package/sdk/giftcards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"giftcards.js","sourceRoot":"","sources":["../src/sdk/giftcards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oEAA8D;AAC9D,oEAA8D;AAC9D,8DAAwD;AACxD,gEAA0D;AAC1D,4CAA2D;AAG3D,0CAA6C;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M,CACV,cAAyC,EACzC,iBAA6C,EAC7C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,oCAAe,EAChC,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,OAAqD,EACrD,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"}
|
package/sdk/issuances.js
ADDED
|
@@ -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
|
+
* 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.
|
|
81
|
-
genVersion: "2.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 2.3.
|
|
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;
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
GiftCardService,
|
|
12
|
+
GiftCardService$inboundSchema,
|
|
13
|
+
} from "./giftcardservice.js";
|
|
14
|
+
|
|
15
|
+
export type GiftCardIssuance = {
|
|
16
|
+
/**
|
|
17
|
+
* Always `gift-card-issuance`.
|
|
18
|
+
*/
|
|
19
|
+
type: "gift-card-issuance";
|
|
20
|
+
/**
|
|
21
|
+
* The ID for the gift card issuance.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* The ID of the merchant account this gift card issuance belongs to.
|
|
26
|
+
*/
|
|
27
|
+
merchantAccountId: string;
|
|
28
|
+
giftCardService: GiftCardService;
|
|
29
|
+
/**
|
|
30
|
+
* The identifier for this issuance as provided by the gift card service.
|
|
31
|
+
*/
|
|
32
|
+
giftCardServicePaymentIssuanceId: string;
|
|
33
|
+
/**
|
|
34
|
+
* The URL for the issued gift card.
|
|
35
|
+
*/
|
|
36
|
+
url: string;
|
|
37
|
+
/**
|
|
38
|
+
* The amount loaded onto the gift card, in the smallest denomination for the currency.
|
|
39
|
+
*/
|
|
40
|
+
amount: number;
|
|
41
|
+
/**
|
|
42
|
+
* The ISO-4217 currency code for the `amount`.
|
|
43
|
+
*/
|
|
44
|
+
currency: string;
|
|
45
|
+
/**
|
|
46
|
+
* The external identifier provided when issuing the gift card.
|
|
47
|
+
*/
|
|
48
|
+
externalIdentifier?: string | null | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The date and time when this gift card was issued.
|
|
51
|
+
*/
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
/**
|
|
54
|
+
* The date and time when this gift card issuance was last updated.
|
|
55
|
+
*/
|
|
56
|
+
updatedAt: Date;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** @internal */
|
|
60
|
+
export const GiftCardIssuance$inboundSchema: z.ZodType<
|
|
61
|
+
GiftCardIssuance,
|
|
62
|
+
z.ZodTypeDef,
|
|
63
|
+
unknown
|
|
64
|
+
> = z.object({
|
|
65
|
+
type: z.literal("gift-card-issuance").default("gift-card-issuance"),
|
|
66
|
+
id: z.string(),
|
|
67
|
+
merchant_account_id: z.string(),
|
|
68
|
+
gift_card_service: GiftCardService$inboundSchema,
|
|
69
|
+
gift_card_service_payment_issuance_id: z.string(),
|
|
70
|
+
url: z.string(),
|
|
71
|
+
amount: z.number().int(),
|
|
72
|
+
currency: z.string(),
|
|
73
|
+
external_identifier: z.nullable(z.string()).optional(),
|
|
74
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
75
|
+
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
76
|
+
}).transform((v) => {
|
|
77
|
+
return remap$(v, {
|
|
78
|
+
"merchant_account_id": "merchantAccountId",
|
|
79
|
+
"gift_card_service": "giftCardService",
|
|
80
|
+
"gift_card_service_payment_issuance_id": "giftCardServicePaymentIssuanceId",
|
|
81
|
+
"external_identifier": "externalIdentifier",
|
|
82
|
+
"created_at": "createdAt",
|
|
83
|
+
"updated_at": "updatedAt",
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export function giftCardIssuanceFromJSON(
|
|
88
|
+
jsonString: string,
|
|
89
|
+
): SafeParseResult<GiftCardIssuance, SDKValidationError> {
|
|
90
|
+
return safeParse(
|
|
91
|
+
jsonString,
|
|
92
|
+
(x) => GiftCardIssuance$inboundSchema.parse(JSON.parse(x)),
|
|
93
|
+
`Failed to parse 'GiftCardIssuance' from JSON`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 issue a new virtual gift card.
|
|
10
|
+
*/
|
|
11
|
+
export type GiftCardIssuanceCreate = {
|
|
12
|
+
/**
|
|
13
|
+
* The provider theme code to issue the gift card against.
|
|
14
|
+
*/
|
|
15
|
+
theme: string;
|
|
16
|
+
/**
|
|
17
|
+
* The amount to load onto the gift card, in the smallest denomination for the currency.
|
|
18
|
+
*/
|
|
19
|
+
amount: number;
|
|
20
|
+
/**
|
|
21
|
+
* The ISO-4217 currency code for the `amount`.
|
|
22
|
+
*/
|
|
23
|
+
currency: string;
|
|
24
|
+
/**
|
|
25
|
+
* An optional external identifier for this issuance.
|
|
26
|
+
*/
|
|
27
|
+
externalIdentifier?: string | null | undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export type GiftCardIssuanceCreate$Outbound = {
|
|
32
|
+
theme: string;
|
|
33
|
+
amount: number;
|
|
34
|
+
currency: string;
|
|
35
|
+
external_identifier?: string | null | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const GiftCardIssuanceCreate$outboundSchema: z.ZodType<
|
|
40
|
+
GiftCardIssuanceCreate$Outbound,
|
|
41
|
+
z.ZodTypeDef,
|
|
42
|
+
GiftCardIssuanceCreate
|
|
43
|
+
> = z.object({
|
|
44
|
+
theme: z.string(),
|
|
45
|
+
amount: z.number().int(),
|
|
46
|
+
currency: z.string(),
|
|
47
|
+
externalIdentifier: z.nullable(z.string()).optional(),
|
|
48
|
+
}).transform((v) => {
|
|
49
|
+
return remap$(v, {
|
|
50
|
+
externalIdentifier: "external_identifier",
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export function giftCardIssuanceCreateToJSON(
|
|
55
|
+
giftCardIssuanceCreate: GiftCardIssuanceCreate,
|
|
56
|
+
): string {
|
|
57
|
+
return JSON.stringify(
|
|
58
|
+
GiftCardIssuanceCreate$outboundSchema.parse(giftCardIssuanceCreate),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -124,6 +124,8 @@ export * from "./giftcardactivationcreate.js";
|
|
|
124
124
|
export * from "./giftcardbalancerequest.js";
|
|
125
125
|
export * from "./giftcardcreate.js";
|
|
126
126
|
export * from "./giftcarderrorcode.js";
|
|
127
|
+
export * from "./giftcardissuance.js";
|
|
128
|
+
export * from "./giftcardissuancecreate.js";
|
|
127
129
|
export * from "./giftcardredemption.js";
|
|
128
130
|
export * from "./giftcardredemptionstatus.js";
|
|
129
131
|
export * from "./giftcardrequest.js";
|
|
@@ -67,6 +67,7 @@ export * from "./gettransactioncapture.js";
|
|
|
67
67
|
export * from "./gettransactionrefund.js";
|
|
68
68
|
export * from "./gettransactionrefundsettlement.js";
|
|
69
69
|
export * from "./gettransactionsettlement.js";
|
|
70
|
+
export * from "./issuegiftcard.js";
|
|
70
71
|
export * from "./listallreportexecutions.js";
|
|
71
72
|
export * from "./listapikeypairs.js";
|
|
72
73
|
export * from "./listauditlogs.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
import * as components from "../components/index.js";
|
|
8
|
+
|
|
9
|
+
export type IssueGiftCardGlobals = {
|
|
10
|
+
merchantAccountId?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type IssueGiftCardRequest = {
|
|
14
|
+
/**
|
|
15
|
+
* A unique key forwarded to the gift card service to make the issuance idempotent.
|
|
16
|
+
*/
|
|
17
|
+
idempotencyKey?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The ID of the merchant account to use for this request.
|
|
20
|
+
*/
|
|
21
|
+
merchantAccountId?: string | null | undefined;
|
|
22
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type IssueGiftCardRequest$Outbound = {
|
|
27
|
+
"idempotency-key"?: string | null | undefined;
|
|
28
|
+
merchantAccountId?: string | null | undefined;
|
|
29
|
+
GiftCardIssuanceCreate: components.GiftCardIssuanceCreate$Outbound;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const IssueGiftCardRequest$outboundSchema: z.ZodType<
|
|
34
|
+
IssueGiftCardRequest$Outbound,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
IssueGiftCardRequest
|
|
37
|
+
> = z.object({
|
|
38
|
+
idempotencyKey: z.nullable(z.string()).optional(),
|
|
39
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
40
|
+
giftCardIssuanceCreate: components.GiftCardIssuanceCreate$outboundSchema,
|
|
41
|
+
}).transform((v) => {
|
|
42
|
+
return remap$(v, {
|
|
43
|
+
idempotencyKey: "idempotency-key",
|
|
44
|
+
giftCardIssuanceCreate: "GiftCardIssuanceCreate",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export function issueGiftCardRequestToJSON(
|
|
49
|
+
issueGiftCardRequest: IssueGiftCardRequest,
|
|
50
|
+
): string {
|
|
51
|
+
return JSON.stringify(
|
|
52
|
+
IssueGiftCardRequest$outboundSchema.parse(issueGiftCardRequest),
|
|
53
|
+
);
|
|
54
|
+
}
|
package/src/sdk/giftcards.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { unwrapAsync } from "../types/fp.js";
|
|
|
13
13
|
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
14
14
|
import { Activations } from "./activations.js";
|
|
15
15
|
import { Balances } from "./balances.js";
|
|
16
|
+
import { Issuances } from "./issuances.js";
|
|
16
17
|
|
|
17
18
|
export class GiftCards extends ClientSDK {
|
|
18
19
|
private _balances?: Balances;
|
|
@@ -25,6 +26,11 @@ export class GiftCards extends ClientSDK {
|
|
|
25
26
|
return (this._activations ??= new Activations(this._options));
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
private _issuances?: Issuances;
|
|
30
|
+
get issuances(): Issuances {
|
|
31
|
+
return (this._issuances ??= new Issuances(this._options));
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* Get gift card
|
|
30
36
|
*
|