mollie-api-typescript 1.6.1 → 1.6.2

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 (69) hide show
  1. package/FUNCTIONS.md +6 -0
  2. package/README.md +30 -0
  3. package/dist/commonjs/funcs/oauthGenerate.d.ts +1 -1
  4. package/dist/commonjs/funcs/oauthGenerate.d.ts.map +1 -1
  5. package/dist/commonjs/funcs/oauthGenerate.js +4 -3
  6. package/dist/commonjs/funcs/oauthGenerate.js.map +1 -1
  7. package/dist/commonjs/lib/config.d.ts +2 -2
  8. package/dist/commonjs/lib/config.js +2 -2
  9. package/dist/commonjs/models/index.d.ts +2 -0
  10. package/dist/commonjs/models/index.d.ts.map +1 -1
  11. package/dist/commonjs/models/index.js +2 -0
  12. package/dist/commonjs/models/index.js.map +1 -1
  13. package/dist/commonjs/models/oauthgranttype.d.ts +10 -0
  14. package/dist/commonjs/models/oauthgranttype.d.ts.map +1 -0
  15. package/dist/commonjs/models/oauthgranttype.js +48 -0
  16. package/dist/commonjs/models/oauthgranttype.js.map +1 -0
  17. package/dist/commonjs/models/oauthtokentypehint.d.ts +10 -0
  18. package/dist/commonjs/models/oauthtokentypehint.d.ts.map +1 -0
  19. package/dist/commonjs/models/oauthtokentypehint.js +48 -0
  20. package/dist/commonjs/models/oauthtokentypehint.js.map +1 -0
  21. package/dist/commonjs/models/operations/oauthgeneratetokens.d.ts +11 -19
  22. package/dist/commonjs/models/operations/oauthgeneratetokens.d.ts.map +1 -1
  23. package/dist/commonjs/models/operations/oauthgeneratetokens.js +10 -9
  24. package/dist/commonjs/models/operations/oauthgeneratetokens.js.map +1 -1
  25. package/dist/commonjs/models/operations/oauthrevoketokens.d.ts +2 -8
  26. package/dist/commonjs/models/operations/oauthrevoketokens.d.ts.map +1 -1
  27. package/dist/commonjs/models/operations/oauthrevoketokens.js +2 -1
  28. package/dist/commonjs/models/operations/oauthrevoketokens.js.map +1 -1
  29. package/dist/commonjs/sdk/oauth.d.ts +1 -1
  30. package/dist/commonjs/sdk/oauth.d.ts.map +1 -1
  31. package/dist/esm/funcs/oauthGenerate.d.ts +1 -1
  32. package/dist/esm/funcs/oauthGenerate.d.ts.map +1 -1
  33. package/dist/esm/funcs/oauthGenerate.js +4 -3
  34. package/dist/esm/funcs/oauthGenerate.js.map +1 -1
  35. package/dist/esm/lib/config.d.ts +2 -2
  36. package/dist/esm/lib/config.js +2 -2
  37. package/dist/esm/models/index.d.ts +2 -0
  38. package/dist/esm/models/index.d.ts.map +1 -1
  39. package/dist/esm/models/index.js +2 -0
  40. package/dist/esm/models/index.js.map +1 -1
  41. package/dist/esm/models/oauthgranttype.d.ts +10 -0
  42. package/dist/esm/models/oauthgranttype.d.ts.map +1 -0
  43. package/dist/esm/models/oauthgranttype.js +12 -0
  44. package/dist/esm/models/oauthgranttype.js.map +1 -0
  45. package/dist/esm/models/oauthtokentypehint.d.ts +10 -0
  46. package/dist/esm/models/oauthtokentypehint.d.ts.map +1 -0
  47. package/dist/esm/models/oauthtokentypehint.js +12 -0
  48. package/dist/esm/models/oauthtokentypehint.js.map +1 -0
  49. package/dist/esm/models/operations/oauthgeneratetokens.d.ts +11 -19
  50. package/dist/esm/models/operations/oauthgeneratetokens.d.ts.map +1 -1
  51. package/dist/esm/models/operations/oauthgeneratetokens.js +8 -7
  52. package/dist/esm/models/operations/oauthgeneratetokens.js.map +1 -1
  53. package/dist/esm/models/operations/oauthrevoketokens.d.ts +2 -8
  54. package/dist/esm/models/operations/oauthrevoketokens.d.ts.map +1 -1
  55. package/dist/esm/models/operations/oauthrevoketokens.js +2 -1
  56. package/dist/esm/models/operations/oauthrevoketokens.js.map +1 -1
  57. package/dist/esm/sdk/oauth.d.ts +1 -1
  58. package/dist/esm/sdk/oauth.d.ts.map +1 -1
  59. package/examples/oauthGenerate.example.ts +6 -0
  60. package/jsr.json +1 -1
  61. package/package.json +1 -1
  62. package/src/funcs/oauthGenerate.ts +7 -6
  63. package/src/lib/config.ts +2 -2
  64. package/src/models/index.ts +2 -0
  65. package/src/models/oauthgranttype.ts +18 -0
  66. package/src/models/oauthtokentypehint.ts +18 -0
  67. package/src/models/operations/oauthgeneratetokens.ts +19 -27
  68. package/src/models/operations/oauthrevoketokens.ts +3 -9
  69. package/src/sdk/oauth.ts +1 -1
