Skip to content

Commit

Permalink
js: Add non-pubic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-mman committed Feb 18, 2025
1 parent 7eda6b3 commit 650f929
Show file tree
Hide file tree
Showing 90 changed files with 3,796 additions and 0 deletions.
29 changes: 29 additions & 0 deletions javascript/src/api_internal/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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<ApplicationStats> {
// v1.application.get-stats is hidden
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);
}
}
121 changes: 121 additions & 0 deletions javascript/src/api_internal/authentication.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// 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<AuthTokenOut> {
// v1.authentication.create-message-token is hidden
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<AuthTokenOut> {
// v1.authentication.get-poller-token is hidden
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<AuthTokenOut> {
// v1.authentication.rotate-poller-token is hidden
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<OneTimeTokenOut> {
// v1.authentication.exchange-one-time-token is hidden
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<AppPortalAccessOut> {
// v1.authentication.stream-portal-access is hidden
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);
}
}
185 changes: 185 additions & 0 deletions javascript/src/api_internal/endpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
// 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<EndpointMtlsConfigOut> {
// v1.endpoint.get-mtls-config is hidden
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<void> {
// v1.endpoint.update-mtls-config is hidden
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<void> {
// v1.endpoint.delete-mtls-config is hidden
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<EndpointOauthConfigOut> {
// v1.endpoint.get-oauth-config is hidden
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<void> {
// v1.endpoint.update-oauth-config is hidden
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<void> {
// v1.endpoint.delete-oauth-config is hidden
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<void> {
// v1.endpoint.update-hubspot-oauth-config is hidden
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<EndpointTransformationSimulateOut> {
// v1.endpoint.transformation-simulate is hidden
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
);
}
}
21 changes: 21 additions & 0 deletions javascript/src/api_internal/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// this file is @generated
import {
EnvironmentSettingsOut,
EnvironmentSettingsOutSerializer,
} from "../models/environmentSettingsOut";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";

export class Environment {
public constructor(private readonly requestCtx: SvixRequestContext) {}

/** Get the environment's settings. */
public getSettings(): Promise<EnvironmentSettingsOut> {
// v1.environment.get-settings is hidden
const request = new SvixRequest(HttpMethod.GET, "/api/v1/environment/settings");

return request.send(
this.requestCtx,
EnvironmentSettingsOutSerializer._fromJsonObject
);
}
}
Loading

0 comments on commit 650f929

Please sign in to comment.