From 43894245a0b159be4879f5a995c0ce3cd023e0af Mon Sep 17 00:00:00 2001 From: Mendy Man Date: Fri, 14 Mar 2025 17:32:18 -0400 Subject: [PATCH 1/4] js: Add hack for internal js lib --- javascript/templates/api_resource.ts.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/javascript/templates/api_resource.ts.jinja b/javascript/templates/api_resource.ts.jinja index 8fdfd3935..023af6d24 100644 --- a/javascript/templates/api_resource.ts.jinja +++ b/javascript/templates/api_resource.ts.jinja @@ -1,6 +1,8 @@ // this file is @generated {% set resource_type_name = resource.name | to_upper_camel_case -%} +{# HACK: api_internal/message.ts generates the `messageInRaw` function that requires `MessageIn` -#} +import { MessageIn } from "../models/messageIn"; {% for c in referenced_components -%} import { {{ c | to_upper_camel_case }}, From 84c07ef5fda6ba80d961a152767661d258df64d6 Mon Sep 17 00:00:00 2001 From: Mendy Man Date: Fri, 14 Mar 2025 17:32:31 -0400 Subject: [PATCH 2/4] js: Add codegen for internal JS lib --- codegen.toml | 19 ++++++++++++++++++- javascript/templates/api_resource.ts.jinja | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/codegen.toml b/codegen.toml index 491932bbd..cd877e0e6 100644 --- a/codegen.toml +++ b/codegen.toml @@ -18,16 +18,33 @@ output_dir = "rust/src/models" [javascript] template_dir = "javascript/templates" -extra_shell_commands = ["rm javascript/src/api/{ingest,ingestSource,operationalWebhook}.ts"] +extra_shell_commands = [ + "rm javascript/src/models/retryScheduleInOut.ts", + "rm javascript/src/models/listResponseSinkOut.ts", + "rm javascript/src/api/{ingest,ingestSource,operationalWebhook}.ts", +] [[javascript.task]] template = "javascript/templates/api_resource.ts.jinja" output_dir = "javascript/src/api" [[javascript.task]] +template = "javascript/templates/api_resource.ts.jinja" +output_dir = "javascript/src/api_internal" +extra_codegen_args = [ + "--include-mode=only-hidden", + "-e=v1.environment.get-settings", + "-e=v1.event-type.update-retry-schedule", + "-e=v1.event-type.get-retry-schedule", + "-e=v1.sink.get", + "-e=v1.sink.list", + "-e=v1.sink.create", +] +[[javascript.task]] template = "javascript/templates/component_type_summary.ts.jinja" output_dir = "javascript/src/models" [[javascript.task]] template = "javascript/templates/component_type.ts.jinja" output_dir = "javascript/src/models" +extra_codegen_args = ["--include-mode=public-and-hidden"] # # [cli] diff --git a/javascript/templates/api_resource.ts.jinja b/javascript/templates/api_resource.ts.jinja index 023af6d24..b3c490d96 100644 --- a/javascript/templates/api_resource.ts.jinja +++ b/javascript/templates/api_resource.ts.jinja @@ -1,8 +1,6 @@ // this file is @generated {% set resource_type_name = resource.name | to_upper_camel_case -%} -{# HACK: api_internal/message.ts generates the `messageInRaw` function that requires `MessageIn` -#} -import { MessageIn } from "../models/messageIn"; {% for c in referenced_components -%} import { {{ c | to_upper_camel_case }}, @@ -10,6 +8,8 @@ import { } from '../models/{{ c | to_lower_camel_case }}'; {% endfor -%} import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; +{# HACK: api_internal/message.ts generates the `messageInRaw` function that requires `MessageIn` -#} +import { MessageIn, MessageInSerializer } from "../models/messageIn"; {% for op in resource.operations -%} {% if op | has_query_or_header_params -%} From b3666941fe574e690b44cbc48fbc71b284082ac9 Mon Sep 17 00:00:00 2001 From: Mendy Man Date: Fri, 14 Mar 2025 17:40:28 -0400 Subject: [PATCH 3/4] js: Add internal lib --- javascript/src/api_internal/application.ts | 28 +++ javascript/src/api_internal/authentication.ts | 120 ++++++++++++ javascript/src/api_internal/beta.ts | 5 + javascript/src/api_internal/betaConnector.ts | 166 ++++++++++++++++ .../src/api_internal/betaConnectorOauth.ts | 78 ++++++++ javascript/src/api_internal/endpoint.ts | 184 ++++++++++++++++++ javascript/src/api_internal/eventType.ts | 56 ++++++ javascript/src/api_internal/inbound.ts | 56 ++++++ javascript/src/api_internal/message.ts | 152 +++++++++++++++ javascript/src/api_internal/messageAttempt.ts | 75 +++++++ .../api_internal/messageEventsSubscription.ts | 35 ++++ javascript/src/api_internal/stats.ts | 63 ++++++ javascript/src/api_internal/stream.ts | 5 + .../src/api_internal/streamEventType.ts | 112 +++++++++++ javascript/src/api_internal/streamEvents.ts | 51 +++++ javascript/src/api_internal/streamStream.ts | 89 +++++++++ javascript/src/models/applicationStats.ts | 28 +++ .../src/models/attemptStatisticsData.ts | 23 +++ .../src/models/attemptStatisticsResponse.ts | 34 ++++ javascript/src/models/authTokenOut.ts | 36 ++++ .../src/models/clientSecretJwtParamsIn.ts | 41 ++++ javascript/src/models/completionChoice.ts | 27 +++ javascript/src/models/completionMessage.ts | 23 +++ javascript/src/models/connectorPatch.ts | 47 +++++ javascript/src/models/countOut.ts | 25 +++ javascript/src/models/createStreamIn.ts | 34 ++++ javascript/src/models/createStreamOut.ts | 16 ++ javascript/src/models/createTokenIn.ts | 25 +++ javascript/src/models/endpointMtlsConfigIn.ts | 25 +++ .../src/models/endpointMtlsConfigOut.ts | 20 ++ .../src/models/endpointOauthConfigIn.ts | 72 +++++++ .../src/models/endpointOauthConfigOut.ts | 43 ++++ .../endpointTransformationSimulateIn.ts | 30 +++ .../endpointTransformationSimulateOut.ts | 34 ++++ javascript/src/models/eventIn.ts | 24 +++ javascript/src/models/eventOut.ts | 27 +++ javascript/src/models/eventStreamOut.ts | 29 +++ javascript/src/models/eventTypeExampleOut.ts | 20 ++ javascript/src/models/eventTypeSchemaIn.ts | 20 ++ javascript/src/models/exportEventTypeOut.ts | 32 +++ javascript/src/models/generateIn.ts | 20 ++ javascript/src/models/generateOut.ts | 35 ++++ javascript/src/models/hubspotOauthConfigIn.ts | 20 ++ .../src/models/incomingWebhookPayloadOut.ts | 26 +++ .../src/models/listResponseConnectorOut.ts | 32 +++ .../models/listResponseStreamEventTypeOut.ts | 32 +++ .../src/models/listResponseStreamOut.ts | 32 +++ .../src/models/messageAttemptHeadersOut.ts | 26 +++ javascript/src/models/messageEventsOut.ts | 29 +++ javascript/src/models/messagePrecheckIn.ts | 24 +++ javascript/src/models/messagePrecheckOut.ts | 20 ++ javascript/src/models/messageRawPayloadOut.ts | 20 ++ .../models/messageSubscriberAuthTokenOut.ts | 23 +++ javascript/src/models/oAuthPayloadIn.ts | 23 +++ javascript/src/models/oAuthPayloadOut.ts | 26 +++ .../src/models/oauth2AuthMethodInOut.ts | 22 +++ javascript/src/models/oauth2GrantTypeInOut.ts | 17 ++ .../src/models/oauthJwsSigningAlgorithm.ts | 16 ++ javascript/src/models/oneTimeTokenIn.ts | 20 ++ javascript/src/models/oneTimeTokenOut.ts | 20 ++ javascript/src/models/rotatePollerTokenIn.ts | 31 +++ javascript/src/models/rotatedUrlOut.ts | 20 ++ javascript/src/models/statisticsPeriod.ts | 17 ++ javascript/src/models/streamEventTypeIn.ts | 24 +++ javascript/src/models/streamEventTypeOut.ts | 30 +++ javascript/src/models/streamEventTypePatch.ts | 24 +++ javascript/src/models/streamIn.ts | 25 +++ javascript/src/models/streamOut.ts | 35 ++++ javascript/src/models/streamPatch.ts | 25 +++ javascript/src/models/streamPortalAccessIn.ts | 33 ++++ javascript/src/models/templateUpdate.ts | 47 +++++ .../src/models/transformationHttpMethod.ts | 18 ++ .../src/models/transformationSimulateIn.ts | 30 +++ .../src/models/transformationSimulateOut.ts | 34 ++++ 74 files changed, 2886 insertions(+) create mode 100644 javascript/src/api_internal/application.ts create mode 100644 javascript/src/api_internal/authentication.ts create mode 100644 javascript/src/api_internal/beta.ts create mode 100644 javascript/src/api_internal/betaConnector.ts create mode 100644 javascript/src/api_internal/betaConnectorOauth.ts create mode 100644 javascript/src/api_internal/endpoint.ts create mode 100644 javascript/src/api_internal/eventType.ts create mode 100644 javascript/src/api_internal/inbound.ts create mode 100644 javascript/src/api_internal/message.ts create mode 100644 javascript/src/api_internal/messageAttempt.ts create mode 100644 javascript/src/api_internal/messageEventsSubscription.ts create mode 100644 javascript/src/api_internal/stats.ts create mode 100644 javascript/src/api_internal/stream.ts create mode 100644 javascript/src/api_internal/streamEventType.ts create mode 100644 javascript/src/api_internal/streamEvents.ts create mode 100644 javascript/src/api_internal/streamStream.ts create mode 100644 javascript/src/models/applicationStats.ts create mode 100644 javascript/src/models/attemptStatisticsData.ts create mode 100644 javascript/src/models/attemptStatisticsResponse.ts create mode 100644 javascript/src/models/authTokenOut.ts create mode 100644 javascript/src/models/clientSecretJwtParamsIn.ts create mode 100644 javascript/src/models/completionChoice.ts create mode 100644 javascript/src/models/completionMessage.ts create mode 100644 javascript/src/models/connectorPatch.ts create mode 100644 javascript/src/models/countOut.ts create mode 100644 javascript/src/models/createStreamIn.ts create mode 100644 javascript/src/models/createStreamOut.ts create mode 100644 javascript/src/models/createTokenIn.ts create mode 100644 javascript/src/models/endpointMtlsConfigIn.ts create mode 100644 javascript/src/models/endpointMtlsConfigOut.ts create mode 100644 javascript/src/models/endpointOauthConfigIn.ts create mode 100644 javascript/src/models/endpointOauthConfigOut.ts create mode 100644 javascript/src/models/endpointTransformationSimulateIn.ts create mode 100644 javascript/src/models/endpointTransformationSimulateOut.ts create mode 100644 javascript/src/models/eventIn.ts create mode 100644 javascript/src/models/eventOut.ts create mode 100644 javascript/src/models/eventStreamOut.ts create mode 100644 javascript/src/models/eventTypeExampleOut.ts create mode 100644 javascript/src/models/eventTypeSchemaIn.ts create mode 100644 javascript/src/models/exportEventTypeOut.ts create mode 100644 javascript/src/models/generateIn.ts create mode 100644 javascript/src/models/generateOut.ts create mode 100644 javascript/src/models/hubspotOauthConfigIn.ts create mode 100644 javascript/src/models/incomingWebhookPayloadOut.ts create mode 100644 javascript/src/models/listResponseConnectorOut.ts create mode 100644 javascript/src/models/listResponseStreamEventTypeOut.ts create mode 100644 javascript/src/models/listResponseStreamOut.ts create mode 100644 javascript/src/models/messageAttemptHeadersOut.ts create mode 100644 javascript/src/models/messageEventsOut.ts create mode 100644 javascript/src/models/messagePrecheckIn.ts create mode 100644 javascript/src/models/messagePrecheckOut.ts create mode 100644 javascript/src/models/messageRawPayloadOut.ts create mode 100644 javascript/src/models/messageSubscriberAuthTokenOut.ts create mode 100644 javascript/src/models/oAuthPayloadIn.ts create mode 100644 javascript/src/models/oAuthPayloadOut.ts create mode 100644 javascript/src/models/oauth2AuthMethodInOut.ts create mode 100644 javascript/src/models/oauth2GrantTypeInOut.ts create mode 100644 javascript/src/models/oauthJwsSigningAlgorithm.ts create mode 100644 javascript/src/models/oneTimeTokenIn.ts create mode 100644 javascript/src/models/oneTimeTokenOut.ts create mode 100644 javascript/src/models/rotatePollerTokenIn.ts create mode 100644 javascript/src/models/rotatedUrlOut.ts create mode 100644 javascript/src/models/statisticsPeriod.ts create mode 100644 javascript/src/models/streamEventTypeIn.ts create mode 100644 javascript/src/models/streamEventTypeOut.ts create mode 100644 javascript/src/models/streamEventTypePatch.ts create mode 100644 javascript/src/models/streamIn.ts create mode 100644 javascript/src/models/streamOut.ts create mode 100644 javascript/src/models/streamPatch.ts create mode 100644 javascript/src/models/streamPortalAccessIn.ts create mode 100644 javascript/src/models/templateUpdate.ts create mode 100644 javascript/src/models/transformationHttpMethod.ts create mode 100644 javascript/src/models/transformationSimulateIn.ts create mode 100644 javascript/src/models/transformationSimulateOut.ts diff --git a/javascript/src/api_internal/application.ts b/javascript/src/api_internal/application.ts new file mode 100644 index 000000000..10f34815b --- /dev/null +++ b/javascript/src/api_internal/application.ts @@ -0,0 +1,28 @@ +// this file is @generated +import { ApplicationStats, ApplicationStatsSerializer } from "../models/applicationStats"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface ApplicationGetStatsOptions { + /** Filter the range to data starting from this date. */ + since: Date | null; + /** Filter the range to data ending by this date. */ + until: Date | null; +} + +export class Application { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Get basic statistics for the application. */ + public getStats( + appId: string, + options: ApplicationGetStatsOptions + ): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/stats"); + + request.setPathParam("app_id", appId); + request.setQueryParam("since", options.since); + request.setQueryParam("until", options.until); + + return request.send(this.requestCtx, ApplicationStatsSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/authentication.ts b/javascript/src/api_internal/authentication.ts new file mode 100644 index 000000000..6fc235c92 --- /dev/null +++ b/javascript/src/api_internal/authentication.ts @@ -0,0 +1,120 @@ +// this file is @generated +import { + AppPortalAccessOut, + AppPortalAccessOutSerializer, +} from "../models/appPortalAccessOut"; +import { AuthTokenOut, AuthTokenOutSerializer } from "../models/authTokenOut"; +import { CreateTokenIn, CreateTokenInSerializer } from "../models/createTokenIn"; +import { OneTimeTokenIn, OneTimeTokenInSerializer } from "../models/oneTimeTokenIn"; +import { OneTimeTokenOut, OneTimeTokenOutSerializer } from "../models/oneTimeTokenOut"; +import { + RotatePollerTokenIn, + RotatePollerTokenInSerializer, +} from "../models/rotatePollerTokenIn"; +import { + StreamPortalAccessIn, + StreamPortalAccessInSerializer, +} from "../models/streamPortalAccessIn"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface AuthenticationCreateMessageTokenOptions { + idempotencyKey?: string; +} + +export interface AuthenticationRotatePollerTokenOptions { + idempotencyKey?: string; +} + +export interface AuthenticationExchangeOneTimeTokenOptions { + idempotencyKey?: string; +} + +export interface AuthenticationStreamPortalAccessOptions { + idempotencyKey?: string; +} + +export class Authentication { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Create a new access token that only allows creating messages inside this application. */ + public createMessageToken( + appId: string, + createTokenIn: CreateTokenIn, + options?: AuthenticationCreateMessageTokenOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/auth/app/{app_id}/create-message-token" + ); + + request.setPathParam("app_id", appId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(CreateTokenInSerializer._toJsonObject(createTokenIn)); + + return request.send(this.requestCtx, AuthTokenOutSerializer._fromJsonObject); + } + + /** Get the current auth token for the poller. */ + public getPollerToken(appId: string, endpointId: string): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/auth/app/{app_id}/poller/{endpoint_id}/token" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + + return request.send(this.requestCtx, AuthTokenOutSerializer._fromJsonObject); + } + + /** Create a new auth token that can for the poller API. */ + public rotatePollerToken( + appId: string, + endpointId: string, + rotatePollerTokenIn: RotatePollerTokenIn, + options?: AuthenticationRotatePollerTokenOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/auth/app/{app_id}/poller/{endpoint_id}/token/rotate" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(RotatePollerTokenInSerializer._toJsonObject(rotatePollerTokenIn)); + + return request.send(this.requestCtx, AuthTokenOutSerializer._fromJsonObject); + } + + /** This is a one time token. */ + public exchangeOneTimeToken( + oneTimeTokenIn: OneTimeTokenIn, + options?: AuthenticationExchangeOneTimeTokenOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/auth/one-time-token"); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(OneTimeTokenInSerializer._toJsonObject(oneTimeTokenIn)); + + return request.send(this.requestCtx, OneTimeTokenOutSerializer._fromJsonObject); + } + + /** Use this function to get magic links (and authentication codes) for connecting your users to the Stream Consumer Portal. */ + public streamPortalAccess( + streamId: string, + streamPortalAccessIn: StreamPortalAccessIn, + options?: AuthenticationStreamPortalAccessOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/auth/stream-portal-access/{stream_id}" + ); + + request.setPathParam("stream_id", streamId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(StreamPortalAccessInSerializer._toJsonObject(streamPortalAccessIn)); + + return request.send(this.requestCtx, AppPortalAccessOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/beta.ts b/javascript/src/api_internal/beta.ts new file mode 100644 index 000000000..e2bb8f340 --- /dev/null +++ b/javascript/src/api_internal/beta.ts @@ -0,0 +1,5 @@ +import { SvixRequestContext } from "../request"; + +export class Beta { + public constructor(private readonly requestCtx: SvixRequestContext) {} +} diff --git a/javascript/src/api_internal/betaConnector.ts b/javascript/src/api_internal/betaConnector.ts new file mode 100644 index 000000000..1ebc0b95a --- /dev/null +++ b/javascript/src/api_internal/betaConnector.ts @@ -0,0 +1,166 @@ +// this file is @generated +import { ConnectorIn, ConnectorInSerializer } from "../models/connectorIn"; +import { ConnectorOut, ConnectorOutSerializer } from "../models/connectorOut"; +import { ConnectorPatch, ConnectorPatchSerializer } from "../models/connectorPatch"; +import { GenerateIn, GenerateInSerializer } from "../models/generateIn"; +import { GenerateOut, GenerateOutSerializer } from "../models/generateOut"; +import { + ListResponseConnectorOut, + ListResponseConnectorOutSerializer, +} from "../models/listResponseConnectorOut"; +import { Ordering } from "../models/ordering"; +import { TemplateUpdate, TemplateUpdateSerializer } from "../models/templateUpdate"; +import { + TransformationSimulateIn, + TransformationSimulateInSerializer, +} from "../models/transformationSimulateIn"; +import { + TransformationSimulateOut, + TransformationSimulateOutSerializer, +} from "../models/transformationSimulateOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface BetaConnectorListOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** The sorting order of the returned items */ + order?: Ordering; +} + +export interface BetaConnectorCreateOptions { + idempotencyKey?: string; +} + +export interface BetaConnectorGenerateOptions { + idempotencyKey?: string; +} + +export interface BetaConnectorSimulateOptions { + idempotencyKey?: string; +} + +export class BetaConnector { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** List all transformation templates for an application. */ + public list(options?: BetaConnectorListOptions): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/transformation-template"); + + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("order", options?.order); + + return request.send( + this.requestCtx, + ListResponseConnectorOutSerializer._fromJsonObject + ); + } + + /** Create a new connector. */ + public create( + connectorIn: ConnectorIn, + options?: BetaConnectorCreateOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/transformation-template"); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(ConnectorInSerializer._toJsonObject(connectorIn)); + + return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject); + } + + /** Use OpenAI's Completion API to generate code for a connector. */ + public generate( + generateIn: GenerateIn, + options?: BetaConnectorGenerateOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/transformation-template/generate" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(GenerateInSerializer._toJsonObject(generateIn)); + + return request.send(this.requestCtx, GenerateOutSerializer._fromJsonObject); + } + + /** Simulate running the transformation on the payload and code. */ + public simulate( + transformationSimulateIn: TransformationSimulateIn, + options?: BetaConnectorSimulateOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/transformation-template/simulate" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody( + TransformationSimulateInSerializer._toJsonObject(transformationSimulateIn) + ); + + return request.send( + this.requestCtx, + TransformationSimulateOutSerializer._fromJsonObject + ); + } + + /** Get a connector. */ + public get(transformationTemplateId: string): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/transformation-template/{transformation_template_id}" + ); + + request.setPathParam("transformation_template_id", transformationTemplateId); + + return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject); + } + + /** Update a connector. */ + public update( + transformationTemplateId: string, + templateUpdate: TemplateUpdate + ): Promise { + const request = new SvixRequest( + HttpMethod.PUT, + "/api/v1/transformation-template/{transformation_template_id}" + ); + + request.setPathParam("transformation_template_id", transformationTemplateId); + request.setBody(TemplateUpdateSerializer._toJsonObject(templateUpdate)); + + return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject); + } + + /** Delete a connector. */ + public delete(transformationTemplateId: string): Promise { + const request = new SvixRequest( + HttpMethod.DELETE, + "/api/v1/transformation-template/{transformation_template_id}" + ); + + request.setPathParam("transformation_template_id", transformationTemplateId); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Partially update a connector. */ + public patch( + transformationTemplateId: string, + connectorPatch: ConnectorPatch + ): Promise { + const request = new SvixRequest( + HttpMethod.PATCH, + "/api/v1/transformation-template/{transformation_template_id}" + ); + + request.setPathParam("transformation_template_id", transformationTemplateId); + request.setBody(ConnectorPatchSerializer._toJsonObject(connectorPatch)); + + return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/betaConnectorOauth.ts b/javascript/src/api_internal/betaConnectorOauth.ts new file mode 100644 index 000000000..4825c3de6 --- /dev/null +++ b/javascript/src/api_internal/betaConnectorOauth.ts @@ -0,0 +1,78 @@ +// this file is @generated +import { + IncomingWebhookPayloadOut, + IncomingWebhookPayloadOutSerializer, +} from "../models/incomingWebhookPayloadOut"; +import { OAuthPayloadIn, OAuthPayloadInSerializer } from "../models/oAuthPayloadIn"; +import { OAuthPayloadOut, OAuthPayloadOutSerializer } from "../models/oAuthPayloadOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface BetaConnectorOauthDiscordOptions { + idempotencyKey?: string; +} + +export interface BetaConnectorOauthHubspotOptions { + idempotencyKey?: string; +} + +export interface BetaConnectorOauthSlackOptions { + idempotencyKey?: string; +} + +export class BetaConnectorOauth { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Get Discord Incoming webhook URL. */ + public discord( + oAuthPayloadIn: OAuthPayloadIn, + options?: BetaConnectorOauthDiscordOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/transformation-template/oauth/discord" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(OAuthPayloadInSerializer._toJsonObject(oAuthPayloadIn)); + + return request.send( + this.requestCtx, + IncomingWebhookPayloadOutSerializer._fromJsonObject + ); + } + + /** Get Hubspot access token using authorization code. */ + public hubspot( + oAuthPayloadIn: OAuthPayloadIn, + options?: BetaConnectorOauthHubspotOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/transformation-template/oauth/hubspot" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(OAuthPayloadInSerializer._toJsonObject(oAuthPayloadIn)); + + return request.send(this.requestCtx, OAuthPayloadOutSerializer._fromJsonObject); + } + + /** Get Slack Incoming webhook URL. */ + public slack( + oAuthPayloadIn: OAuthPayloadIn, + options?: BetaConnectorOauthSlackOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/transformation-template/oauth/slack" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(OAuthPayloadInSerializer._toJsonObject(oAuthPayloadIn)); + + return request.send( + this.requestCtx, + IncomingWebhookPayloadOutSerializer._fromJsonObject + ); + } +} diff --git a/javascript/src/api_internal/endpoint.ts b/javascript/src/api_internal/endpoint.ts new file mode 100644 index 000000000..9f98c6a97 --- /dev/null +++ b/javascript/src/api_internal/endpoint.ts @@ -0,0 +1,184 @@ +// this file is @generated +import { + EndpointMtlsConfigIn, + EndpointMtlsConfigInSerializer, +} from "../models/endpointMtlsConfigIn"; +import { + EndpointMtlsConfigOut, + EndpointMtlsConfigOutSerializer, +} from "../models/endpointMtlsConfigOut"; +import { + EndpointOauthConfigIn, + EndpointOauthConfigInSerializer, +} from "../models/endpointOauthConfigIn"; +import { + EndpointOauthConfigOut, + EndpointOauthConfigOutSerializer, +} from "../models/endpointOauthConfigOut"; +import { + EndpointTransformationSimulateIn, + EndpointTransformationSimulateInSerializer, +} from "../models/endpointTransformationSimulateIn"; +import { + EndpointTransformationSimulateOut, + EndpointTransformationSimulateOutSerializer, +} from "../models/endpointTransformationSimulateOut"; +import { + HubspotOauthConfigIn, + HubspotOauthConfigInSerializer, +} from "../models/hubspotOauthConfigIn"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface EndpointTransformationSimulateOptions { + idempotencyKey?: string; +} + +export class Endpoint { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Get endpoint mTLS configuration. */ + public getMtlsConfig( + appId: string, + endpointId: string + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/mtls" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + + return request.send(this.requestCtx, EndpointMtlsConfigOutSerializer._fromJsonObject); + } + + /** Create / update endpoint mTLS configuration. */ + public updateMtlsConfig( + appId: string, + endpointId: string, + endpointMtlsConfigIn: EndpointMtlsConfigIn + ): Promise { + const request = new SvixRequest( + HttpMethod.PUT, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/mtls" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setBody(EndpointMtlsConfigInSerializer._toJsonObject(endpointMtlsConfigIn)); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Delete endpoint mTLS configuration. */ + public deleteMtlsConfig(appId: string, endpointId: string): Promise { + const request = new SvixRequest( + HttpMethod.DELETE, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/mtls" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Get endpoint OAuth configuration. */ + public getOauthConfig( + appId: string, + endpointId: string + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/oauth" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + + return request.send( + this.requestCtx, + EndpointOauthConfigOutSerializer._fromJsonObject + ); + } + + /** Create / update endpoint OAuth configuration. */ + public updateOauthConfig( + appId: string, + endpointId: string, + endpointOauthConfigIn: EndpointOauthConfigIn + ): Promise { + const request = new SvixRequest( + HttpMethod.PUT, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/oauth" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setBody(EndpointOauthConfigInSerializer._toJsonObject(endpointOauthConfigIn)); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Delete endpoint OAuth configuration. */ + public deleteOauthConfig(appId: string, endpointId: string): Promise { + const request = new SvixRequest( + HttpMethod.DELETE, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/oauth" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** + * Create / update endpoint Hubspot OAuth configuration. + * + * Specific private endpoint just for us, to avoid exposing the Hubspot secret to the client. + */ + public updateHubspotOauthConfig( + appId: string, + endpointId: string, + hubspotOauthConfigIn: HubspotOauthConfigIn + ): Promise { + const request = new SvixRequest( + HttpMethod.PUT, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation-template/oauth/hubspot" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setBody(HubspotOauthConfigInSerializer._toJsonObject(hubspotOauthConfigIn)); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Simulate running the transformation on the payload and code. */ + public transformationSimulate( + appId: string, + endpointId: string, + endpointTransformationSimulateIn: EndpointTransformationSimulateIn, + options?: EndpointTransformationSimulateOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation/simulate" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody( + EndpointTransformationSimulateInSerializer._toJsonObject( + endpointTransformationSimulateIn + ) + ); + + return request.send( + this.requestCtx, + EndpointTransformationSimulateOutSerializer._fromJsonObject + ); + } +} diff --git a/javascript/src/api_internal/eventType.ts b/javascript/src/api_internal/eventType.ts new file mode 100644 index 000000000..698d4cee6 --- /dev/null +++ b/javascript/src/api_internal/eventType.ts @@ -0,0 +1,56 @@ +// this file is @generated +import { + EventTypeExampleOut, + EventTypeExampleOutSerializer, +} from "../models/eventTypeExampleOut"; +import { + EventTypeSchemaIn, + EventTypeSchemaInSerializer, +} from "../models/eventTypeSchemaIn"; +import { + ExportEventTypeOut, + ExportEventTypeOutSerializer, +} from "../models/exportEventTypeOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface EventTypeExportOpenapiOptions { + idempotencyKey?: string; +} + +export interface EventTypeGenerateExampleOptions { + idempotencyKey?: string; +} + +export class EventType { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** + * Exports event type definitions based on the OpenAPI schemas associated + * with each existing event type. + */ + public exportOpenapi( + options?: EventTypeExportOpenapiOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/event-type/export/openapi"); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + + return request.send(this.requestCtx, ExportEventTypeOutSerializer._fromJsonObject); + } + + /** Generates a fake example from the given JSONSchema. */ + public generateExample( + eventTypeSchemaIn: EventTypeSchemaIn, + options?: EventTypeGenerateExampleOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/event-type/schema/generate-example" + ); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(EventTypeSchemaInSerializer._toJsonObject(eventTypeSchemaIn)); + + return request.send(this.requestCtx, EventTypeExampleOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/inbound.ts b/javascript/src/api_internal/inbound.ts new file mode 100644 index 000000000..82a8c6f42 --- /dev/null +++ b/javascript/src/api_internal/inbound.ts @@ -0,0 +1,56 @@ +// this file is @generated +import { MessageOut, MessageOutSerializer } from "../models/messageOut"; +import { RotatedUrlOut, RotatedUrlOutSerializer } from "../models/rotatedUrlOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface InboundMsgOptions { + /** The event type's name */ + eventType?: string; + idempotencyKey?: string; +} + +export interface InboundRotateUrlOptions { + idempotencyKey?: string; +} + +export class Inbound { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Handles a raw inbound webhook for the application. */ + public msg( + appId: string, + inboundToken: string, + options?: InboundMsgOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/app/{app_id}/inbound/msg/{inbound_token}" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("inbound_token", inboundToken); + request.setQueryParam("event_type", options?.eventType); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + + return request.send(this.requestCtx, MessageOutSerializer._fromJsonObject); + } + + /** + * Invalidates the previous inbound url (if one exists), producing a new inbound + * URL for this app. + */ + public rotateUrl( + appId: string, + options?: InboundRotateUrlOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/app/{app_id}/inbound/rotate-url" + ); + + request.setPathParam("app_id", appId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + + return request.send(this.requestCtx, RotatedUrlOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/message.ts b/javascript/src/api_internal/message.ts new file mode 100644 index 000000000..6f3c4b35b --- /dev/null +++ b/javascript/src/api_internal/message.ts @@ -0,0 +1,152 @@ +// this file is @generated +import { MessageEventsOut, MessageEventsOutSerializer } from "../models/messageEventsOut"; +import { MessageIn } from "../models/messageIn"; +import { + MessagePrecheckIn, + MessagePrecheckInSerializer, +} from "../models/messagePrecheckIn"; +import { + MessagePrecheckOut, + MessagePrecheckOutSerializer, +} from "../models/messagePrecheckOut"; +import { + MessageRawPayloadOut, + MessageRawPayloadOutSerializer, +} from "../models/messageRawPayloadOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface MessageEventsOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** Filter response based on the event type */ + eventTypes?: string[]; + /** Filter response based on the event type. */ + channels?: string[]; + after?: Date | null; +} + +export interface MessageEventsSubscriptionOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** Filter response based on the event type */ + eventTypes?: string[]; + /** Filter response based on the event type. */ + channels?: string[]; + after?: Date | null; +} + +export interface MessagePrecheckOptions { + idempotencyKey?: string; +} + +export class Message { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Reads the stream of created messages for an application. */ + public events( + appId: string, + options?: MessageEventsOptions + ): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/events"); + + request.setPathParam("app_id", appId); + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("event_types", options?.eventTypes); + request.setQueryParam("channels", options?.channels); + request.setQueryParam("after", options?.after); + + return request.send(this.requestCtx, MessageEventsOutSerializer._fromJsonObject); + } + + /** Reads the stream of created messages for an application, but using server-managed iterator tracking. */ + public eventsSubscription( + appId: string, + subscriptionId: string, + options?: MessageEventsSubscriptionOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/events/subscription/{subscription_id}" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("subscription_id", subscriptionId); + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("event_types", options?.eventTypes); + request.setQueryParam("channels", options?.channels); + request.setQueryParam("after", options?.after); + + return request.send(this.requestCtx, MessageEventsOutSerializer._fromJsonObject); + } + + /** + * A pre-check call for `create.message` that checks whether endpoints are actively listening to + * this message. + */ + public precheck( + appId: string, + messagePrecheckIn: MessagePrecheckIn, + options?: MessagePrecheckOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/app/{app_id}/msg/precheck/active" + ); + + request.setPathParam("app_id", appId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(MessagePrecheckInSerializer._toJsonObject(messagePrecheckIn)); + + return request.send(this.requestCtx, MessagePrecheckOutSerializer._fromJsonObject); + } + + /** Get a message raw payload by its ID or eventID. */ + public getRawPayload(appId: string, msgId: string): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/msg/{msg_id}/raw" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("msg_id", msgId); + + return request.send(this.requestCtx, MessageRawPayloadOutSerializer._fromJsonObject); + } +} + +/** + * Creates a `MessageIn` with a raw string payload. + * + * The payload is not normalized on the server. Normally, payloads are + * required to be JSON, and Svix will minify the payload before sending the + * webhooks (for example, by removing extraneous whitespace or unnecessarily + * escaped characters in strings). With this function, the payload will be + * sent "as is", without any minification or other processing. + * + * @param payload Serialized message payload + * @param contentType The value to use for the Content-Type header of the webhook sent by Svix, overwriting the default of `application/json` if specified + * + * See the class documentation for details about the other parameters. + */ +export function messageInRaw( + eventType: string, + payload: string, + contentType?: string +): MessageIn { + const headers = contentType ? { "content-type": contentType } : undefined; + + return { + eventType, + payload: {}, + transformationsParams: { + rawPayload: payload, + headers, + }, + }; +} diff --git a/javascript/src/api_internal/messageAttempt.ts b/javascript/src/api_internal/messageAttempt.ts new file mode 100644 index 000000000..6d037f1aa --- /dev/null +++ b/javascript/src/api_internal/messageAttempt.ts @@ -0,0 +1,75 @@ +// this file is @generated +import { CountOut, CountOutSerializer } from "../models/countOut"; +import { + MessageAttemptHeadersOut, + MessageAttemptHeadersOutSerializer, +} from "../models/messageAttemptHeadersOut"; +import { MessageStatus } from "../models/messageStatus"; +import { StatusCodeClass } from "../models/statusCodeClass"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface MessageAttemptCountByEndpointOptions { + /** Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3) */ + status?: MessageStatus; + /** Filter response based on the HTTP status code */ + statusCodeClass?: StatusCodeClass; + /** Filter response based on the channel */ + channel?: string; + /** Filter response based on the tag */ + tag?: string; + /** Only include items created before a certain date */ + before?: Date | null; + /** Only include items created after a certain date */ + after?: Date | null; + /** Filter response based on the event type */ + eventTypes?: string[]; +} + +export class MessageAttempt { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Like `v1.message-attempt.list-by-endpoint` but returning a count only. */ + public countByEndpoint( + appId: string, + endpointId: string, + options?: MessageAttemptCountByEndpointOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}/count" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setQueryParam("status", options?.status); + request.setQueryParam("status_code_class", options?.statusCodeClass); + request.setQueryParam("channel", options?.channel); + request.setQueryParam("tag", options?.tag); + request.setQueryParam("before", options?.before); + request.setQueryParam("after", options?.after); + request.setQueryParam("event_types", options?.eventTypes); + + return request.send(this.requestCtx, CountOutSerializer._fromJsonObject); + } + + /** Calculate and return headers used on a given message attempt */ + public getHeaders( + appId: string, + msgId: string, + attemptId: string + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/headers" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("msg_id", msgId); + request.setPathParam("attempt_id", attemptId); + + return request.send( + this.requestCtx, + MessageAttemptHeadersOutSerializer._fromJsonObject + ); + } +} diff --git a/javascript/src/api_internal/messageEventsSubscription.ts b/javascript/src/api_internal/messageEventsSubscription.ts new file mode 100644 index 000000000..842d8f4c7 --- /dev/null +++ b/javascript/src/api_internal/messageEventsSubscription.ts @@ -0,0 +1,35 @@ +// this file is @generated +import { + MessageSubscriberAuthTokenOut, + MessageSubscriberAuthTokenOutSerializer, +} from "../models/messageSubscriberAuthTokenOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface MessageEventsSubscriptionCreateTokenOptions { + idempotencyKey?: string; +} + +export class MessageEventsSubscription { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Creates an auth token that can be used with the `v1.message.events-subscription` endpoint. */ + public createToken( + appId: string, + subscriptionId: string, + options?: MessageEventsSubscriptionCreateTokenOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.POST, + "/api/v1/app/{app_id}/events/subscription/{subscription_id}/create-token" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("subscription_id", subscriptionId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + + return request.send( + this.requestCtx, + MessageSubscriberAuthTokenOutSerializer._fromJsonObject + ); + } +} diff --git a/javascript/src/api_internal/stats.ts b/javascript/src/api_internal/stats.ts new file mode 100644 index 000000000..de612d800 --- /dev/null +++ b/javascript/src/api_internal/stats.ts @@ -0,0 +1,63 @@ +// this file is @generated +import { + AttemptStatisticsResponse, + AttemptStatisticsResponseSerializer, +} from "../models/attemptStatisticsResponse"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface StatsAppAttemptsOptions { + /** Filter the range to data starting from this date. */ + startDate?: Date | null; + /** Filter the range to data ending by this date. */ + endDate?: Date | null; +} + +export interface StatsEndpointAttemptsOptions { + /** Filter the range to data starting from this date. */ + startDate?: Date | null; + /** Filter the range to data ending by this date. */ + endDate?: Date | null; +} + +export class Stats { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Returns application-level statistics on message attempts */ + public appAttempts( + appId: string, + options?: StatsAppAttemptsOptions + ): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stats/app/{app_id}/attempt"); + + request.setPathParam("app_id", appId); + request.setQueryParam("startDate", options?.startDate); + request.setQueryParam("endDate", options?.endDate); + + return request.send( + this.requestCtx, + AttemptStatisticsResponseSerializer._fromJsonObject + ); + } + + /** Returns endpoint-level statistics on message attempts. */ + public endpointAttempts( + appId: string, + endpointId: string, + options?: StatsEndpointAttemptsOptions + ): Promise { + const request = new SvixRequest( + HttpMethod.GET, + "/api/v1/stats/app/{app_id}/ep/{endpoint_id}/attempt" + ); + + request.setPathParam("app_id", appId); + request.setPathParam("endpoint_id", endpointId); + request.setQueryParam("startDate", options?.startDate); + request.setQueryParam("endDate", options?.endDate); + + return request.send( + this.requestCtx, + AttemptStatisticsResponseSerializer._fromJsonObject + ); + } +} diff --git a/javascript/src/api_internal/stream.ts b/javascript/src/api_internal/stream.ts new file mode 100644 index 000000000..1a74bdbf6 --- /dev/null +++ b/javascript/src/api_internal/stream.ts @@ -0,0 +1,5 @@ +import { SvixRequestContext } from "../request"; + +export class Stream { + public constructor(private readonly requestCtx: SvixRequestContext) {} +} diff --git a/javascript/src/api_internal/streamEventType.ts b/javascript/src/api_internal/streamEventType.ts new file mode 100644 index 000000000..0e56ce1c0 --- /dev/null +++ b/javascript/src/api_internal/streamEventType.ts @@ -0,0 +1,112 @@ +// this file is @generated +import { + ListResponseStreamEventTypeOut, + ListResponseStreamEventTypeOutSerializer, +} from "../models/listResponseStreamEventTypeOut"; +import { Ordering } from "../models/ordering"; +import { + StreamEventTypeIn, + StreamEventTypeInSerializer, +} from "../models/streamEventTypeIn"; +import { + StreamEventTypeOut, + StreamEventTypeOutSerializer, +} from "../models/streamEventTypeOut"; +import { + StreamEventTypePatch, + StreamEventTypePatchSerializer, +} from "../models/streamEventTypePatch"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface StreamEventTypeListOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** The sorting order of the returned items */ + order?: Ordering; +} + +export interface StreamEventTypeCreateOptions { + idempotencyKey?: string; +} + +export class StreamEventType { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** List of all the organization's event types for streaming. */ + public list( + options?: StreamEventTypeListOptions + ): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/event-type"); + + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("order", options?.order); + + return request.send( + this.requestCtx, + ListResponseStreamEventTypeOutSerializer._fromJsonObject + ); + } + + /** Create an event type for Streams. */ + public create( + streamEventTypeIn: StreamEventTypeIn, + options?: StreamEventTypeCreateOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream/event-type"); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(StreamEventTypeInSerializer._toJsonObject(streamEventTypeIn)); + + return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject); + } + + /** Get an event type. */ + public get(name: string): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/event-type/{name}"); + + request.setPathParam("name", name); + + return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject); + } + + /** Update or create a event type for Streams. */ + public update( + name: string, + streamEventTypeIn: StreamEventTypeIn + ): Promise { + const request = new SvixRequest(HttpMethod.PUT, "/api/v1/stream/event-type/{name}"); + + request.setPathParam("name", name); + request.setBody(StreamEventTypeInSerializer._toJsonObject(streamEventTypeIn)); + + return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject); + } + + /** Delete an event type. */ + public delete(name: string): Promise { + const request = new SvixRequest( + HttpMethod.DELETE, + "/api/v1/stream/event-type/{name}" + ); + + request.setPathParam("name", name); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Patch an event type for Streams. */ + public patch( + name: string, + streamEventTypePatch: StreamEventTypePatch + ): Promise { + const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/stream/event-type/{name}"); + + request.setPathParam("name", name); + request.setBody(StreamEventTypePatchSerializer._toJsonObject(streamEventTypePatch)); + + return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/streamEvents.ts b/javascript/src/api_internal/streamEvents.ts new file mode 100644 index 000000000..6e204f4f4 --- /dev/null +++ b/javascript/src/api_internal/streamEvents.ts @@ -0,0 +1,51 @@ +// this file is @generated +import { CreateStreamIn, CreateStreamInSerializer } from "../models/createStreamIn"; +import { CreateStreamOut, CreateStreamOutSerializer } from "../models/createStreamOut"; +import { EventStreamOut, EventStreamOutSerializer } from "../models/eventStreamOut"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface StreamEventsGetOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + after?: Date | null; +} + +export interface StreamEventsCreateOptions { + idempotencyKey?: string; +} + +export class StreamEvents { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** Iterate over a stream of events. */ + public get( + streamId: string, + options?: StreamEventsGetOptions + ): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/{stream_id}/events"); + + request.setPathParam("stream_id", streamId); + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("after", options?.after); + + return request.send(this.requestCtx, EventStreamOutSerializer._fromJsonObject); + } + + /** Creates events on the Stream. */ + public create( + streamId: string, + createStreamIn: CreateStreamIn, + options?: StreamEventsCreateOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream/{stream_id}/events"); + + request.setPathParam("stream_id", streamId); + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(CreateStreamInSerializer._toJsonObject(createStreamIn)); + + return request.send(this.requestCtx, CreateStreamOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/api_internal/streamStream.ts b/javascript/src/api_internal/streamStream.ts new file mode 100644 index 000000000..b483690cd --- /dev/null +++ b/javascript/src/api_internal/streamStream.ts @@ -0,0 +1,89 @@ +// this file is @generated +import { + ListResponseStreamOut, + ListResponseStreamOutSerializer, +} from "../models/listResponseStreamOut"; +import { Ordering } from "../models/ordering"; +import { StreamIn, StreamInSerializer } from "../models/streamIn"; +import { StreamOut, StreamOutSerializer } from "../models/streamOut"; +import { StreamPatch, StreamPatchSerializer } from "../models/streamPatch"; +import { HttpMethod, SvixRequest, SvixRequestContext } from "../request"; + +export interface StreamStreamListOptions { + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** The sorting order of the returned items */ + order?: Ordering; +} + +export interface StreamStreamCreateOptions { + idempotencyKey?: string; +} + +export class StreamStream { + public constructor(private readonly requestCtx: SvixRequestContext) {} + + /** List of all the organization's streams. */ + public list(options?: StreamStreamListOptions): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream"); + + request.setQueryParam("limit", options?.limit); + request.setQueryParam("iterator", options?.iterator); + request.setQueryParam("order", options?.order); + + return request.send(this.requestCtx, ListResponseStreamOutSerializer._fromJsonObject); + } + + /** Creates a new stream. */ + public create( + streamIn: StreamIn, + options?: StreamStreamCreateOptions + ): Promise { + const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream"); + + request.setHeaderParam("idempotency-key", options?.idempotencyKey); + request.setBody(StreamInSerializer._toJsonObject(streamIn)); + + return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject); + } + + /** Get a stream by id or uid. */ + public get(streamId: string): Promise { + const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/{stream_id}"); + + request.setPathParam("stream_id", streamId); + + return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject); + } + + /** Update a stream. */ + public update(streamId: string, streamIn: StreamIn): Promise { + const request = new SvixRequest(HttpMethod.PUT, "/api/v1/stream/{stream_id}"); + + request.setPathParam("stream_id", streamId); + request.setBody(StreamInSerializer._toJsonObject(streamIn)); + + return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject); + } + + /** Delete a stream. */ + public delete(streamId: string): Promise { + const request = new SvixRequest(HttpMethod.DELETE, "/api/v1/stream/{stream_id}"); + + request.setPathParam("stream_id", streamId); + + return request.sendNoResponseBody(this.requestCtx); + } + + /** Partially update a stream. */ + public patch(streamId: string, streamPatch: StreamPatch): Promise { + const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/stream/{stream_id}"); + + request.setPathParam("stream_id", streamId); + request.setBody(StreamPatchSerializer._toJsonObject(streamPatch)); + + return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject); + } +} diff --git a/javascript/src/models/applicationStats.ts b/javascript/src/models/applicationStats.ts new file mode 100644 index 000000000..57a28a05b --- /dev/null +++ b/javascript/src/models/applicationStats.ts @@ -0,0 +1,28 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface ApplicationStats { + /** The Application's ID. */ + appId: string; + /** The Application's UID. */ + appUid?: string | null; + messageDestinations: number; +} + +export const ApplicationStatsSerializer = { + _fromJsonObject(object: any): ApplicationStats { + return { + appId: object["appId"], + appUid: object["appUid"], + messageDestinations: object["messageDestinations"], + }; + }, + + _toJsonObject(self: ApplicationStats): any { + return { + appId: self.appId, + appUid: self.appUid, + messageDestinations: self.messageDestinations, + }; + }, +}; diff --git a/javascript/src/models/attemptStatisticsData.ts b/javascript/src/models/attemptStatisticsData.ts new file mode 100644 index 000000000..8b7020640 --- /dev/null +++ b/javascript/src/models/attemptStatisticsData.ts @@ -0,0 +1,23 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface AttemptStatisticsData { + failureCount?: number[] | null; + successCount?: number[] | null; +} + +export const AttemptStatisticsDataSerializer = { + _fromJsonObject(object: any): AttemptStatisticsData { + return { + failureCount: object["failureCount"], + successCount: object["successCount"], + }; + }, + + _toJsonObject(self: AttemptStatisticsData): any { + return { + failureCount: self.failureCount, + successCount: self.successCount, + }; + }, +}; diff --git a/javascript/src/models/attemptStatisticsResponse.ts b/javascript/src/models/attemptStatisticsResponse.ts new file mode 100644 index 000000000..7b1cb5232 --- /dev/null +++ b/javascript/src/models/attemptStatisticsResponse.ts @@ -0,0 +1,34 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + AttemptStatisticsData, + AttemptStatisticsDataSerializer, +} from "./attemptStatisticsData"; +import { StatisticsPeriod, StatisticsPeriodSerializer } from "./statisticsPeriod"; + +export interface AttemptStatisticsResponse { + data: AttemptStatisticsData; + endDate: Date; + period: StatisticsPeriod; + startDate: Date; +} + +export const AttemptStatisticsResponseSerializer = { + _fromJsonObject(object: any): AttemptStatisticsResponse { + return { + data: AttemptStatisticsDataSerializer._fromJsonObject(object["data"]), + endDate: new Date(object["endDate"]), + period: StatisticsPeriodSerializer._fromJsonObject(object["period"]), + startDate: new Date(object["startDate"]), + }; + }, + + _toJsonObject(self: AttemptStatisticsResponse): any { + return { + data: AttemptStatisticsDataSerializer._toJsonObject(self.data), + endDate: self.endDate, + period: StatisticsPeriodSerializer._toJsonObject(self.period), + startDate: self.startDate, + }; + }, +}; diff --git a/javascript/src/models/authTokenOut.ts b/javascript/src/models/authTokenOut.ts new file mode 100644 index 000000000..de84d906d --- /dev/null +++ b/javascript/src/models/authTokenOut.ts @@ -0,0 +1,36 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface AuthTokenOut { + createdAt: Date; + expiresAt?: Date | null; + /** The ApplicationToken's ID. */ + id: string; + name?: string | null; + scopes?: string[] | null; + token: string; +} + +export const AuthTokenOutSerializer = { + _fromJsonObject(object: any): AuthTokenOut { + return { + createdAt: new Date(object["createdAt"]), + expiresAt: new Date(object["expiresAt"]), + id: object["id"], + name: object["name"], + scopes: object["scopes"], + token: object["token"], + }; + }, + + _toJsonObject(self: AuthTokenOut): any { + return { + createdAt: self.createdAt, + expiresAt: self.expiresAt, + id: self.id, + name: self.name, + scopes: self.scopes, + token: self.token, + }; + }, +}; diff --git a/javascript/src/models/clientSecretJwtParamsIn.ts b/javascript/src/models/clientSecretJwtParamsIn.ts new file mode 100644 index 000000000..74f01c1ad --- /dev/null +++ b/javascript/src/models/clientSecretJwtParamsIn.ts @@ -0,0 +1,41 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + OauthJwsSigningAlgorithm, + OauthJwsSigningAlgorithmSerializer, +} from "./oauthJwsSigningAlgorithm"; + +export interface ClientSecretJwtParamsIn { + /** The base64-encoded secret used for signing the JWT. */ + secretBase64: string; + /** Optional secret identifier. If supplied, this will be populated in the JWT header in the `kid` field. */ + secretId?: string | null; + /** The algorithm used to sign the JWT. */ + signingAlgorithm: OauthJwsSigningAlgorithm; + /** Optional number of seconds after which the JWT should expire. Defaults to 300 seconds. */ + tokenExpirySecs?: number | null; +} + +export const ClientSecretJwtParamsInSerializer = { + _fromJsonObject(object: any): ClientSecretJwtParamsIn { + return { + secretBase64: object["secretBase64"], + secretId: object["secretId"], + signingAlgorithm: OauthJwsSigningAlgorithmSerializer._fromJsonObject( + object["signingAlgorithm"] + ), + tokenExpirySecs: object["tokenExpirySecs"], + }; + }, + + _toJsonObject(self: ClientSecretJwtParamsIn): any { + return { + secretBase64: self.secretBase64, + secretId: self.secretId, + signingAlgorithm: OauthJwsSigningAlgorithmSerializer._toJsonObject( + self.signingAlgorithm + ), + tokenExpirySecs: self.tokenExpirySecs, + }; + }, +}; diff --git a/javascript/src/models/completionChoice.ts b/javascript/src/models/completionChoice.ts new file mode 100644 index 000000000..443a0cf08 --- /dev/null +++ b/javascript/src/models/completionChoice.ts @@ -0,0 +1,27 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { CompletionMessage, CompletionMessageSerializer } from "./completionMessage"; + +export interface CompletionChoice { + finishReason: string; + index: number; + message: CompletionMessage; +} + +export const CompletionChoiceSerializer = { + _fromJsonObject(object: any): CompletionChoice { + return { + finishReason: object["finish_reason"], + index: object["index"], + message: CompletionMessageSerializer._fromJsonObject(object["message"]), + }; + }, + + _toJsonObject(self: CompletionChoice): any { + return { + finish_reason: self.finishReason, + index: self.index, + message: CompletionMessageSerializer._toJsonObject(self.message), + }; + }, +}; diff --git a/javascript/src/models/completionMessage.ts b/javascript/src/models/completionMessage.ts new file mode 100644 index 000000000..fd7aef240 --- /dev/null +++ b/javascript/src/models/completionMessage.ts @@ -0,0 +1,23 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface CompletionMessage { + content: string; + role: string; +} + +export const CompletionMessageSerializer = { + _fromJsonObject(object: any): CompletionMessage { + return { + content: object["content"], + role: object["role"], + }; + }, + + _toJsonObject(self: CompletionMessage): any { + return { + content: self.content, + role: self.role, + }; + }, +}; diff --git a/javascript/src/models/connectorPatch.ts b/javascript/src/models/connectorPatch.ts new file mode 100644 index 000000000..50726f2c9 --- /dev/null +++ b/javascript/src/models/connectorPatch.ts @@ -0,0 +1,47 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { ConnectorKind, ConnectorKindSerializer } from "./connectorKind"; + +export interface ConnectorPatch { + description?: string; + featureFlag?: string | null; + filterTypes?: string[] | null; + instructions?: string; + instructionsLink?: string | null; + kind?: ConnectorKind; + logo?: string; + name?: string; + transformation?: string; +} + +export const ConnectorPatchSerializer = { + _fromJsonObject(object: any): ConnectorPatch { + return { + description: object["description"], + featureFlag: object["featureFlag"], + filterTypes: object["filterTypes"], + instructions: object["instructions"], + instructionsLink: object["instructionsLink"], + kind: object["kind"] + ? ConnectorKindSerializer._fromJsonObject(object["kind"]) + : undefined, + logo: object["logo"], + name: object["name"], + transformation: object["transformation"], + }; + }, + + _toJsonObject(self: ConnectorPatch): any { + return { + description: self.description, + featureFlag: self.featureFlag, + filterTypes: self.filterTypes, + instructions: self.instructions, + instructionsLink: self.instructionsLink, + kind: self.kind ? ConnectorKindSerializer._toJsonObject(self.kind) : undefined, + logo: self.logo, + name: self.name, + transformation: self.transformation, + }; + }, +}; diff --git a/javascript/src/models/countOut.ts b/javascript/src/models/countOut.ts new file mode 100644 index 000000000..52bbb6d41 --- /dev/null +++ b/javascript/src/models/countOut.ts @@ -0,0 +1,25 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface CountOut { + /** There's a ceiling to how many attempts we count. When the limit is reached, this will be `true` to indicate the actual count is higher than given. */ + approximated: boolean; + /** The count of attempts matching the query. */ + count: number; +} + +export const CountOutSerializer = { + _fromJsonObject(object: any): CountOut { + return { + approximated: object["approximated"], + count: object["count"], + }; + }, + + _toJsonObject(self: CountOut): any { + return { + approximated: self.approximated, + count: self.count, + }; + }, +}; diff --git a/javascript/src/models/createStreamIn.ts b/javascript/src/models/createStreamIn.ts new file mode 100644 index 000000000..d17bf84c3 --- /dev/null +++ b/javascript/src/models/createStreamIn.ts @@ -0,0 +1,34 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { EventIn, EventInSerializer } from "./eventIn"; +import { StreamIn, StreamInSerializer } from "./streamIn"; + +export interface CreateStreamIn { + events: EventIn[]; + /** + * Optionally creates a new Stream alongside the events. + * + * If the stream id or uid that is used in the path already exists, this argument is ignored. + */ + stream?: StreamIn | null; +} + +export const CreateStreamInSerializer = { + _fromJsonObject(object: any): CreateStreamIn { + return { + events: object["events"].map((item: EventIn) => + EventInSerializer._fromJsonObject(item) + ), + stream: object["stream"] + ? StreamInSerializer._fromJsonObject(object["stream"]) + : undefined, + }; + }, + + _toJsonObject(self: CreateStreamIn): any { + return { + events: self.events.map((item) => EventInSerializer._toJsonObject(item)), + stream: self.stream ? StreamInSerializer._toJsonObject(self.stream) : undefined, + }; + }, +}; diff --git a/javascript/src/models/createStreamOut.ts b/javascript/src/models/createStreamOut.ts new file mode 100644 index 000000000..eb197177e --- /dev/null +++ b/javascript/src/models/createStreamOut.ts @@ -0,0 +1,16 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +/* eslint @typescript-eslint/no-empty-object-type: 0 */ +/* eslint @typescript-eslint/no-unused-vars: 0 */ + +export interface CreateStreamOut {} + +export const CreateStreamOutSerializer = { + _fromJsonObject(object: any): CreateStreamOut { + return {}; + }, + + _toJsonObject(self: CreateStreamOut): any { + return {}; + }, +}; diff --git a/javascript/src/models/createTokenIn.ts b/javascript/src/models/createTokenIn.ts new file mode 100644 index 000000000..ebcb6848b --- /dev/null +++ b/javascript/src/models/createTokenIn.ts @@ -0,0 +1,25 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface CreateTokenIn { + /** How long the token will be valid for, in seconds. */ + expiry?: number | null; + /** The name of the token. */ + name: string; +} + +export const CreateTokenInSerializer = { + _fromJsonObject(object: any): CreateTokenIn { + return { + expiry: object["expiry"], + name: object["name"], + }; + }, + + _toJsonObject(self: CreateTokenIn): any { + return { + expiry: self.expiry, + name: self.name, + }; + }, +}; diff --git a/javascript/src/models/endpointMtlsConfigIn.ts b/javascript/src/models/endpointMtlsConfigIn.ts new file mode 100644 index 000000000..c1ce22d77 --- /dev/null +++ b/javascript/src/models/endpointMtlsConfigIn.ts @@ -0,0 +1,25 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EndpointMtlsConfigIn { + /** A PEM encoded private key and X509 certificate to identify the webhook sender. */ + identity: string; + /** A PEM encoded X509 certificate used to verify the webhook receiver's certificate. */ + serverCaCert?: string | null; +} + +export const EndpointMtlsConfigInSerializer = { + _fromJsonObject(object: any): EndpointMtlsConfigIn { + return { + identity: object["identity"], + serverCaCert: object["serverCaCert"], + }; + }, + + _toJsonObject(self: EndpointMtlsConfigIn): any { + return { + identity: self.identity, + serverCaCert: self.serverCaCert, + }; + }, +}; diff --git a/javascript/src/models/endpointMtlsConfigOut.ts b/javascript/src/models/endpointMtlsConfigOut.ts new file mode 100644 index 000000000..402d463e4 --- /dev/null +++ b/javascript/src/models/endpointMtlsConfigOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EndpointMtlsConfigOut { + serverCaCert?: string | null; +} + +export const EndpointMtlsConfigOutSerializer = { + _fromJsonObject(object: any): EndpointMtlsConfigOut { + return { + serverCaCert: object["serverCaCert"], + }; + }, + + _toJsonObject(self: EndpointMtlsConfigOut): any { + return { + serverCaCert: self.serverCaCert, + }; + }, +}; diff --git a/javascript/src/models/endpointOauthConfigIn.ts b/javascript/src/models/endpointOauthConfigIn.ts new file mode 100644 index 000000000..8c299cce2 --- /dev/null +++ b/javascript/src/models/endpointOauthConfigIn.ts @@ -0,0 +1,72 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + ClientSecretJwtParamsIn, + ClientSecretJwtParamsInSerializer, +} from "./clientSecretJwtParamsIn"; +import { + Oauth2AuthMethodInOut, + Oauth2AuthMethodInOutSerializer, +} from "./oauth2AuthMethodInOut"; +import { + Oauth2GrantTypeInOut, + Oauth2GrantTypeInOutSerializer, +} from "./oauth2GrantTypeInOut"; + +export interface EndpointOauthConfigIn { + authMethod: Oauth2AuthMethodInOut; + /** The client ID. Required for all authentication types. */ + clientId: string; + /** + * Optional client secret. This is only used for `clientSecretBasic` and `clientSecretPost`. + * + * For `clientSecretBasic`, the secret will be appended to the `Authorization` header. For `clientSecretPost`, this will be added to the body in a `client_secret` parameter. + */ + clientSecret?: string | null; + /** Extra parameters added to the request body as key-value pairs. */ + extraParams?: { [key: string]: string } | null; + /** The OAuth grant type. */ + grantType: Oauth2GrantTypeInOut; + /** Optional JWT parameters. Only required for `clientSecretJwt` */ + jwtParams?: ClientSecretJwtParamsIn | null; + /** For `refreshToken` grant type. */ + refreshToken?: string | null; + /** Optional OAuth scopes added to the request body. */ + scopes?: string[] | null; + /** The URL of the authorization server. */ + tokenUrl: string; +} + +export const EndpointOauthConfigInSerializer = { + _fromJsonObject(object: any): EndpointOauthConfigIn { + return { + authMethod: Oauth2AuthMethodInOutSerializer._fromJsonObject(object["authMethod"]), + clientId: object["clientId"], + clientSecret: object["clientSecret"], + extraParams: object["extraParams"], + grantType: Oauth2GrantTypeInOutSerializer._fromJsonObject(object["grantType"]), + jwtParams: object["jwtParams"] + ? ClientSecretJwtParamsInSerializer._fromJsonObject(object["jwtParams"]) + : undefined, + refreshToken: object["refreshToken"], + scopes: object["scopes"], + tokenUrl: object["tokenUrl"], + }; + }, + + _toJsonObject(self: EndpointOauthConfigIn): any { + return { + authMethod: Oauth2AuthMethodInOutSerializer._toJsonObject(self.authMethod), + clientId: self.clientId, + clientSecret: self.clientSecret, + extraParams: self.extraParams, + grantType: Oauth2GrantTypeInOutSerializer._toJsonObject(self.grantType), + jwtParams: self.jwtParams + ? ClientSecretJwtParamsInSerializer._toJsonObject(self.jwtParams) + : undefined, + refreshToken: self.refreshToken, + scopes: self.scopes, + tokenUrl: self.tokenUrl, + }; + }, +}; diff --git a/javascript/src/models/endpointOauthConfigOut.ts b/javascript/src/models/endpointOauthConfigOut.ts new file mode 100644 index 000000000..dff824aa3 --- /dev/null +++ b/javascript/src/models/endpointOauthConfigOut.ts @@ -0,0 +1,43 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + Oauth2AuthMethodInOut, + Oauth2AuthMethodInOutSerializer, +} from "./oauth2AuthMethodInOut"; +import { + Oauth2GrantTypeInOut, + Oauth2GrantTypeInOutSerializer, +} from "./oauth2GrantTypeInOut"; + +export interface EndpointOauthConfigOut { + authMethod: Oauth2AuthMethodInOut; + clientId: string; + extraParams?: { [key: string]: string } | null; + grantType: Oauth2GrantTypeInOut; + scopes?: string[] | null; + tokenUrl: string; +} + +export const EndpointOauthConfigOutSerializer = { + _fromJsonObject(object: any): EndpointOauthConfigOut { + return { + authMethod: Oauth2AuthMethodInOutSerializer._fromJsonObject(object["authMethod"]), + clientId: object["clientId"], + extraParams: object["extraParams"], + grantType: Oauth2GrantTypeInOutSerializer._fromJsonObject(object["grantType"]), + scopes: object["scopes"], + tokenUrl: object["tokenUrl"], + }; + }, + + _toJsonObject(self: EndpointOauthConfigOut): any { + return { + authMethod: Oauth2AuthMethodInOutSerializer._toJsonObject(self.authMethod), + clientId: self.clientId, + extraParams: self.extraParams, + grantType: Oauth2GrantTypeInOutSerializer._toJsonObject(self.grantType), + scopes: self.scopes, + tokenUrl: self.tokenUrl, + }; + }, +}; diff --git a/javascript/src/models/endpointTransformationSimulateIn.ts b/javascript/src/models/endpointTransformationSimulateIn.ts new file mode 100644 index 000000000..c532f7fed --- /dev/null +++ b/javascript/src/models/endpointTransformationSimulateIn.ts @@ -0,0 +1,30 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EndpointTransformationSimulateIn { + channels?: string[] | null; + code: string; + /** The event type's name */ + eventType: string; + payload: any; +} + +export const EndpointTransformationSimulateInSerializer = { + _fromJsonObject(object: any): EndpointTransformationSimulateIn { + return { + channels: object["channels"], + code: object["code"], + eventType: object["eventType"], + payload: object["payload"], + }; + }, + + _toJsonObject(self: EndpointTransformationSimulateIn): any { + return { + channels: self.channels, + code: self.code, + eventType: self.eventType, + payload: self.payload, + }; + }, +}; diff --git a/javascript/src/models/endpointTransformationSimulateOut.ts b/javascript/src/models/endpointTransformationSimulateOut.ts new file mode 100644 index 000000000..89da97d5e --- /dev/null +++ b/javascript/src/models/endpointTransformationSimulateOut.ts @@ -0,0 +1,34 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + TransformationHttpMethod, + TransformationHttpMethodSerializer, +} from "./transformationHttpMethod"; + +export interface EndpointTransformationSimulateOut { + method?: TransformationHttpMethod | null; + payload: string; + url: string; +} + +export const EndpointTransformationSimulateOutSerializer = { + _fromJsonObject(object: any): EndpointTransformationSimulateOut { + return { + method: object["method"] + ? TransformationHttpMethodSerializer._fromJsonObject(object["method"]) + : undefined, + payload: object["payload"], + url: object["url"], + }; + }, + + _toJsonObject(self: EndpointTransformationSimulateOut): any { + return { + method: self.method + ? TransformationHttpMethodSerializer._toJsonObject(self.method) + : undefined, + payload: self.payload, + url: self.url, + }; + }, +}; diff --git a/javascript/src/models/eventIn.ts b/javascript/src/models/eventIn.ts new file mode 100644 index 000000000..f2e2efa48 --- /dev/null +++ b/javascript/src/models/eventIn.ts @@ -0,0 +1,24 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EventIn { + /** The event type's name */ + eventType?: string | null; + payload: string; +} + +export const EventInSerializer = { + _fromJsonObject(object: any): EventIn { + return { + eventType: object["eventType"], + payload: object["payload"], + }; + }, + + _toJsonObject(self: EventIn): any { + return { + eventType: self.eventType, + payload: self.payload, + }; + }, +}; diff --git a/javascript/src/models/eventOut.ts b/javascript/src/models/eventOut.ts new file mode 100644 index 000000000..74105c1a1 --- /dev/null +++ b/javascript/src/models/eventOut.ts @@ -0,0 +1,27 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EventOut { + /** The event type's name */ + eventType?: string | null; + payload: string; + timestamp: Date; +} + +export const EventOutSerializer = { + _fromJsonObject(object: any): EventOut { + return { + eventType: object["eventType"], + payload: object["payload"], + timestamp: new Date(object["timestamp"]), + }; + }, + + _toJsonObject(self: EventOut): any { + return { + eventType: self.eventType, + payload: self.payload, + timestamp: self.timestamp, + }; + }, +}; diff --git a/javascript/src/models/eventStreamOut.ts b/javascript/src/models/eventStreamOut.ts new file mode 100644 index 000000000..e2aba06fd --- /dev/null +++ b/javascript/src/models/eventStreamOut.ts @@ -0,0 +1,29 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { EventOut, EventOutSerializer } from "./eventOut"; + +export interface EventStreamOut { + data: EventOut[]; + done: boolean; + iterator: string; +} + +export const EventStreamOutSerializer = { + _fromJsonObject(object: any): EventStreamOut { + return { + data: object["data"].map((item: EventOut) => + EventOutSerializer._fromJsonObject(item) + ), + done: object["done"], + iterator: object["iterator"], + }; + }, + + _toJsonObject(self: EventStreamOut): any { + return { + data: self.data.map((item) => EventOutSerializer._toJsonObject(item)), + done: self.done, + iterator: self.iterator, + }; + }, +}; diff --git a/javascript/src/models/eventTypeExampleOut.ts b/javascript/src/models/eventTypeExampleOut.ts new file mode 100644 index 000000000..4615a3e9f --- /dev/null +++ b/javascript/src/models/eventTypeExampleOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EventTypeExampleOut { + example: any; +} + +export const EventTypeExampleOutSerializer = { + _fromJsonObject(object: any): EventTypeExampleOut { + return { + example: object["example"], + }; + }, + + _toJsonObject(self: EventTypeExampleOut): any { + return { + example: self.example, + }; + }, +}; diff --git a/javascript/src/models/eventTypeSchemaIn.ts b/javascript/src/models/eventTypeSchemaIn.ts new file mode 100644 index 000000000..66836fd1c --- /dev/null +++ b/javascript/src/models/eventTypeSchemaIn.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface EventTypeSchemaIn { + schema: any; +} + +export const EventTypeSchemaInSerializer = { + _fromJsonObject(object: any): EventTypeSchemaIn { + return { + schema: object["schema"], + }; + }, + + _toJsonObject(self: EventTypeSchemaIn): any { + return { + schema: self.schema, + }; + }, +}; diff --git a/javascript/src/models/exportEventTypeOut.ts b/javascript/src/models/exportEventTypeOut.ts new file mode 100644 index 000000000..c1f49b882 --- /dev/null +++ b/javascript/src/models/exportEventTypeOut.ts @@ -0,0 +1,32 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + BackgroundTaskStatus, + BackgroundTaskStatusSerializer, +} from "./backgroundTaskStatus"; +import { BackgroundTaskType, BackgroundTaskTypeSerializer } from "./backgroundTaskType"; + +export interface ExportEventTypeOut { + /** The QueueBackgroundTask's ID. */ + id: string; + status: BackgroundTaskStatus; + task: BackgroundTaskType; +} + +export const ExportEventTypeOutSerializer = { + _fromJsonObject(object: any): ExportEventTypeOut { + return { + id: object["id"], + status: BackgroundTaskStatusSerializer._fromJsonObject(object["status"]), + task: BackgroundTaskTypeSerializer._fromJsonObject(object["task"]), + }; + }, + + _toJsonObject(self: ExportEventTypeOut): any { + return { + id: self.id, + status: BackgroundTaskStatusSerializer._toJsonObject(self.status), + task: BackgroundTaskTypeSerializer._toJsonObject(self.task), + }; + }, +}; diff --git a/javascript/src/models/generateIn.ts b/javascript/src/models/generateIn.ts new file mode 100644 index 000000000..dda8330b2 --- /dev/null +++ b/javascript/src/models/generateIn.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface GenerateIn { + prompt: string; +} + +export const GenerateInSerializer = { + _fromJsonObject(object: any): GenerateIn { + return { + prompt: object["prompt"], + }; + }, + + _toJsonObject(self: GenerateIn): any { + return { + prompt: self.prompt, + }; + }, +}; diff --git a/javascript/src/models/generateOut.ts b/javascript/src/models/generateOut.ts new file mode 100644 index 000000000..c0e520a10 --- /dev/null +++ b/javascript/src/models/generateOut.ts @@ -0,0 +1,35 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { CompletionChoice, CompletionChoiceSerializer } from "./completionChoice"; + +export interface GenerateOut { + choices: CompletionChoice[]; + created: number; + id: string; + model: string; + object: string; +} + +export const GenerateOutSerializer = { + _fromJsonObject(object: any): GenerateOut { + return { + choices: object["choices"].map((item: CompletionChoice) => + CompletionChoiceSerializer._fromJsonObject(item) + ), + created: object["created"], + id: object["id"], + model: object["model"], + object: object["object"], + }; + }, + + _toJsonObject(self: GenerateOut): any { + return { + choices: self.choices.map((item) => CompletionChoiceSerializer._toJsonObject(item)), + created: self.created, + id: self.id, + model: self.model, + object: self.object, + }; + }, +}; diff --git a/javascript/src/models/hubspotOauthConfigIn.ts b/javascript/src/models/hubspotOauthConfigIn.ts new file mode 100644 index 000000000..f545e3e2e --- /dev/null +++ b/javascript/src/models/hubspotOauthConfigIn.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface HubspotOauthConfigIn { + refreshToken: string; +} + +export const HubspotOauthConfigInSerializer = { + _fromJsonObject(object: any): HubspotOauthConfigIn { + return { + refreshToken: object["refresh_token"], + }; + }, + + _toJsonObject(self: HubspotOauthConfigIn): any { + return { + refresh_token: self.refreshToken, + }; + }, +}; diff --git a/javascript/src/models/incomingWebhookPayloadOut.ts b/javascript/src/models/incomingWebhookPayloadOut.ts new file mode 100644 index 000000000..6bd79bab7 --- /dev/null +++ b/javascript/src/models/incomingWebhookPayloadOut.ts @@ -0,0 +1,26 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface IncomingWebhookPayloadOut { + channel?: string | null; + error?: string | null; + incomingWebhookUrl?: string | null; +} + +export const IncomingWebhookPayloadOutSerializer = { + _fromJsonObject(object: any): IncomingWebhookPayloadOut { + return { + channel: object["channel"], + error: object["error"], + incomingWebhookUrl: object["incomingWebhookUrl"], + }; + }, + + _toJsonObject(self: IncomingWebhookPayloadOut): any { + return { + channel: self.channel, + error: self.error, + incomingWebhookUrl: self.incomingWebhookUrl, + }; + }, +}; diff --git a/javascript/src/models/listResponseConnectorOut.ts b/javascript/src/models/listResponseConnectorOut.ts new file mode 100644 index 000000000..1a530e298 --- /dev/null +++ b/javascript/src/models/listResponseConnectorOut.ts @@ -0,0 +1,32 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { ConnectorOut, ConnectorOutSerializer } from "./connectorOut"; + +export interface ListResponseConnectorOut { + data: ConnectorOut[]; + done: boolean; + iterator: string | null; + prevIterator?: string | null; +} + +export const ListResponseConnectorOutSerializer = { + _fromJsonObject(object: any): ListResponseConnectorOut { + return { + data: object["data"].map((item: ConnectorOut) => + ConnectorOutSerializer._fromJsonObject(item) + ), + done: object["done"], + iterator: object["iterator"], + prevIterator: object["prevIterator"], + }; + }, + + _toJsonObject(self: ListResponseConnectorOut): any { + return { + data: self.data.map((item) => ConnectorOutSerializer._toJsonObject(item)), + done: self.done, + iterator: self.iterator, + prevIterator: self.prevIterator, + }; + }, +}; diff --git a/javascript/src/models/listResponseStreamEventTypeOut.ts b/javascript/src/models/listResponseStreamEventTypeOut.ts new file mode 100644 index 000000000..1707ba5a7 --- /dev/null +++ b/javascript/src/models/listResponseStreamEventTypeOut.ts @@ -0,0 +1,32 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { StreamEventTypeOut, StreamEventTypeOutSerializer } from "./streamEventTypeOut"; + +export interface ListResponseStreamEventTypeOut { + data: StreamEventTypeOut[]; + done: boolean; + iterator: string | null; + prevIterator?: string | null; +} + +export const ListResponseStreamEventTypeOutSerializer = { + _fromJsonObject(object: any): ListResponseStreamEventTypeOut { + return { + data: object["data"].map((item: StreamEventTypeOut) => + StreamEventTypeOutSerializer._fromJsonObject(item) + ), + done: object["done"], + iterator: object["iterator"], + prevIterator: object["prevIterator"], + }; + }, + + _toJsonObject(self: ListResponseStreamEventTypeOut): any { + return { + data: self.data.map((item) => StreamEventTypeOutSerializer._toJsonObject(item)), + done: self.done, + iterator: self.iterator, + prevIterator: self.prevIterator, + }; + }, +}; diff --git a/javascript/src/models/listResponseStreamOut.ts b/javascript/src/models/listResponseStreamOut.ts new file mode 100644 index 000000000..0bb6be555 --- /dev/null +++ b/javascript/src/models/listResponseStreamOut.ts @@ -0,0 +1,32 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { StreamOut, StreamOutSerializer } from "./streamOut"; + +export interface ListResponseStreamOut { + data: StreamOut[]; + done: boolean; + iterator: string | null; + prevIterator?: string | null; +} + +export const ListResponseStreamOutSerializer = { + _fromJsonObject(object: any): ListResponseStreamOut { + return { + data: object["data"].map((item: StreamOut) => + StreamOutSerializer._fromJsonObject(item) + ), + done: object["done"], + iterator: object["iterator"], + prevIterator: object["prevIterator"], + }; + }, + + _toJsonObject(self: ListResponseStreamOut): any { + return { + data: self.data.map((item) => StreamOutSerializer._toJsonObject(item)), + done: self.done, + iterator: self.iterator, + prevIterator: self.prevIterator, + }; + }, +}; diff --git a/javascript/src/models/messageAttemptHeadersOut.ts b/javascript/src/models/messageAttemptHeadersOut.ts new file mode 100644 index 000000000..a31eaf4ee --- /dev/null +++ b/javascript/src/models/messageAttemptHeadersOut.ts @@ -0,0 +1,26 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface MessageAttemptHeadersOut { + responseHeaders?: string[][] | null; + sensitive: string[]; + sentHeaders: { [key: string]: string }; +} + +export const MessageAttemptHeadersOutSerializer = { + _fromJsonObject(object: any): MessageAttemptHeadersOut { + return { + responseHeaders: object["responseHeaders"].map((item: string[]) => item), + sensitive: object["sensitive"], + sentHeaders: object["sentHeaders"], + }; + }, + + _toJsonObject(self: MessageAttemptHeadersOut): any { + return { + responseHeaders: self.responseHeaders?.map((item) => item), + sensitive: self.sensitive, + sentHeaders: self.sentHeaders, + }; + }, +}; diff --git a/javascript/src/models/messageEventsOut.ts b/javascript/src/models/messageEventsOut.ts new file mode 100644 index 000000000..26bb86c61 --- /dev/null +++ b/javascript/src/models/messageEventsOut.ts @@ -0,0 +1,29 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { MessageOut, MessageOutSerializer } from "./messageOut"; + +export interface MessageEventsOut { + data: MessageOut[]; + done: boolean; + iterator: string; +} + +export const MessageEventsOutSerializer = { + _fromJsonObject(object: any): MessageEventsOut { + return { + data: object["data"].map((item: MessageOut) => + MessageOutSerializer._fromJsonObject(item) + ), + done: object["done"], + iterator: object["iterator"], + }; + }, + + _toJsonObject(self: MessageEventsOut): any { + return { + data: self.data.map((item) => MessageOutSerializer._toJsonObject(item)), + done: self.done, + iterator: self.iterator, + }; + }, +}; diff --git a/javascript/src/models/messagePrecheckIn.ts b/javascript/src/models/messagePrecheckIn.ts new file mode 100644 index 000000000..e96f95dd3 --- /dev/null +++ b/javascript/src/models/messagePrecheckIn.ts @@ -0,0 +1,24 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface MessagePrecheckIn { + channels?: string[] | null; + /** The event type's name */ + eventType: string; +} + +export const MessagePrecheckInSerializer = { + _fromJsonObject(object: any): MessagePrecheckIn { + return { + channels: object["channels"], + eventType: object["eventType"], + }; + }, + + _toJsonObject(self: MessagePrecheckIn): any { + return { + channels: self.channels, + eventType: self.eventType, + }; + }, +}; diff --git a/javascript/src/models/messagePrecheckOut.ts b/javascript/src/models/messagePrecheckOut.ts new file mode 100644 index 000000000..ba4d3e1b3 --- /dev/null +++ b/javascript/src/models/messagePrecheckOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface MessagePrecheckOut { + active: boolean; +} + +export const MessagePrecheckOutSerializer = { + _fromJsonObject(object: any): MessagePrecheckOut { + return { + active: object["active"], + }; + }, + + _toJsonObject(self: MessagePrecheckOut): any { + return { + active: self.active, + }; + }, +}; diff --git a/javascript/src/models/messageRawPayloadOut.ts b/javascript/src/models/messageRawPayloadOut.ts new file mode 100644 index 000000000..51f45fbd3 --- /dev/null +++ b/javascript/src/models/messageRawPayloadOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface MessageRawPayloadOut { + payload: string; +} + +export const MessageRawPayloadOutSerializer = { + _fromJsonObject(object: any): MessageRawPayloadOut { + return { + payload: object["payload"], + }; + }, + + _toJsonObject(self: MessageRawPayloadOut): any { + return { + payload: self.payload, + }; + }, +}; diff --git a/javascript/src/models/messageSubscriberAuthTokenOut.ts b/javascript/src/models/messageSubscriberAuthTokenOut.ts new file mode 100644 index 000000000..8e58462a7 --- /dev/null +++ b/javascript/src/models/messageSubscriberAuthTokenOut.ts @@ -0,0 +1,23 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface MessageSubscriberAuthTokenOut { + bridgeToken: string; + token: string; +} + +export const MessageSubscriberAuthTokenOutSerializer = { + _fromJsonObject(object: any): MessageSubscriberAuthTokenOut { + return { + bridgeToken: object["bridgeToken"], + token: object["token"], + }; + }, + + _toJsonObject(self: MessageSubscriberAuthTokenOut): any { + return { + bridgeToken: self.bridgeToken, + token: self.token, + }; + }, +}; diff --git a/javascript/src/models/oAuthPayloadIn.ts b/javascript/src/models/oAuthPayloadIn.ts new file mode 100644 index 000000000..1914025ca --- /dev/null +++ b/javascript/src/models/oAuthPayloadIn.ts @@ -0,0 +1,23 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface OAuthPayloadIn { + code: string; + redirectUri: string; +} + +export const OAuthPayloadInSerializer = { + _fromJsonObject(object: any): OAuthPayloadIn { + return { + code: object["code"], + redirectUri: object["redirectUri"], + }; + }, + + _toJsonObject(self: OAuthPayloadIn): any { + return { + code: self.code, + redirectUri: self.redirectUri, + }; + }, +}; diff --git a/javascript/src/models/oAuthPayloadOut.ts b/javascript/src/models/oAuthPayloadOut.ts new file mode 100644 index 000000000..d288bec28 --- /dev/null +++ b/javascript/src/models/oAuthPayloadOut.ts @@ -0,0 +1,26 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface OAuthPayloadOut { + accessToken?: string | null; + error?: string | null; + refreshToken?: string | null; +} + +export const OAuthPayloadOutSerializer = { + _fromJsonObject(object: any): OAuthPayloadOut { + return { + accessToken: object["accessToken"], + error: object["error"], + refreshToken: object["refreshToken"], + }; + }, + + _toJsonObject(self: OAuthPayloadOut): any { + return { + accessToken: self.accessToken, + error: self.error, + refreshToken: self.refreshToken, + }; + }, +}; diff --git a/javascript/src/models/oauth2AuthMethodInOut.ts b/javascript/src/models/oauth2AuthMethodInOut.ts new file mode 100644 index 000000000..d45d6b6d2 --- /dev/null +++ b/javascript/src/models/oauth2AuthMethodInOut.ts @@ -0,0 +1,22 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +/** + * The method used for authenticating to the OAuth authorization server. + * + * `clientSecretJwt` will construct a JWT used for authentication with the oauth authorization server. This method is less commonly used and may not be supported by all oauth providers. `clientSecretBasic` will authenticate to the oauth authorization server using an `Authorization` header with the client secret as the value. This is the most common means of authentication. `clientSecretPost` will authenticate to the oauth authorization server by passing the client secret in a `client_secret` field in the request body. This method may not be supported by all oauth providers, and in general `clientSecretBasic` should be preferred. + */ +export enum Oauth2AuthMethodInOut { + ClientSecretJwt = "clientSecretJwt", + ClientSecretBasic = "clientSecretBasic", + ClientSecretPost = "clientSecretPost", +} + +export const Oauth2AuthMethodInOutSerializer = { + _fromJsonObject(object: any): Oauth2AuthMethodInOut { + return object; + }, + + _toJsonObject(self: Oauth2AuthMethodInOut): any { + return self; + }, +}; diff --git a/javascript/src/models/oauth2GrantTypeInOut.ts b/javascript/src/models/oauth2GrantTypeInOut.ts new file mode 100644 index 000000000..d1c8c6db1 --- /dev/null +++ b/javascript/src/models/oauth2GrantTypeInOut.ts @@ -0,0 +1,17 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export enum Oauth2GrantTypeInOut { + ClientCredentials = "clientCredentials", + RefreshToken = "refreshToken", +} + +export const Oauth2GrantTypeInOutSerializer = { + _fromJsonObject(object: any): Oauth2GrantTypeInOut { + return object; + }, + + _toJsonObject(self: Oauth2GrantTypeInOut): any { + return self; + }, +}; diff --git a/javascript/src/models/oauthJwsSigningAlgorithm.ts b/javascript/src/models/oauthJwsSigningAlgorithm.ts new file mode 100644 index 000000000..c07c2af72 --- /dev/null +++ b/javascript/src/models/oauthJwsSigningAlgorithm.ts @@ -0,0 +1,16 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export enum OauthJwsSigningAlgorithm { + Rs256 = "RS256", +} + +export const OauthJwsSigningAlgorithmSerializer = { + _fromJsonObject(object: any): OauthJwsSigningAlgorithm { + return object; + }, + + _toJsonObject(self: OauthJwsSigningAlgorithm): any { + return self; + }, +}; diff --git a/javascript/src/models/oneTimeTokenIn.ts b/javascript/src/models/oneTimeTokenIn.ts new file mode 100644 index 000000000..42f976e1e --- /dev/null +++ b/javascript/src/models/oneTimeTokenIn.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface OneTimeTokenIn { + oneTimeToken: string; +} + +export const OneTimeTokenInSerializer = { + _fromJsonObject(object: any): OneTimeTokenIn { + return { + oneTimeToken: object["oneTimeToken"], + }; + }, + + _toJsonObject(self: OneTimeTokenIn): any { + return { + oneTimeToken: self.oneTimeToken, + }; + }, +}; diff --git a/javascript/src/models/oneTimeTokenOut.ts b/javascript/src/models/oneTimeTokenOut.ts new file mode 100644 index 000000000..c0ceed15e --- /dev/null +++ b/javascript/src/models/oneTimeTokenOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface OneTimeTokenOut { + token: string; +} + +export const OneTimeTokenOutSerializer = { + _fromJsonObject(object: any): OneTimeTokenOut { + return { + token: object["token"], + }; + }, + + _toJsonObject(self: OneTimeTokenOut): any { + return { + token: self.token, + }; + }, +}; diff --git a/javascript/src/models/rotatePollerTokenIn.ts b/javascript/src/models/rotatePollerTokenIn.ts new file mode 100644 index 000000000..98b6f5eb3 --- /dev/null +++ b/javascript/src/models/rotatePollerTokenIn.ts @@ -0,0 +1,31 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface RotatePollerTokenIn { + /** How long the token will be valid for, in seconds. Can be up to 31,536,000 seconds (1 year). */ + expiry?: number | null; + /** + * Updates the previous token's expiration, in seconds. + * + * If set to 0, the old token will immediately be revoked. Must be between 0 and 86,400 seconds (1 day). + * + * Defaults to 300 seconds (5 minutes). + */ + oldTokenExpiry?: number; +} + +export const RotatePollerTokenInSerializer = { + _fromJsonObject(object: any): RotatePollerTokenIn { + return { + expiry: object["expiry"], + oldTokenExpiry: object["oldTokenExpiry"], + }; + }, + + _toJsonObject(self: RotatePollerTokenIn): any { + return { + expiry: self.expiry, + oldTokenExpiry: self.oldTokenExpiry, + }; + }, +}; diff --git a/javascript/src/models/rotatedUrlOut.ts b/javascript/src/models/rotatedUrlOut.ts new file mode 100644 index 000000000..ce3548912 --- /dev/null +++ b/javascript/src/models/rotatedUrlOut.ts @@ -0,0 +1,20 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface RotatedUrlOut { + url: string; +} + +export const RotatedUrlOutSerializer = { + _fromJsonObject(object: any): RotatedUrlOut { + return { + url: object["url"], + }; + }, + + _toJsonObject(self: RotatedUrlOut): any { + return { + url: self.url, + }; + }, +}; diff --git a/javascript/src/models/statisticsPeriod.ts b/javascript/src/models/statisticsPeriod.ts new file mode 100644 index 000000000..4f14f7734 --- /dev/null +++ b/javascript/src/models/statisticsPeriod.ts @@ -0,0 +1,17 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +/** Period length for a statistics data point. */ +export enum StatisticsPeriod { + OneDay = "OneDay", + FiveMinutes = "FiveMinutes", +} + +export const StatisticsPeriodSerializer = { + _fromJsonObject(object: any): StatisticsPeriod { + return object; + }, + + _toJsonObject(self: StatisticsPeriod): any { + return self; + }, +}; diff --git a/javascript/src/models/streamEventTypeIn.ts b/javascript/src/models/streamEventTypeIn.ts new file mode 100644 index 000000000..8a5ea57b0 --- /dev/null +++ b/javascript/src/models/streamEventTypeIn.ts @@ -0,0 +1,24 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamEventTypeIn { + description?: string | null; + /** The event type's name */ + name: string; +} + +export const StreamEventTypeInSerializer = { + _fromJsonObject(object: any): StreamEventTypeIn { + return { + description: object["description"], + name: object["name"], + }; + }, + + _toJsonObject(self: StreamEventTypeIn): any { + return { + description: self.description, + name: self.name, + }; + }, +}; diff --git a/javascript/src/models/streamEventTypeOut.ts b/javascript/src/models/streamEventTypeOut.ts new file mode 100644 index 000000000..abc8edd6f --- /dev/null +++ b/javascript/src/models/streamEventTypeOut.ts @@ -0,0 +1,30 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamEventTypeOut { + createdAt: Date; + description?: string | null; + /** The event type's name */ + name: string; + updatedAt: Date; +} + +export const StreamEventTypeOutSerializer = { + _fromJsonObject(object: any): StreamEventTypeOut { + return { + createdAt: new Date(object["createdAt"]), + description: object["description"], + name: object["name"], + updatedAt: new Date(object["updatedAt"]), + }; + }, + + _toJsonObject(self: StreamEventTypeOut): any { + return { + createdAt: self.createdAt, + description: self.description, + name: self.name, + updatedAt: self.updatedAt, + }; + }, +}; diff --git a/javascript/src/models/streamEventTypePatch.ts b/javascript/src/models/streamEventTypePatch.ts new file mode 100644 index 000000000..4c5ab72fc --- /dev/null +++ b/javascript/src/models/streamEventTypePatch.ts @@ -0,0 +1,24 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamEventTypePatch { + description: string | null; + /** The event type's name */ + name?: string | null; +} + +export const StreamEventTypePatchSerializer = { + _fromJsonObject(object: any): StreamEventTypePatch { + return { + description: object["description"], + name: object["name"], + }; + }, + + _toJsonObject(self: StreamEventTypePatch): any { + return { + description: self.description, + name: self.name, + }; + }, +}; diff --git a/javascript/src/models/streamIn.ts b/javascript/src/models/streamIn.ts new file mode 100644 index 000000000..ff9f05408 --- /dev/null +++ b/javascript/src/models/streamIn.ts @@ -0,0 +1,25 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamIn { + /** The stream's description. */ + description: string; + /** An optional unique identifier for the stream. */ + uid?: string | null; +} + +export const StreamInSerializer = { + _fromJsonObject(object: any): StreamIn { + return { + description: object["description"], + uid: object["uid"], + }; + }, + + _toJsonObject(self: StreamIn): any { + return { + description: self.description, + uid: self.uid, + }; + }, +}; diff --git a/javascript/src/models/streamOut.ts b/javascript/src/models/streamOut.ts new file mode 100644 index 000000000..88562b965 --- /dev/null +++ b/javascript/src/models/streamOut.ts @@ -0,0 +1,35 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamOut { + createdAt: Date; + /** The stream's description. */ + description?: string | null; + /** The stream's ID. */ + id: string; + /** The stream's UID. */ + uid?: string | null; + updatedAt: Date; +} + +export const StreamOutSerializer = { + _fromJsonObject(object: any): StreamOut { + return { + createdAt: new Date(object["createdAt"]), + description: object["description"], + id: object["id"], + uid: object["uid"], + updatedAt: new Date(object["updatedAt"]), + }; + }, + + _toJsonObject(self: StreamOut): any { + return { + createdAt: self.createdAt, + description: self.description, + id: self.id, + uid: self.uid, + updatedAt: self.updatedAt, + }; + }, +}; diff --git a/javascript/src/models/streamPatch.ts b/javascript/src/models/streamPatch.ts new file mode 100644 index 000000000..85275c2f3 --- /dev/null +++ b/javascript/src/models/streamPatch.ts @@ -0,0 +1,25 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamPatch { + /** The Stream's description. */ + description?: string; + /** An optional unique identifier for the stream. */ + uid?: string | null; +} + +export const StreamPatchSerializer = { + _fromJsonObject(object: any): StreamPatch { + return { + description: object["description"], + uid: object["uid"], + }; + }, + + _toJsonObject(self: StreamPatch): any { + return { + description: self.description, + uid: self.uid, + }; + }, +}; diff --git a/javascript/src/models/streamPortalAccessIn.ts b/javascript/src/models/streamPortalAccessIn.ts new file mode 100644 index 000000000..7ae6f297d --- /dev/null +++ b/javascript/src/models/streamPortalAccessIn.ts @@ -0,0 +1,33 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface StreamPortalAccessIn { + /** + * How long the token will be valid for, in seconds. + * + * Valid values are between 1 hour and 7 days. The default is 7 days. + */ + expiry?: number | null; + /** The set of feature flags the created token will have access to. */ + featureFlags?: string[]; + /** Whether the app portal should be in read-only mode. */ + readOnly?: boolean | null; +} + +export const StreamPortalAccessInSerializer = { + _fromJsonObject(object: any): StreamPortalAccessIn { + return { + expiry: object["expiry"], + featureFlags: object["featureFlags"], + readOnly: object["readOnly"], + }; + }, + + _toJsonObject(self: StreamPortalAccessIn): any { + return { + expiry: self.expiry, + featureFlags: self.featureFlags, + readOnly: self.readOnly, + }; + }, +}; diff --git a/javascript/src/models/templateUpdate.ts b/javascript/src/models/templateUpdate.ts new file mode 100644 index 000000000..f06b2ce8f --- /dev/null +++ b/javascript/src/models/templateUpdate.ts @@ -0,0 +1,47 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { ConnectorKind, ConnectorKindSerializer } from "./connectorKind"; + +export interface TemplateUpdate { + description?: string; + featureFlag?: string | null; + filterTypes?: string[] | null; + instructions?: string; + instructionsLink?: string | null; + kind?: ConnectorKind; + logo: string; + name?: string; + transformation: string; +} + +export const TemplateUpdateSerializer = { + _fromJsonObject(object: any): TemplateUpdate { + return { + description: object["description"], + featureFlag: object["featureFlag"], + filterTypes: object["filterTypes"], + instructions: object["instructions"], + instructionsLink: object["instructionsLink"], + kind: object["kind"] + ? ConnectorKindSerializer._fromJsonObject(object["kind"]) + : undefined, + logo: object["logo"], + name: object["name"], + transformation: object["transformation"], + }; + }, + + _toJsonObject(self: TemplateUpdate): any { + return { + description: self.description, + featureFlag: self.featureFlag, + filterTypes: self.filterTypes, + instructions: self.instructions, + instructionsLink: self.instructionsLink, + kind: self.kind ? ConnectorKindSerializer._toJsonObject(self.kind) : undefined, + logo: self.logo, + name: self.name, + transformation: self.transformation, + }; + }, +}; diff --git a/javascript/src/models/transformationHttpMethod.ts b/javascript/src/models/transformationHttpMethod.ts new file mode 100644 index 000000000..4b064e320 --- /dev/null +++ b/javascript/src/models/transformationHttpMethod.ts @@ -0,0 +1,18 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export enum TransformationHttpMethod { + Post = "POST", + Put = "PUT", + Patch = "PATCH", +} + +export const TransformationHttpMethodSerializer = { + _fromJsonObject(object: any): TransformationHttpMethod { + return object; + }, + + _toJsonObject(self: TransformationHttpMethod): any { + return self; + }, +}; diff --git a/javascript/src/models/transformationSimulateIn.ts b/javascript/src/models/transformationSimulateIn.ts new file mode 100644 index 000000000..bae15f76c --- /dev/null +++ b/javascript/src/models/transformationSimulateIn.ts @@ -0,0 +1,30 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ + +export interface TransformationSimulateIn { + channels?: string[] | null; + code: string; + /** The event type's name */ + eventType: string; + payload: any; +} + +export const TransformationSimulateInSerializer = { + _fromJsonObject(object: any): TransformationSimulateIn { + return { + channels: object["channels"], + code: object["code"], + eventType: object["eventType"], + payload: object["payload"], + }; + }, + + _toJsonObject(self: TransformationSimulateIn): any { + return { + channels: self.channels, + code: self.code, + eventType: self.eventType, + payload: self.payload, + }; + }, +}; diff --git a/javascript/src/models/transformationSimulateOut.ts b/javascript/src/models/transformationSimulateOut.ts new file mode 100644 index 000000000..8517a0a7f --- /dev/null +++ b/javascript/src/models/transformationSimulateOut.ts @@ -0,0 +1,34 @@ +// this file is @generated +/* eslint @typescript-eslint/no-explicit-any: 0 */ +import { + TransformationHttpMethod, + TransformationHttpMethodSerializer, +} from "./transformationHttpMethod"; + +export interface TransformationSimulateOut { + method?: TransformationHttpMethod | null; + payload: string; + url: string; +} + +export const TransformationSimulateOutSerializer = { + _fromJsonObject(object: any): TransformationSimulateOut { + return { + method: object["method"] + ? TransformationHttpMethodSerializer._fromJsonObject(object["method"]) + : undefined, + payload: object["payload"], + url: object["url"], + }; + }, + + _toJsonObject(self: TransformationSimulateOut): any { + return { + method: self.method + ? TransformationHttpMethodSerializer._toJsonObject(self.method) + : undefined, + payload: self.payload, + url: self.url, + }; + }, +}; From 06348ec9add845ee19216b075f34dc65d4267228 Mon Sep 17 00:00:00 2001 From: Mendy Man Date: Mon, 17 Mar 2025 10:51:42 -0400 Subject: [PATCH 4/4] Bump codegen image --- regen_openapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen_openapi.py b/regen_openapi.py index 07ad4127a..220b99c93 100755 --- a/regen_openapi.py +++ b/regen_openapi.py @@ -15,7 +15,7 @@ print("Python 3.11 or greater is required to run the codegen") exit(1) -OPENAPI_CODEGEN_IMAGE = "ghcr.io/svix/openapi-codegen:20250312-284" +OPENAPI_CODEGEN_IMAGE = "ghcr.io/svix/openapi-codegen:20250317-287" REPO_ROOT = pathlib.Path(__file__).parent.resolve() DEBUG = os.getenv("DEBUG") is not None GREEN = "\033[92m"