@@ -8,36 +8,28 @@ import { remap as remap$ } from "../../lib/primitives.js";
8
8
  import { safeParse } from "../../lib/schemas.js";
9
9
  import { Result as SafeParseResult } from "../../types/fp.js";
10
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import * as models from "../index.js";
11
12
 
12
13
  export const OauthGenerateTokensServerList = [
13
14
  "https://api.mollie.com/oauth2",
14
15
  ] as const;
15
16
 
16
17
  export type OauthGenerateTokensRequestBody = {
17
- /**
18
- * If you wish to exchange your authorization code for an app access token, use grant type
19
- *
20
- * @remarks
21
- * `authorization_code`. If you wish to renew your app access token with your refresh token, use grant type
22
- * `refresh_token`.
23
- *
24
- * Possible values: `authorization_code` `refresh_token`
25
- */
26
- grantType: string;
18
+ grantType: models.OauthGrantType;
27
19
  /**
28
20
  * The authorization code you received when creating the authorization. Only use this field when using
29
21
  *
30
22
  * @remarks
31
23
  * grant type `authorization_code`.
32
24
  */
33
- code?: string | null | undefined;
25
+ code?: string | undefined;
34
26
  /**
35
27
  * The refresh token you received when creating the authorization. Only use this field when using grant
36
28
  *
37
29
  * @remarks
38
30
  * type `refresh_token`.
39
31
  */
40
- refreshToken?: string | null | undefined;
32
+ refreshToken?: string | undefined;
41
33
  /**
42
34
  * The URL the merchant is sent back to once the request has been authorized. It must match the URL you set
43
35
  *
@@ -47,7 +39,7 @@ export type OauthGenerateTokensRequestBody = {
47
39
  * For consecutive refresh token requests, this parameter is required only if the initial authorization
48
40
  * code grant request also contained a `redirect_uri`.
49
41
  */
50
- redirectUri?: string | null | undefined;
42
+ redirectUri?: string | undefined;
51
43
  };
52
44
 
