Skip to content

Commit

Permalink
change handle different content types
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Dec 19, 2024
1 parent 360ff14 commit 0460cc8
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 41 deletions.
8 changes: 5 additions & 3 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
lockVersion: 2.0.0
id: 6bff3a53-3f0b-40b4-942f-ff70dc583ae5
management:
docChecksum: f7ffcb045d33df1ff325d735227c5ef8
docChecksum: 563bddd54ba8e60c8fd5391447ca6ee6
docVersion: "1.0"
speakeasyVersion: 1.456.1
generationVersion: 2.481.0
releaseVersion: 0.0.1-alpha.136
configChecksum: e82fdb4f7f964955972c079cce280bef
releaseVersion: 0.0.1-alpha.139
configChecksum: 83bfb017a8d55b513323eadbb0b2ba7a
published: true
features:
typescript:
acceptHeaders: 2.81.2
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.11
core: 3.18.11
Expand Down Expand Up @@ -1059,6 +1060,7 @@ examples:
application/json: {"data": {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}}
"200":
application/json: "{}"
text/html: "<value>"
"422":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
"302":
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ generation:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
typescript:
version: 0.0.1-alpha.136
version: 0.0.1-alpha.139
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ speakeasyVersion: 1.456.1
sources:
json-development:
sourceNamespace: json-development
sourceRevisionDigest: sha256:b0eda0da99146f8a0159af35cad6411df7c66c9355e3b899f7d3fd99611b105b
sourceBlobDigest: sha256:91640a2ff06deb88f7077e9ade0d92aa8e75e3d301a6bbc0a9e1ac678ddde632
sourceRevisionDigest: sha256:85cd3c629a42df68326d2f8d109145458c53205641d13e5377f9f4ded73706bb
sourceBlobDigest: sha256:1ae8efd11b4749fafd51329b44f9a6f2fecab0f98450654465d5909fa0175a47
tags:
- latest
- "1.0"
targets:
my-first-target:
source: json-development
sourceNamespace: json-development
sourceRevisionDigest: sha256:b0eda0da99146f8a0159af35cad6411df7c66c9355e3b899f7d3fd99611b105b
sourceBlobDigest: sha256:91640a2ff06deb88f7077e9ade0d92aa8e75e3d301a6bbc0a9e1ac678ddde632
sourceRevisionDigest: sha256:85cd3c629a42df68326d2f8d109145458c53205641d13e5377f9f4ded73706bb
sourceBlobDigest: sha256:1ae8efd11b4749fafd51329b44f9a6f2fecab0f98450654465d5909fa0175a47
codeSamplesNamespace: code-samples-typescript
codeSamplesRevisionDigest: sha256:9123bd33ba69a21dea243cbdec53e2e791b26a2bb4d4342fdee03d5277a178fe
codeSamplesRevisionDigest: sha256:832f910a01b438b61c79de71c991bd32e4d3623c5cf232120dd48e3cd801fd3e
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@novu/api",
"version": "0.0.1-alpha.136",
"version": "0.0.1-alpha.139",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@novu/api",
"version": "0.0.1-alpha.136",
"version": "0.0.1-alpha.139",
"author": "Novu",
"main": "./index.js",
"sideEffects": false,
Expand Down
33 changes: 13 additions & 20 deletions sources/json-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -9480,13 +9480,17 @@
],
"responses": {
"200": {
"headers": {
"Content-Type": {
"description": "content-type",
"description": "Returns plain text response.",
"content": {
"text/html": {
"schema": {
"type": "string",
"example": "text/html; charset=UTF-8"
"type": "string"
}
}
},
"headers": {
"Content-Type": {
"$ref": "#/components/headers/Content-Type"
},
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimit-Limit"
Expand All @@ -9505,21 +9509,6 @@
},
"Idempotency-Replay": {
"$ref": "#/components/headers/Idempotency-Replay"
},
"Content-Security-Policy": {
"description": "security policy",
"schema": {
"type": "string",
"example": "default-src 'self'; script-src 'self' 'unsafe-inline'"
}
}
},
"description": "",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
Expand Down Expand Up @@ -16376,6 +16365,10 @@
"status"
]
},
"String": {
"type": "object",
"properties": {}
},
"DeleteMessageResponseDto": {
"type": "object",
"properties": {
Expand Down
16 changes: 12 additions & 4 deletions src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
import * as operations from "../models/operations/index.js";
import { Result } from "../types/fp.js";

export enum ChatAccessOauthCallBackAcceptEnum {
applicationJson = "application/json",
textHtml = "text/html",
}

/**
* Handle providers oauth redirect
*/
export async function subscribersAuthenticationChatAccessOauthCallBack(
client: NovuCore,
request: operations.SubscribersControllerChatOauthCallbackRequest,
options?: RequestOptions,
options?: RequestOptions & {
acceptHeaderOverride?: ChatAccessOauthCallBackAcceptEnum;
},
): Promise<
Result<
operations.SubscribersControllerChatOauthCallbackResponse,
Expand Down Expand Up @@ -79,7 +86,8 @@ export async function subscribersAuthenticationChatAccessOauthCallBack(
});

const headers = new Headers({
Accept: "application/json",
Accept: options?.acceptHeaderOverride
|| "application/json;q=1, text/html;q=0",
});

const secConfig = await extractSecurity(client._options.apiKey);
Expand Down Expand Up @@ -151,10 +159,10 @@ export async function subscribersAuthenticationChatAccessOauthCallBack(
| RequestTimeoutError
| ConnectionError
>(
M.json(
M.text(
200,
operations.SubscribersControllerChatOauthCallbackResponse$inboundSchema,
{ hdrs: true, key: "Result" },
{ ctype: "text/html", hdrs: true, key: "Result" },
),
M.json(
302,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "1.0",
sdkVersion: "0.0.1-alpha.136",
sdkVersion: "0.0.1-alpha.139",
genVersion: "2.481.0",
userAgent: "speakeasy-sdk/typescript 0.0.1-alpha.136 2.481.0 1.0 @novu/api",
userAgent: "speakeasy-sdk/typescript 0.0.1-alpha.139 2.481.0 1.0 @novu/api",
} as const;
11 changes: 9 additions & 2 deletions src/sdk/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@
*/

import { subscribersAuthenticationChatAccessOauth } from "../funcs/subscribersAuthenticationChatAccessOauth.js";
import { subscribersAuthenticationChatAccessOauthCallBack } from "../funcs/subscribersAuthenticationChatAccessOauthCallBack.js";
import {
ChatAccessOauthCallBackAcceptEnum,
subscribersAuthenticationChatAccessOauthCallBack,
} from "../funcs/subscribersAuthenticationChatAccessOauthCallBack.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "../models/operations/index.js";
import { unwrapAsync } from "../types/fp.js";

export { ChatAccessOauthCallBackAcceptEnum } from "../funcs/subscribersAuthenticationChatAccessOauthCallBack.js";

export class Authentication extends ClientSDK {
/**
* Handle providers oauth redirect
*/
async chatAccessOauthCallBack(
request: operations.SubscribersControllerChatOauthCallbackRequest,
options?: RequestOptions,
options?: RequestOptions & {
acceptHeaderOverride?: ChatAccessOauthCallBackAcceptEnum;
},
): Promise<operations.SubscribersControllerChatOauthCallbackResponse> {
return unwrapAsync(subscribersAuthenticationChatAccessOauthCallBack(
this,
Expand Down

0 comments on commit 0460cc8

Please sign in to comment.