@gr4vy/sdk 1.9.6 → 1.9.8
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/examples/package-lock.json +1 -1
- package/funcs/transactionsActionsList.d.ts +18 -0
- package/funcs/transactionsActionsList.d.ts.map +1 -0
- package/funcs/transactionsActionsList.js +154 -0
- package/funcs/transactionsActionsList.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/flow.d.ts +12 -0
- package/models/components/flow.d.ts.map +1 -0
- package/models/components/flow.js +49 -0
- package/models/components/flow.js.map +1 -0
- package/models/components/flowaction.d.ts +12 -0
- package/models/components/flowaction.d.ts.map +1 -0
- package/models/components/flowaction.js +49 -0
- package/models/components/flowaction.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/transactionaction.d.ts +31 -0
- package/models/components/transactionaction.d.ts.map +1 -0
- package/models/components/transactionaction.js +63 -0
- package/models/components/transactionaction.js.map +1 -0
- package/models/components/transactionactions.d.ts +14 -0
- package/models/components/transactionactions.d.ts.map +1 -0
- package/models/components/transactionactions.js +51 -0
- package/models/components/transactionactions.js.map +1 -0
- 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/listtransactionactions.d.ts +23 -0
- package/models/operations/listtransactionactions.d.ts.map +1 -0
- package/models/operations/listtransactionactions.js +55 -0
- package/models/operations/listtransactionactions.js.map +1 -0
- package/package.json +1 -1
- package/sdk/actions.d.ts +12 -0
- package/sdk/actions.d.ts.map +1 -0
- package/sdk/actions.js +22 -0
- package/sdk/actions.js.map +1 -0
- package/sdk/transactions.d.ts +3 -0
- package/sdk/transactions.d.ts.map +1 -1
- package/sdk/transactions.js +4 -0
- package/sdk/transactions.js.map +1 -1
- package/src/funcs/transactionsActionsList.ts +259 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/flow.ts +19 -0
- package/src/models/components/flowaction.ts +22 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/transactionaction.ts +61 -0
- package/src/models/components/transactionactions.ts +38 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listtransactionactions.ts +51 -0
- package/src/sdk/actions.ts +29 -0
- package/src/sdk/transactions.ts +6 -0
|
@@ -0,0 +1,61 @@
|
|
|
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 { Flow, Flow$inboundSchema } from "./flow.js";
|
|
11
|
+
import { FlowAction, FlowAction$inboundSchema } from "./flowaction.js";
|
|
12
|
+
|
|
13
|
+
export type TransactionAction = {
|
|
14
|
+
/**
|
|
15
|
+
* Always `action`.
|
|
16
|
+
*/
|
|
17
|
+
type: "action";
|
|
18
|
+
id: FlowAction;
|
|
19
|
+
flow: Flow;
|
|
20
|
+
/**
|
|
21
|
+
* The ID of the rule that triggered this action.
|
|
22
|
+
*/
|
|
23
|
+
ruleId: string;
|
|
24
|
+
/**
|
|
25
|
+
* The date this action was created at.
|
|
26
|
+
*/
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
/**
|
|
29
|
+
* The outcome of the action.
|
|
30
|
+
*/
|
|
31
|
+
outcome: { [k: string]: any };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const TransactionAction$inboundSchema: z.ZodType<
|
|
36
|
+
TransactionAction,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
unknown
|
|
39
|
+
> = z.object({
|
|
40
|
+
type: z.literal("action").default("action"),
|
|
41
|
+
id: FlowAction$inboundSchema,
|
|
42
|
+
flow: Flow$inboundSchema,
|
|
43
|
+
rule_id: z.string(),
|
|
44
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
45
|
+
outcome: z.record(z.any()),
|
|
46
|
+
}).transform((v) => {
|
|
47
|
+
return remap$(v, {
|
|
48
|
+
"rule_id": "ruleId",
|
|
49
|
+
"created_at": "createdAt",
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export function transactionActionFromJSON(
|
|
54
|
+
jsonString: string,
|
|
55
|
+
): SafeParseResult<TransactionAction, SDKValidationError> {
|
|
56
|
+
return safeParse(
|
|
57
|
+
jsonString,
|
|
58
|
+
(x) => TransactionAction$inboundSchema.parse(JSON.parse(x)),
|
|
59
|
+
`Failed to parse 'TransactionAction' from JSON`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
TransactionAction,
|
|
11
|
+
TransactionAction$inboundSchema,
|
|
12
|
+
} from "./transactionaction.js";
|
|
13
|
+
|
|
14
|
+
export type TransactionActions = {
|
|
15
|
+
/**
|
|
16
|
+
* The list of actions triggered for a transaction.
|
|
17
|
+
*/
|
|
18
|
+
items: Array<TransactionAction>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const TransactionActions$inboundSchema: z.ZodType<
|
|
23
|
+
TransactionActions,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
items: z.array(TransactionAction$inboundSchema),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function transactionActionsFromJSON(
|
|
31
|
+
jsonString: string,
|
|
32
|
+
): SafeParseResult<TransactionActions, SDKValidationError> {
|
|
33
|
+
return safeParse(
|
|
34
|
+
jsonString,
|
|
35
|
+
(x) => TransactionActions$inboundSchema.parse(JSON.parse(x)),
|
|
36
|
+
`Failed to parse 'TransactionActions' from JSON`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -74,6 +74,7 @@ export * from "./listpaymentservices.js";
|
|
|
74
74
|
export * from "./listpayouts.js";
|
|
75
75
|
export * from "./listreportexecutions.js";
|
|
76
76
|
export * from "./listreports.js";
|
|
77
|
+
export * from "./listtransactionactions.js";
|
|
77
78
|
export * from "./listtransactionevents.js";
|
|
78
79
|
export * from "./listtransactionrefunds.js";
|
|
79
80
|
export * from "./listtransactions.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
export type ListTransactionActionsGlobals = {
|
|
9
|
+
merchantAccountId?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ListTransactionActionsRequest = {
|
|
13
|
+
/**
|
|
14
|
+
* The ID of the transaction
|
|
15
|
+
*/
|
|
16
|
+
transactionId: string;
|
|
17
|
+
/**
|
|
18
|
+
* The ID of the merchant account to use for this request.
|
|
19
|
+
*/
|
|
20
|
+
merchantAccountId?: string | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export type ListTransactionActionsRequest$Outbound = {
|
|
25
|
+
transaction_id: string;
|
|
26
|
+
merchantAccountId?: string | null | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const ListTransactionActionsRequest$outboundSchema: z.ZodType<
|
|
31
|
+
ListTransactionActionsRequest$Outbound,
|
|
32
|
+
z.ZodTypeDef,
|
|
33
|
+
ListTransactionActionsRequest
|
|
34
|
+
> = z.object({
|
|
35
|
+
transactionId: z.string(),
|
|
36
|
+
merchantAccountId: z.nullable(z.string()).optional(),
|
|
37
|
+
}).transform((v) => {
|
|
38
|
+
return remap$(v, {
|
|
39
|
+
transactionId: "transaction_id",
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export function listTransactionActionsRequestToJSON(
|
|
44
|
+
listTransactionActionsRequest: ListTransactionActionsRequest,
|
|
45
|
+
): string {
|
|
46
|
+
return JSON.stringify(
|
|
47
|
+
ListTransactionActionsRequest$outboundSchema.parse(
|
|
48
|
+
listTransactionActionsRequest,
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { transactionsActionsList } from "../funcs/transactionsActionsList.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as components from "../models/components/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export class Actions extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* List transaction Flow rules
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Retrieve the list of Flow rule actions that have been triggered for a transaction.
|
|
16
|
+
*/
|
|
17
|
+
async list(
|
|
18
|
+
transactionId: string,
|
|
19
|
+
merchantAccountId?: string | null | undefined,
|
|
20
|
+
options?: RequestOptions,
|
|
21
|
+
): Promise<components.TransactionActions> {
|
|
22
|
+
return unwrapAsync(transactionsActionsList(
|
|
23
|
+
this,
|
|
24
|
+
transactionId,
|
|
25
|
+
merchantAccountId,
|
|
26
|
+
options,
|
|
27
|
+
));
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/sdk/transactions.ts
CHANGED
|
@@ -15,6 +15,7 @@ import * as components from "../models/components/index.js";
|
|
|
15
15
|
import * as operations from "../models/operations/index.js";
|
|
16
16
|
import { unwrapAsync } from "../types/fp.js";
|
|
17
17
|
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
18
|
+
import { Actions } from "./actions.js";
|
|
18
19
|
import { Events } from "./events.js";
|
|
19
20
|
import { Gr4vyRefunds } from "./gr4vyrefunds.js";
|
|
20
21
|
import { Settlements } from "./settlements.js";
|
|
@@ -25,6 +26,11 @@ export class Transactions extends ClientSDK {
|
|
|
25
26
|
return (this._refunds ??= new Gr4vyRefunds(this._options));
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
private _actions?: Actions;
|
|
30
|
+
get actions(): Actions {
|
|
31
|
+
return (this._actions ??= new Actions(this._options));
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
private _events?: Events;
|
|
29
35
|
get events(): Events {
|
|
30
36
|
return (this._events ??= new Events(this._options));
|