@gr4vy/sdk 2.4.9 → 2.4.12

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 (73) hide show
  1. package/README.md +5 -0
  2. package/funcs/paymentServicesList.js +1 -0
  3. package/funcs/paymentServicesList.js.map +1 -1
  4. package/funcs/rolesList.d.ts +21 -0
  5. package/funcs/rolesList.d.ts.map +1 -0
  6. package/funcs/rolesList.js +158 -0
  7. package/funcs/rolesList.js.map +1 -0
  8. package/jsr.json +1 -1
  9. package/lib/config.d.ts +3 -3
  10. package/lib/config.js +3 -3
  11. package/lib/config.js.map +1 -1
  12. package/lib/encodings.d.ts +10 -9
  13. package/lib/encodings.d.ts.map +1 -1
  14. package/lib/encodings.js +29 -13
  15. package/lib/encodings.js.map +1 -1
  16. package/models/components/collectionrole.d.ts +26 -0
  17. package/models/components/collectionrole.d.ts.map +1 -0
  18. package/models/components/collectionrole.js +60 -0
  19. package/models/components/collectionrole.js.map +1 -0
  20. package/models/components/index.d.ts +1 -0
  21. package/models/components/index.d.ts.map +1 -1
  22. package/models/components/index.js +1 -0
  23. package/models/components/index.js.map +1 -1
  24. package/models/components/method.d.ts +1 -0
  25. package/models/components/method.d.ts.map +1 -1
  26. package/models/components/method.js +1 -0
  27. package/models/components/method.js.map +1 -1
  28. package/models/components/permissionset.d.ts +6 -0
  29. package/models/components/permissionset.d.ts.map +1 -1
  30. package/models/components/permissionset.js.map +1 -1
  31. package/models/components/redirectpaymentmethodcreate.d.ts +1 -0
  32. package/models/components/redirectpaymentmethodcreate.d.ts.map +1 -1
  33. package/models/components/redirectpaymentmethodcreate.js +1 -0
  34. package/models/components/redirectpaymentmethodcreate.js.map +1 -1
  35. package/models/components/role.d.ts +15 -0
  36. package/models/components/role.d.ts.map +1 -1
  37. package/models/components/role.js.map +1 -1
  38. package/models/operations/index.d.ts +1 -0
  39. package/models/operations/index.d.ts.map +1 -1
  40. package/models/operations/index.js +1 -0
  41. package/models/operations/index.js.map +1 -1
  42. package/models/operations/listpaymentservices.d.ts +5 -0
  43. package/models/operations/listpaymentservices.d.ts.map +1 -1
  44. package/models/operations/listpaymentservices.js +5 -0
  45. package/models/operations/listpaymentservices.js.map +1 -1
  46. package/models/operations/listroles.d.ts +29 -0
  47. package/models/operations/listroles.d.ts.map +1 -0
  48. package/models/operations/listroles.js +65 -0
  49. package/models/operations/listroles.js.map +1 -0
  50. package/package.json +1 -1
  51. package/sdk/roles.d.ts +15 -0
  52. package/sdk/roles.d.ts.map +1 -0
  53. package/sdk/roles.js +22 -0
  54. package/sdk/roles.js.map +1 -0
  55. package/sdk/sdk.d.ts +3 -0
  56. package/sdk/sdk.d.ts.map +1 -1
  57. package/sdk/sdk.js +4 -0
  58. package/sdk/sdk.js.map +1 -1
  59. package/src/funcs/paymentServicesList.ts +1 -0
  60. package/src/funcs/rolesList.ts +310 -0
  61. package/src/lib/config.ts +3 -3
  62. package/src/lib/encodings.ts +58 -23
  63. package/src/models/components/collectionrole.ts +56 -0
  64. package/src/models/components/index.ts +1 -0
  65. package/src/models/components/method.ts +1 -0
  66. package/src/models/components/permissionset.ts +6 -0
  67. package/src/models/components/redirectpaymentmethodcreate.ts +1 -0
  68. package/src/models/components/role.ts +15 -0
  69. package/src/models/operations/index.ts +1 -0
  70. package/src/models/operations/listpaymentservices.ts +10 -0
  71. package/src/models/operations/listroles.ts +72 -0
  72. package/src/sdk/roles.ts +29 -0
  73. package/src/sdk/sdk.ts +6 -0