53
45
  export type OauthGenerateTokensRequest = {
@@ -61,7 +53,7 @@ export type OauthGenerateTokensRequest = {
61
53
  /**
62
54
  * The newly generated access token and refresh token.
63
55
  */
64
- export type OauthGenerateTokensResponseBody = {
56
+ export type OauthGenerateTokensResponse = {
65
57
  /**
66
58
  * The app access token, with which you will be able to access the Mollie API on the merchant's behalf.
67
59
  */
@@ -97,9 +89,9 @@ export type OauthGenerateTokensResponseBody = {
97
89
  /** @internal */
98
90
  export type OauthGenerateTokensRequestBody$Outbound = {
99
91
  grant_type: string;
100
- code?: string | null | undefined;
101
- refresh_token?: string | null | undefined;
102
- redirect_uri?: string | null | undefined;
92
+ code?: string | undefined;
93
+ refresh_token?: string | undefined;
94
+ redirect_uri?: string | undefined;
103
95
  };
104
96
 
105
97
  /** @internal */
@@ -108,10 +100,10 @@ export const OauthGenerateTokensRequestBody$outboundSchema: z.ZodType<
108
100
  z.ZodTypeDef,
109
101
  OauthGenerateTokensRequestBody
110
102
  > = z.object({
111
- grantType: z.string(),
112
- code: z.nullable(z.string()).optional(),
113
- refreshToken: z.nullable(z.string()).optional(),
114
- redirectUri: z.nullable(z.string()).optional(),
103
+ grantType: models.OauthGrantType$outboundSchema,
104
+ code: z.string().optional(),
105
+ refreshToken: z.string().optional(),
106
+ redirectUri: z.string().optional(),
115
107
  }).transform((v) => {
116
108
  return remap$(v, {
117
109
  grantType: "grant_type",
@@ -161,8 +153,8 @@ export function oauthGenerateTokensRequestToJSON(
161
153
  }
162
154
 
163
155
  /** @internal */
164
- export const OauthGenerateTokensResponseBody$inboundSchema: z.ZodType<
165
- OauthGenerateTokensResponseBody,
156
+ export const OauthGenerateTokensResponse$inboundSchema: z.ZodType<
157
+ OauthGenerateTokensResponse,
166
158
  z.ZodTypeDef,
167
159
  unknown
168
160
  > = z.object({
@@ -180,12 +172,12 @@ export const OauthGenerateTokensResponseBody$inboundSchema: z.ZodType<
180
172
  });
181
173
  });
182
174
 
183
- export function oauthGenerateTokensResponseBodyFromJSON(
175
+ export function oauthGenerateTokensResponseFromJSON(
184
176
  jsonString: string,
185
- ): SafeParseResult<OauthGenerateTokensResponseBody, SDKValidationError> {
177
+ ): SafeParseResult<OauthGenerateTokensResponse, SDKValidationError> {
186
178
  return safeParse(
187
179
  jsonString,
188
- (x) => OauthGenerateTokensResponseBody$inboundSchema.parse(JSON.parse(x)),
189
- `Failed to parse 'OauthGenerateTokensResponseBody' from JSON`,
180
+ (x) => OauthGenerateTokensResponse$inboundSchema.parse(JSON.parse(x)),
181
+ `Failed to parse 'OauthGenerateTokensResponse' from JSON`,
190
182
  );
191
183
  }
@@ -5,20 +5,14 @@
5
5
 
6
6
  import * as z from "zod/v3";
7
7
  import { remap as remap$ } from "../../lib/primitives.js";
8
+ import * as models from "../index.js";
8
9
 
9
10
  export const OauthRevokeTokensServerList = [
10
11
  "https://api.mollie.com/oauth2",
11
12
  ] as const;
12
13
 
13
14
  export type OauthRevokeTokensRequestBody = {
14
- /**
15
- * The type of token you want to revoke.
16
- *
17
- * @remarks
18
- *
19
- * Possible values: `access_token` `refresh_token`
20
- */
21
- tokenTypeHint: string;
15
+ tokenTypeHint: models.OauthTokenTypeHint;
22
16
  /**
23
17
  * The token you want to revoke.
24
18
  */
@@ -45,7 +39,7 @@ export const OauthRevokeTokensRequestBody$outboundSchema: z.ZodType<
45
39
  z.ZodTypeDef,
46
40
  OauthRevokeTokensRequestBody
47
41
  > = z.object({
48
- tokenTypeHint: z.string(),
42
+ tokenTypeHint: models.OauthTokenTypeHint$outboundSchema,
49
43
  token: z.string(),
50
44
  }).transform((v) => {
51
45
  return remap$(v, {
package/src/sdk/oauth.ts CHANGED
@@ -22,7 +22,7 @@ export class Oauth extends ClientSDK {
22
22
  async generate(
23
23
  request?: operations.OauthGenerateTokensRequest | undefined,
24
24
  options?: RequestOptions,
25
- ): Promise<Uint8Array> {
25
+ ): Promise<operations.OauthGenerateTokensResponse> {
26
26
  return unwrapAsync(oauthGenerate(
27
27
  this,
28
28
  request,