@gbg/go-core 0.0.1-alpha.25 → 0.0.1-alpha.26

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 (105) hide show
  1. package/FUNCTIONS.md +1 -7
  2. package/README.md +14 -43
  3. package/dist/commonjs/funcs/tokens-generate.d.ts +2 -2
  4. package/dist/commonjs/funcs/tokens-generate.d.ts.map +1 -1
  5. package/dist/commonjs/funcs/tokens-generate.js +7 -9
  6. package/dist/commonjs/funcs/tokens-generate.js.map +1 -1
  7. package/dist/commonjs/hooks/registration.js +4 -4
  8. package/dist/commonjs/hooks/registration.js.map +1 -1
  9. package/dist/commonjs/hooks/x-gbg-source.d.ts +36 -0
  10. package/dist/commonjs/hooks/x-gbg-source.d.ts.map +1 -0
  11. package/dist/commonjs/hooks/x-gbg-source.js +41 -0
  12. package/dist/commonjs/hooks/x-gbg-source.js.map +1 -0
  13. package/dist/commonjs/lib/config.d.ts +3 -3
  14. package/dist/commonjs/lib/config.js +3 -3
  15. package/dist/commonjs/models/client-credentials-grant-request.d.ts +25 -0
  16. package/dist/commonjs/models/client-credentials-grant-request.d.ts.map +1 -0
  17. package/dist/commonjs/models/client-credentials-grant-request.js +58 -0
  18. package/dist/commonjs/models/client-credentials-grant-request.js.map +1 -0
  19. package/dist/commonjs/models/index.d.ts +2 -0
  20. package/dist/commonjs/models/index.d.ts.map +1 -1
  21. package/dist/commonjs/models/index.js +2 -0
  22. package/dist/commonjs/models/index.js.map +1 -1
  23. package/dist/commonjs/models/operations/fetch-interaction.d.ts +41 -12
  24. package/dist/commonjs/models/operations/fetch-interaction.d.ts.map +1 -1
  25. package/dist/commonjs/models/operations/fetch-interaction.js +45 -16
  26. package/dist/commonjs/models/operations/fetch-interaction.js.map +1 -1
  27. package/dist/commonjs/models/operations/index.d.ts +1 -1
  28. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  29. package/dist/commonjs/models/operations/index.js +1 -1
  30. package/dist/commonjs/models/operations/index.js.map +1 -1
  31. package/dist/commonjs/models/operations/post-as-token-oauth2.d.ts +32 -0
  32. package/dist/commonjs/models/operations/post-as-token-oauth2.d.ts.map +1 -0
  33. package/dist/commonjs/models/operations/{post-auth-realms-go-protocol-openid-connect-token.js → post-as-token-oauth2.js} +16 -35
  34. package/dist/commonjs/models/operations/post-as-token-oauth2.js.map +1 -0
  35. package/dist/commonjs/models/password-grant-request.d.ts +35 -0
  36. package/dist/commonjs/models/password-grant-request.d.ts.map +1 -0
  37. package/dist/commonjs/models/password-grant-request.js +60 -0
  38. package/dist/commonjs/models/password-grant-request.js.map +1 -0
  39. package/dist/commonjs/sdk/tokens.d.ts +2 -2
  40. package/dist/commonjs/sdk/tokens.d.ts.map +1 -1
  41. package/dist/commonjs/sdk/tokens.js +1 -1
  42. package/dist/commonjs/sdk/tokens.js.map +1 -1
  43. package/dist/esm/funcs/tokens-generate.d.ts +2 -2
  44. package/dist/esm/funcs/tokens-generate.d.ts.map +1 -1
  45. package/dist/esm/funcs/tokens-generate.js +7 -9
  46. package/dist/esm/funcs/tokens-generate.js.map +1 -1
  47. package/dist/esm/hooks/registration.js +4 -4
  48. package/dist/esm/hooks/registration.js.map +1 -1
  49. package/dist/esm/hooks/x-gbg-source.d.ts +36 -0
  50. package/dist/esm/hooks/x-gbg-source.d.ts.map +1 -0
  51. package/dist/esm/hooks/x-gbg-source.js +37 -0
  52. package/dist/esm/hooks/x-gbg-source.js.map +1 -0
  53. package/dist/esm/lib/config.d.ts +3 -3
  54. package/dist/esm/lib/config.js +3 -3
  55. package/dist/esm/models/client-credentials-grant-request.d.ts +25 -0
  56. package/dist/esm/models/client-credentials-grant-request.d.ts.map +1 -0
  57. package/dist/esm/models/client-credentials-grant-request.js +21 -0
  58. package/dist/esm/models/client-credentials-grant-request.js.map +1 -0
  59. package/dist/esm/models/index.d.ts +2 -0
  60. package/dist/esm/models/index.d.ts.map +1 -1
  61. package/dist/esm/models/index.js +2 -0
  62. package/dist/esm/models/index.js.map +1 -1
  63. package/dist/esm/models/operations/fetch-interaction.d.ts +41 -12
  64. package/dist/esm/models/operations/fetch-interaction.d.ts.map +1 -1
  65. package/dist/esm/models/operations/fetch-interaction.js +38 -11
  66. package/dist/esm/models/operations/fetch-interaction.js.map +1 -1
  67. package/dist/esm/models/operations/index.d.ts +1 -1
  68. package/dist/esm/models/operations/index.d.ts.map +1 -1
  69. package/dist/esm/models/operations/index.js +1 -1
  70. package/dist/esm/models/operations/index.js.map +1 -1
  71. package/dist/esm/models/operations/post-as-token-oauth2.d.ts +32 -0
  72. package/dist/esm/models/operations/post-as-token-oauth2.d.ts.map +1 -0
  73. package/dist/esm/models/operations/post-as-token-oauth2.js +35 -0
  74. package/dist/esm/models/operations/post-as-token-oauth2.js.map +1 -0
  75. package/dist/esm/models/password-grant-request.d.ts +35 -0
  76. package/dist/esm/models/password-grant-request.d.ts.map +1 -0
  77. package/dist/esm/models/password-grant-request.js +23 -0
  78. package/dist/esm/models/password-grant-request.js.map +1 -0
  79. package/dist/esm/sdk/tokens.d.ts +2 -2
  80. package/dist/esm/sdk/tokens.d.ts.map +1 -1
  81. package/dist/esm/sdk/tokens.js +1 -1
  82. package/dist/esm/sdk/tokens.js.map +1 -1
  83. package/examples/tokensGenerate.example.ts +1 -7
  84. package/jsr.json +1 -1
  85. package/package.json +1 -1
  86. package/src/__tests__/x-gbg-source.test.mjs +59 -0
  87. package/src/funcs/tokens-generate.ts +12 -23
  88. package/src/hooks/registration.ts +4 -4
  89. package/src/hooks/x-gbg-source.ts +70 -0
  90. package/src/lib/config.ts +3 -3
  91. package/src/models/client-credentials-grant-request.ts +57 -0
  92. package/src/models/index.ts +2 -0
  93. package/src/models/operations/fetch-interaction.ts +105 -34
  94. package/src/models/operations/index.ts +1 -1
  95. package/src/models/operations/post-as-token-oauth2.ts +88 -0
  96. package/src/models/password-grant-request.ts +67 -0
  97. package/src/sdk/tokens.ts +3 -5
  98. package/dist/commonjs/models/operations/post-auth-realms-go-protocol-openid-connect-token.d.ts +0 -71
  99. package/dist/commonjs/models/operations/post-auth-realms-go-protocol-openid-connect-token.d.ts.map +0 -1
  100. package/dist/commonjs/models/operations/post-auth-realms-go-protocol-openid-connect-token.js.map +0 -1
  101. package/dist/esm/models/operations/post-auth-realms-go-protocol-openid-connect-token.d.ts +0 -71
  102. package/dist/esm/models/operations/post-auth-realms-go-protocol-openid-connect-token.d.ts.map +0 -1
  103. package/dist/esm/models/operations/post-auth-realms-go-protocol-openid-connect-token.js +0 -54
  104. package/dist/esm/models/operations/post-auth-realms-go-protocol-openid-connect-token.js.map +0 -1
  105. package/src/models/operations/post-auth-realms-go-protocol-openid-connect-token.ts +0 -150
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@gbg/go-core",
5
- "version": "0.0.1-alpha.25",
5
+ "version": "0.0.1-alpha.26",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbg/go-core",
3
- "version": "0.0.1-alpha.25",
3
+ "version": "0.0.1-alpha.26",
4
4
  "author": "Speakeasy",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Tests for GbgSourceHook (GGO-16030 / issue #34). Not managed by Speakeasy.
3
+ *
4
+ * The SDK source uses `.js` import specifiers for `.ts` files, so tests run
5
+ * against the built output rather than source. This lives in `src/__tests__`,
6
+ * which tsconfig excludes from the build/publish.
7
+ *
8
+ * npm run build
9
+ * node --test src/__tests__/x-gbg-source.test.mjs
10
+ */
11
+
12
+ import assert from "node:assert/strict";
13
+ import { test } from "node:test";
14
+
15
+ import { SDK_METADATA } from "../../dist/esm/lib/config.js";
16
+ import {
17
+ GbgSourceHook,
18
+ X_GBG_SOURCE_HEADER,
19
+ } from "../../dist/esm/hooks/x-gbg-source.js";
20
+
21
+ const hook = new GbgSourceHook();
22
+
23
+ const ctx = (options = {}) => ({ options });
24
+ const input = (headers) => ({
25
+ url: new URL("https://example.com/journey/start"),
26
+ options: { headers },
27
+ });
28
+ const headerOf = (result) =>
29
+ new Headers(result.options?.headers).get(X_GBG_SOURCE_HEADER);
30
+
31
+ test("defaults to the SDK user-agent when no source is configured", () => {
32
+ assert.equal(headerOf(hook.beforeCreateRequest(ctx(), input())),
33
+ SDK_METADATA.userAgent);
34
+ });
35
+
36
+ test("uses the client-creation `source` option when provided", () => {
37
+ assert.equal(
38
+ headerOf(hook.beforeCreateRequest(ctx({ source: "acme-portal" }), input())),
39
+ "acme-portal",
40
+ );
41
+ });
42
+
43
+ test("a per-request X-GBG-Source header wins over the client option", () => {
44
+ const result = hook.beforeCreateRequest(
45
+ ctx({ source: "acme-portal" }),
46
+ input({ [X_GBG_SOURCE_HEADER]: "checkout-v3" }),
47
+ );
48
+ assert.equal(headerOf(result), "checkout-v3");
49
+ });
50
+
51
+ test("preserves other headers already on the request", () => {
52
+ const result = hook.beforeCreateRequest(
53
+ ctx(),
54
+ input({ "Content-Type": "application/json" }),
55
+ );
56
+ const headers = new Headers(result.options?.headers);
57
+ assert.equal(headers.get("Content-Type"), "application/json");
58
+ assert.equal(headers.get(X_GBG_SOURCE_HEADER), SDK_METADATA.userAgent);
59
+ });
@@ -22,7 +22,7 @@ import {
22
22
  import { ResponseValidationError } from "../models/errors/response-validation-error.js";
23
23
  import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
24
24
  import * as operations from "../models/operations/index.js";
25
- import { PostAuthRealmsGoProtocolOpenidConnectTokenServerList } from "../models/operations/post-auth-realms-go-protocol-openid-connect-token.js";
25
+ import { PostAsTokenOauth2ServerList } from "../models/operations/post-as-token-oauth2.js";
26
26
  import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
28
 
@@ -30,17 +30,15 @@ import { Result } from "../types/fp.js";
30
30
  * Generate access token
31
31
  *
32
32
  * @remarks
33
- * Get an access token to authenticate API requests. If you're unfamiliar with the authentication process, check out the [authentication guide](/docs/developer-integration/execute-customer-journeys/authenticate) for more details.
33
+ * Get an access token to authenticate API requests. If you're unfamiliar with the authentication process, check out the [authentication guide](/docs/go-v2/developer-integration/execute-customer-journeys/authenticate) for more details.
34
34
  */
35
35
  export function tokensGenerate(
36
36
  client: GoCore,
37
- request?:
38
- | operations.PostAuthRealmsGoProtocolOpenidConnectTokenRequest
39
- | undefined,
37
+ request?: operations.PostAsTokenOauth2Request | undefined,
40
38
  options?: RequestOptions,
41
39
  ): APIPromise<
42
40
  Result<
43
- operations.PostAuthRealmsGoProtocolOpenidConnectTokenResponse,
41
+ operations.PostAsTokenOauth2Response,
44
42
  | GoError
45
43
  | ResponseValidationError
46
44
  | ConnectionError
@@ -60,14 +58,12 @@ export function tokensGenerate(
60
58
 
61
59
  async function $do(
62
60
  client: GoCore,
63
- request?:
64
- | operations.PostAuthRealmsGoProtocolOpenidConnectTokenRequest
65
- | undefined,
61
+ request?: operations.PostAsTokenOauth2Request | undefined,
66
62
  options?: RequestOptions,
67
63
  ): Promise<
68
64
  [
69
65
  Result<
70
- operations.PostAuthRealmsGoProtocolOpenidConnectTokenResponse,
66
+ operations.PostAsTokenOauth2Response,
71
67
  | GoError
72
68
  | ResponseValidationError
73
69
  | ConnectionError
@@ -84,10 +80,7 @@ async function $do(
84
80
  request,
85
81
  (value) =>
86
82
  z.parse(
87
- z.optional(
88
- operations
89
- .PostAuthRealmsGoProtocolOpenidConnectTokenRequest$outboundSchema,
90
- ),
83
+ z.optional(operations.PostAsTokenOauth2Request$outboundSchema),
91
84
  value,
92
85
  ),
93
86
  "Input validation failed",
@@ -102,11 +95,11 @@ async function $do(
102
95
  }).join("&");
103
96
 
104
97
  const baseURL = options?.serverURL
105
- || pathToFunc(PostAuthRealmsGoProtocolOpenidConnectTokenServerList[0], {
98
+ || pathToFunc(PostAsTokenOauth2ServerList[0], {
106
99
  charEncoding: "percent",
107
100
  })();
108
101
 
109
- const path = pathToFunc("/auth/realms/go/protocol/openid-connect/token")();
102
+ const path = pathToFunc("/as/token.oauth2")();
110
103
 
111
104
  const headers = new Headers(compactMap({
112
105
  "Content-Type": "application/x-www-form-urlencoded",
@@ -116,7 +109,7 @@ async function $do(
116
109
  const context = {
117
110
  options: client._options,
118
111
  baseURL: baseURL ?? "",
119
- operationID: "post_/auth/realms/go/protocol/openid-connect/token",
112
+ operationID: "post_/as/token.oauth2",
120
113
  oAuth2Scopes: null,
121
114
 
122
115
  resolvedSecurity: null,
@@ -155,7 +148,7 @@ async function $do(
155
148
  const response = doResult.value;
156
149
 
157
150
  const [result] = await M.match<
158
- operations.PostAuthRealmsGoProtocolOpenidConnectTokenResponse,
151
+ operations.PostAsTokenOauth2Response,
159
152
  | GoError
160
153
  | ResponseValidationError
161
154
  | ConnectionError
@@ -165,11 +158,7 @@ async function $do(
165
158
  | UnexpectedClientError
166
159
  | SDKValidationError
167
160
  >(
168
- M.json(
169
- 200,
170
- operations
171
- .PostAuthRealmsGoProtocolOpenidConnectTokenResponse$inboundSchema,
172
- ),
161
+ M.json(200, operations.PostAsTokenOauth2Response$inboundSchema),
173
162
  M.fail([400, 401, "4XX"]),
174
163
  M.fail("5XX"),
175
164
  )(response, req);
@@ -1,4 +1,5 @@
1
1
  import { Hooks } from "./types.js";
2
+ import { GbgSourceHook } from "./x-gbg-source.js";
2
3
 
3
4
  /*
4
5
  * This file is only ever generated once on the first generation and then is free to be modified.
@@ -6,9 +7,8 @@ import { Hooks } from "./types.js";
6
7
  * in this file or in separate files in the hooks folder.
7
8
  */
8
9
 
9
- // @ts-expect-error remove this line when you add your first hook and hooks is used
10
10
  export function initHooks(hooks: Hooks) {
11
- // Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
12
- // with an instance of a hook that implements that specific Hook interface
13
- // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
11
+ // Stamp an X-GBG-Source usage-tracking header on every outgoing request.
12
+ // See ./x-gbg-source.ts (GGO-16030 / issue #34).
13
+ hooks.registerBeforeCreateRequestHook(new GbgSourceHook());
14
14
  }
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Custom hook: stamps an `X-GBG-Source` usage-tracking header on every
3
+ * outgoing request.
4
+ *
5
+ * This file is NOT managed by Speakeasy — it is not tracked in
6
+ * `.speakeasy/gen.lock`, and it is imported from `registration.ts` which
7
+ * Speakeasy generates only once. Both therefore survive the weekly forced SDK
8
+ * regeneration. Do not move this logic into generated files (`config.ts`,
9
+ * `sdks.ts`, `index.ts`, `package.json`): those are overwritten on regen.
10
+ *
11
+ * See GGO-16030 / GitHub issue #34.
12
+ */
13
+
14
+ import { SDK_METADATA, SDKOptions } from "../lib/config.js";
15
+ import { RequestInput } from "../lib/http.js";
16
+ import {
17
+ BeforeCreateRequestContext,
18
+ BeforeCreateRequestHook,
19
+ } from "./types.js";
20
+
21
+ /** The usage-tracking header sent on every request. */
22
+ export const X_GBG_SOURCE_HEADER = "X-GBG-Source";
23
+
24
+ /**
25
+ * SDK options extended with the optional `source` override. Use this to get
26
+ * type-safety for the client-creation override without depending on the
27
+ * regenerated `SDKOptions` declaration:
28
+ *
29
+ * ```ts
30
+ * import { Go } from "@gbg/go-core";
31
+ * import type { GoOptions } from "@gbg/go-core/hooks/x-gbg-source";
32
+ *
33
+ * const sdk = new Go({ source: "acme-portal" } satisfies GoOptions);
34
+ * ```
35
+ */
36
+ export type GoOptions = SDKOptions & {
37
+ /**
38
+ * Value sent in the `X-GBG-Source` header on every request, identifying the
39
+ * integration making the call. Defaults to the SDK's user-agent string. Can
40
+ * also be overridden per-request via `RequestOptions.headers`.
41
+ */
42
+ source?: string | undefined;
43
+ };
44
+
45
+ /**
46
+ * Sets the `X-GBG-Source` header on every request. Precedence, highest first:
47
+ *
48
+ * 1. a per-request header (set via `RequestOptions.headers`) — left untouched
49
+ * 2. the client-creation `source` option
50
+ * 3. the SDK user-agent string (auto-tracks the SDK version)
51
+ */
52
+ export class GbgSourceHook implements BeforeCreateRequestHook {
53
+ beforeCreateRequest(
54
+ hookCtx: BeforeCreateRequestContext,
55
+ input: RequestInput,
56
+ ): RequestInput {
57
+ const options = input.options ?? {};
58
+ const headers = new Headers(options.headers);
59
+
60
+ // Respect a per-request override if one was already set on the request.
61
+ if (!headers.has(X_GBG_SOURCE_HEADER)) {
62
+ const source = (hookCtx.options as GoOptions).source;
63
+ headers.set(X_GBG_SOURCE_HEADER, source ?? SDK_METADATA.userAgent);
64
+ }
65
+
66
+ options.headers = headers;
67
+ input.options = options;
68
+ return input;
69
+ }
70
+ }
package/src/lib/config.ts CHANGED
@@ -60,8 +60,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
60
60
  export const SDK_METADATA = {
61
61
  language: "typescript",
62
62
  openapiDocVersion: "1.0.0",
63
- sdkVersion: "0.0.1-alpha.25",
64
- genVersion: "2.907.0",
63
+ sdkVersion: "0.0.1-alpha.26",
64
+ genVersion: "2.915.1",
65
65
  userAgent:
66
- "speakeasy-sdk/typescript 0.0.1-alpha.25 2.907.0 1.0.0 @gbg/go-core",
66
+ "speakeasy-sdk/typescript 0.0.1-alpha.26 2.915.1 1.0.0 @gbg/go-core",
67
67
  } as const;
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+
8
+ export type ClientCredentialsGrantRequest = {
9
+ /**
10
+ * The client ID assigned to your organization.
11
+ */
12
+ clientId: string;
13
+ /**
14
+ * The client secret assigned to your organization.
15
+ */
16
+ clientSecret: string;
17
+ /**
18
+ * Must always be set to 'client_credentials'.
19
+ */
20
+ grantType: "client_credentials";
21
+ };
22
+
23
+ /** @internal */
24
+ export type ClientCredentialsGrantRequest$Outbound = {
25
+ client_id: string;
26
+ client_secret: string;
27
+ grant_type: "client_credentials";
28
+ };
29
+
30
+ /** @internal */
31
+ export const ClientCredentialsGrantRequest$outboundSchema: z.ZodMiniType<
32
+ ClientCredentialsGrantRequest$Outbound,
33
+ ClientCredentialsGrantRequest
34
+ > = z.pipe(
35
+ z.object({
36
+ clientId: z.string(),
37
+ clientSecret: z.string(),
38
+ grantType: z.literal("client_credentials"),
39
+ }),
40
+ z.transform((v) => {
41
+ return remap$(v, {
42
+ clientId: "client_id",
43
+ clientSecret: "client_secret",
44
+ grantType: "grant_type",
45
+ });
46
+ }),
47
+ );
48
+
49
+ export function clientCredentialsGrantRequestToJSON(
50
+ clientCredentialsGrantRequest: ClientCredentialsGrantRequest,
51
+ ): string {
52
+ return JSON.stringify(
53
+ ClientCredentialsGrantRequest$outboundSchema.parse(
54
+ clientCredentialsGrantRequest,
55
+ ),
56
+ );
57
+ }
@@ -2,4 +2,6 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ export * from "./client-credentials-grant-request.js";
6
+ export * from "./password-grant-request.js";
5
7
  export * from "./security.js";
@@ -23,6 +23,30 @@ export type FetchInteractionRequest = {
23
23
  instanceId: string;
24
24
  };
25
25
 
26
+ export const JourneyStatus2 = {
27
+ Completed: "Completed",
28
+ InProgress: "InProgress",
29
+ Failed: "Failed",
30
+ Paused: "Paused",
31
+ } as const;
32
+ export type JourneyStatus2 = OpenEnum<typeof JourneyStatus2>;
33
+
34
+ export type Journey2 = {
35
+ status: JourneyStatus2;
36
+ };
37
+
38
+ export type ResponseBody2 = {
39
+ /**
40
+ * Journey instance identifier
41
+ */
42
+ instanceId: string;
43
+ journey: Journey2;
44
+ /**
45
+ * True when the journey is still working and no interaction is available yet. Clients should poll /journey/interaction/fetch until this is absent/false and an `interaction` is returned.
46
+ */
47
+ processing: boolean;
48
+ };
49
+
26
50
  export const FetchInteractionStatusError = {
27
51
  Error: "error",
28
52
  } as const;
@@ -42,16 +66,16 @@ export type FetchInteractionError = {
42
66
  message: string;
43
67
  };
44
68
 
45
- export const JourneyStatus = {
69
+ export const JourneyStatus1 = {
46
70
  Completed: "Completed",
47
71
  InProgress: "InProgress",
48
72
  Failed: "Failed",
49
73
  Paused: "Paused",
50
74
  } as const;
51
- export type JourneyStatus = OpenEnum<typeof JourneyStatus>;
75
+ export type JourneyStatus1 = OpenEnum<typeof JourneyStatus1>;
52
76
 
53
- export type Journey = {
54
- status: JourneyStatus;
77
+ export type Journey1 = {
78
+ status: JourneyStatus1;
55
79
  };
56
80
 
57
81
  export const ResourceType = {
@@ -1444,7 +1468,7 @@ export type FetchInteractionContext = {
1444
1468
  subject?: FetchInteractionSubject | undefined;
1445
1469
  };
1446
1470
 
1447
- export type ResponseBody = {
1471
+ export type ResponseBody1 = {
1448
1472
  /**
1449
1473
  * Journey instance identifier
1450
1474
  */
@@ -1453,7 +1477,7 @@ export type ResponseBody = {
1453
1477
  * Interaction identifier
1454
1478
  */
1455
1479
  interactionId: string;
1456
- journey: Journey;
1480
+ journey: Journey1;
1457
1481
  interaction: Interaction;
1458
1482
  context?: FetchInteractionContext | undefined;
1459
1483
  instructions?: Array<string> | undefined;
@@ -1463,7 +1487,10 @@ export type ResponseBody = {
1463
1487
  /**
1464
1488
  * Success
1465
1489
  */
1466
- export type FetchInteractionResponse = ResponseBody | FetchInteractionError;
1490
+ export type FetchInteractionResponse =
1491
+ | ResponseBody1
1492
+ | FetchInteractionError
1493
+ | ResponseBody2;
1467
1494
 
1468
1495
  /** @internal */
1469
1496
  export type FetchInteractionSecurity$Outbound = {
@@ -1514,6 +1541,48 @@ export function fetchInteractionRequestToJSON(
1514
1541
  );
1515
1542
  }
1516
1543
 
1544
+ /** @internal */
1545
+ export const JourneyStatus2$inboundSchema: z.ZodMiniType<
1546
+ JourneyStatus2,
1547
+ unknown
1548
+ > = openEnums.inboundSchema(JourneyStatus2);
1549
+
1550
+ /** @internal */
1551
+ export const Journey2$inboundSchema: z.ZodMiniType<Journey2, unknown> = z
1552
+ .object({
1553
+ status: JourneyStatus2$inboundSchema,
1554
+ });
1555
+
1556
+ export function journey2FromJSON(
1557
+ jsonString: string,
1558
+ ): SafeParseResult<Journey2, SDKValidationError> {
1559
+ return safeParse(
1560
+ jsonString,
1561
+ (x) => Journey2$inboundSchema.parse(JSON.parse(x)),
1562
+ `Failed to parse 'Journey2' from JSON`,
1563
+ );
1564
+ }
1565
+
1566
+ /** @internal */
1567
+ export const ResponseBody2$inboundSchema: z.ZodMiniType<
1568
+ ResponseBody2,
1569
+ unknown
1570
+ > = z.object({
1571
+ instanceId: types.string(),
1572
+ journey: z.lazy(() => Journey2$inboundSchema),
1573
+ processing: types.boolean(),
1574
+ });
1575
+
1576
+ export function responseBody2FromJSON(
1577
+ jsonString: string,
1578
+ ): SafeParseResult<ResponseBody2, SDKValidationError> {
1579
+ return safeParse(
1580
+ jsonString,
1581
+ (x) => ResponseBody2$inboundSchema.parse(JSON.parse(x)),
1582
+ `Failed to parse 'ResponseBody2' from JSON`,
1583
+ );
1584
+ }
1585
+
1517
1586
  /** @internal */
1518
1587
  export const FetchInteractionStatusError$inboundSchema: z.ZodMiniEnum<
1519
1588
  typeof FetchInteractionStatusError
@@ -1540,23 +1609,24 @@ export function fetchInteractionErrorFromJSON(
1540
1609
  }
1541
1610
 
1542
1611
  /** @internal */
1543
- export const JourneyStatus$inboundSchema: z.ZodMiniType<
1544
- JourneyStatus,
1612
+ export const JourneyStatus1$inboundSchema: z.ZodMiniType<
1613
+ JourneyStatus1,
1545
1614
  unknown
1546
- > = openEnums.inboundSchema(JourneyStatus);
1615
+ > = openEnums.inboundSchema(JourneyStatus1);
1547
1616
 
1548
1617
  /** @internal */
1549
- export const Journey$inboundSchema: z.ZodMiniType<Journey, unknown> = z.object({
1550
- status: JourneyStatus$inboundSchema,
1551
- });
1618
+ export const Journey1$inboundSchema: z.ZodMiniType<Journey1, unknown> = z
1619
+ .object({
1620
+ status: JourneyStatus1$inboundSchema,
1621
+ });
1552
1622
 
1553
- export function journeyFromJSON(
1623
+ export function journey1FromJSON(
1554
1624
  jsonString: string,
1555
- ): SafeParseResult<Journey, SDKValidationError> {
1625
+ ): SafeParseResult<Journey1, SDKValidationError> {
1556
1626
  return safeParse(
1557
1627
  jsonString,
1558
- (x) => Journey$inboundSchema.parse(JSON.parse(x)),
1559
- `Failed to parse 'Journey' from JSON`,
1628
+ (x) => Journey1$inboundSchema.parse(JSON.parse(x)),
1629
+ `Failed to parse 'Journey1' from JSON`,
1560
1630
  );
1561
1631
  }
1562
1632
 
@@ -3740,26 +3810,26 @@ export function fetchInteractionContextFromJSON(
3740
3810
  }
3741
3811
 
3742
3812
  /** @internal */
3743
- export const ResponseBody$inboundSchema: z.ZodMiniType<ResponseBody, unknown> =
3744
- z.object({
3745
- instanceId: types.string(),
3746
- interactionId: types.string(),
3747
- journey: z.lazy(() => Journey$inboundSchema),
3748
- interaction: z.lazy(() => Interaction$inboundSchema),
3749
- context: types.optional(
3750
- z.lazy(() => FetchInteractionContext$inboundSchema),
3751
- ),
3752
- instructions: types.optional(z.array(types.string())),
3753
- outstanding: types.optional(z.array(types.string())),
3754
- });
3813
+ export const ResponseBody1$inboundSchema: z.ZodMiniType<
3814
+ ResponseBody1,
3815
+ unknown
3816
+ > = z.object({
3817
+ instanceId: types.string(),
3818
+ interactionId: types.string(),
3819
+ journey: z.lazy(() => Journey1$inboundSchema),
3820
+ interaction: z.lazy(() => Interaction$inboundSchema),
3821
+ context: types.optional(z.lazy(() => FetchInteractionContext$inboundSchema)),
3822
+ instructions: types.optional(z.array(types.string())),
3823
+ outstanding: types.optional(z.array(types.string())),
3824
+ });
3755
3825
 
3756
- export function responseBodyFromJSON(
3826
+ export function responseBody1FromJSON(
3757
3827
  jsonString: string,
3758
- ): SafeParseResult<ResponseBody, SDKValidationError> {
3828
+ ): SafeParseResult<ResponseBody1, SDKValidationError> {
3759
3829
  return safeParse(
3760
3830
  jsonString,
3761
- (x) => ResponseBody$inboundSchema.parse(JSON.parse(x)),
3762
- `Failed to parse 'ResponseBody' from JSON`,
3831
+ (x) => ResponseBody1$inboundSchema.parse(JSON.parse(x)),
3832
+ `Failed to parse 'ResponseBody1' from JSON`,
3763
3833
  );
3764
3834
  }
3765
3835
 
@@ -3768,8 +3838,9 @@ export const FetchInteractionResponse$inboundSchema: z.ZodMiniType<
3768
3838
  FetchInteractionResponse,
3769
3839
  unknown
3770
3840
  > = smartUnion([
3771
- z.lazy(() => ResponseBody$inboundSchema),
3841
+ z.lazy(() => ResponseBody1$inboundSchema),
3772
3842
  z.lazy(() => FetchInteractionError$inboundSchema),
3843
+ z.lazy(() => ResponseBody2$inboundSchema),
3773
3844
  ]);
3774
3845
 
3775
3846
  export function fetchInteractionResponseFromJSON(
@@ -11,7 +11,7 @@ export * from "./get-task-schema.js";
11
11
  export * from "./get-tasks-schema.js";
12
12
  export * from "./get-tasks.js";
13
13
  export * from "./health.js";
14
- export * from "./post-auth-realms-go-protocol-openid-connect-token.js";
14
+ export * from "./post-as-token-oauth2.js";
15
15
  export * from "./start-journey.js";
16
16
  export * from "./submit-interaction.js";
17
17
  export * from "./update-task.js";
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
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 types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
11
+ import * as models from "../index.js";
12
+
13
+ export const PostAsTokenOauth2ServerList = [
14
+ "https://api.auth.gbgplc.com",
15
+ ] as const;
16
+
17
+ export type PostAsTokenOauth2Request =
18
+ | models.PasswordGrantRequest
19
+ | models.ClientCredentialsGrantRequest;
20
+
21
+ /**
22
+ * Successfully retrieved access token.
23
+ */
24
+ export type PostAsTokenOauth2Response = {
25
+ /**
26
+ * The access token used for authentication.
27
+ */
28
+ accessToken?: string | undefined;
29
+ /**
30
+ * Token expiration time in seconds.
31
+ */
32
+ expiresIn?: number | undefined;
33
+ /**
34
+ * The type of token, usually 'Bearer'.
35
+ */
36
+ tokenType?: string | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export type PostAsTokenOauth2Request$Outbound =
41
+ | models.PasswordGrantRequest$Outbound
42
+ | models.ClientCredentialsGrantRequest$Outbound;
43
+
44
+ /** @internal */
45
+ export const PostAsTokenOauth2Request$outboundSchema: z.ZodMiniType<
46
+ PostAsTokenOauth2Request$Outbound,
47
+ PostAsTokenOauth2Request
48
+ > = z.union([
49
+ models.PasswordGrantRequest$outboundSchema,
50
+ models.ClientCredentialsGrantRequest$outboundSchema,
51
+ ]);
52
+
53
+ export function postAsTokenOauth2RequestToJSON(
54
+ postAsTokenOauth2Request: PostAsTokenOauth2Request,
55
+ ): string {
56
+ return JSON.stringify(
57
+ PostAsTokenOauth2Request$outboundSchema.parse(postAsTokenOauth2Request),
58
+ );
59
+ }
60
+
61
+ /** @internal */
62
+ export const PostAsTokenOauth2Response$inboundSchema: z.ZodMiniType<
63
+ PostAsTokenOauth2Response,
64
+ unknown
65
+ > = z.pipe(
66
+ z.object({
67
+ access_token: types.optional(types.string()),
68
+ expires_in: types.optional(types.number()),
69
+ token_type: types.optional(types.string()),
70
+ }),
71
+ z.transform((v) => {
72
+ return remap$(v, {
73
+ "access_token": "accessToken",
74
+ "expires_in": "expiresIn",
75
+ "token_type": "tokenType",
76
+ });
77
+ }),
78
+ );
79
+
80
+ export function postAsTokenOauth2ResponseFromJSON(
81
+ jsonString: string,
82
+ ): SafeParseResult<PostAsTokenOauth2Response, SDKValidationError> {
83
+ return safeParse(
84
+ jsonString,
85
+ (x) => PostAsTokenOauth2Response$inboundSchema.parse(JSON.parse(x)),
86
+ `Failed to parse 'PostAsTokenOauth2Response' from JSON`,
87
+ );
88
+ }