@@ -7,7 +7,13 @@ import { safeParse } from "../../lib/schemas.js";
7
7
  import { Result as SafeParseResult } from "../../types/fp.js";
8
8
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
9
 
10
+ /**
11
+ * The permissions granted by a role.
12
+ */
10
13
  export type PermissionSet = {
14
+ /**
15
+ * The scopes granted by this role.
16
+ */
11
17
  allow: Array<string>;
12
18
  };
13
19
 
@@ -37,6 +37,7 @@ export const RedirectPaymentMethodCreateMethod = {
37
37
  Dana: "dana",
38
38
  Dcb: "dcb",
39
39
  Dlocal: "dlocal",
40
+ Duitnow: "duitnow",
40
41
  Ebanx: "ebanx",
41
42
  Eckoh: "eckoh",
42
43
  Efecty: "efecty",
@@ -14,14 +14,29 @@ import {
14
14
  } from "./roleassigneetype.js";
15
15
 
16
16
  export type Role = {
17
+ /**
18
+ * Always `role`.
19
+ */
17
20
  type: "role";
21
+ /**
22
+ * The unique ID for the role.
23
+ */
18
24
  id: string;
25
+ /**
26
+ * The human-readable name of the role.
27
+ */
19
28
  name: string;
20
29
  /**
21
30
  * The unique, human-readable identifier for the role.
22
31
  */
23
32
  slug: string;
33
+ /**
34
+ * A description of the access this role grants.
35
+ */
24
36
  description: string;
37
+ /**
38
+ * The permissions granted by a role.
39
+ */
25
40
  permissions: PermissionSet;
26
41
  /**
27
42
  * The types of resource this role can be assigned to.
@@ -91,6 +91,7 @@ export * from "./listpaymentservices.js";
91
91
  export * from "./listpayouts.js";
92
92
  export * from "./listreportexecutions.js";
93
93
  export * from "./listreports.js";
94
+ export * from "./listroles.js";
94
95
  export * from "./listthreedsconfigurations.js";
95
96
  export * from "./listtransactionactions.js";
96
97
  export * from "./listtransactioncaptures.js";
@@ -30,6 +30,10 @@ export type ListPaymentServicesRequest = {
30
30
  * Return any deleted payment service.
31
31
  */
32
32
  deleted?: boolean | null | undefined;
33
+ /**
34
+ * Include the non-secret credential and reporting fields for each payment service. Disable this to reduce response time if you don't need them.
35
+ */
36
+ includeFields?: boolean | undefined;
33
37
  /**
34
38
  * The ID of the merchant account to use for this request.
35
39
  */
@@ -46,6 +50,7 @@ export type ListPaymentServicesRequest$Outbound = {
46
50
  cursor?: string | null | undefined;
47
51
  limit: number;
48
52
  deleted?: boolean | null | undefined;
53
+ include_fields: boolean;
49
54
  merchantAccountId?: string | null | undefined;
50
55
  };
51
56
 
@@ -59,7 +64,12 @@ export const ListPaymentServicesRequest$outboundSchema: z.ZodType<
59
64
  cursor: z.nullable(z.string()).optional(),
60
65
  limit: z.number().int().default(20),
61
66
  deleted: z.nullable(z.boolean()).optional(),
67
+ includeFields: z.boolean().default(true),
62
68
  merchantAccountId: z.nullable(z.string()).optional(),
69
+ }).transform((v) => {
70
+ return remap$(v, {
71
+ includeFields: "include_fields",
72
+ });
63
73
  });
64
74
 
65
75
  export function listPaymentServicesRequestToJSON(
@@ -0,0 +1,72 @@
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 * as components from "../components/index.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type ListRolesRequest = {
13
+ /**
14
+ * A pointer to the page of results to return.
15
+ */
16
+ cursor?: string | null | undefined;
17
+ /**
18
+ * The maximum number of items that are returned.
19
+ */
20
+ limit?: number | undefined;
21
+ };
22
+
23
+ export type ListRolesResponse = {
24
+ result: components.CollectionRole;
25
+ };
26
+
27
+ /** @internal */
28
+ export type ListRolesRequest$Outbound = {
29
+ cursor?: string | null | undefined;
30
+ limit: number;
31
+ };
32
+
33
+ /** @internal */
34
+ export const ListRolesRequest$outboundSchema: z.ZodType<
35
+ ListRolesRequest$Outbound,
36
+ z.ZodTypeDef,
37
+ ListRolesRequest
38
+ > = z.object({
39
+ cursor: z.nullable(z.string()).optional(),
40
+ limit: z.number().int().default(20),
41
+ });
42
+
43
+ export function listRolesRequestToJSON(
44
+ listRolesRequest: ListRolesRequest,
45
+ ): string {
46
+ return JSON.stringify(
47
+ ListRolesRequest$outboundSchema.parse(listRolesRequest),
48
+ );
49
+ }
50
+
51
+ /** @internal */
52
+ export const ListRolesResponse$inboundSchema: z.ZodType<
53
+ ListRolesResponse,
54
+ z.ZodTypeDef,
55
+ unknown
56
+ > = z.object({
57
+ Result: components.CollectionRole$inboundSchema,
58
+ }).transform((v) => {
59
+ return remap$(v, {
60
+ "Result": "result",
61
+ });
62
+ });
63
+
64
+ export function listRolesResponseFromJSON(
65
+ jsonString: string,
66
+ ): SafeParseResult<ListRolesResponse, SDKValidationError> {
67
+ return safeParse(
68
+ jsonString,
69
+ (x) => ListRolesResponse$inboundSchema.parse(JSON.parse(x)),
70
+ `Failed to parse 'ListRolesResponse' from JSON`,
71
+ );
72
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { rolesList } from "../funcs/rolesList.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as operations from "../models/operations/index.js";
8
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
9
+
10
+ export class Roles extends ClientSDK {
11
+ /**
12
+ * List all roles
13
+ *
14
+ * @remarks
15
+ * List all roles available in the instance.
16
+ */
17
+ async list(
18
+ cursor?: string | null | undefined,
19
+ limit?: number | undefined,
20
+ options?: RequestOptions,
21
+ ): Promise<PageIterator<operations.ListRolesResponse, { cursor: string }>> {
22
+ return unwrapResultIterator(rolesList(
23
+ this,
24
+ cursor,
25
+ limit,
26
+ options,
27
+ ));
28
+ }
29
+ }
package/src/sdk/sdk.ts CHANGED
@@ -21,6 +21,7 @@ import { Payouts } from "./payouts.js";
21
21
  import { Refunds } from "./refunds.js";
22
22
  import { ReportExecutions } from "./reportexecutions.js";
23
23
  import { Reports } from "./reports.js";
24
+ import { Roles } from "./roles.js";
24
25
  import { ThreeDsScenarios } from "./threedsscenarios.js";
25
26
  import { Transactions } from "./transactions.js";
26
27
 
@@ -109,6 +110,11 @@ export class Gr4vy extends ClientSDK {
109
110
  return (this._checkoutSessions ??= new CheckoutSessions(this._options));
110
111
  }
111
112
 
113
+ private _roles?: Roles;
114
+ get roles(): Roles {
115
+ return (this._roles ??= new Roles(this._options));
116
+ }
117
+
112
118
  private _merchantAccounts?: MerchantAccounts;
113
119
  get merchantAccounts(): MerchantAccounts {
114
120
  return (this._merchantAccounts ??= new MerchantAccounts(this._options));