Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions generated-sources/api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,13 @@ src/models/CreateProviderAppRequest.ts
src/models/CreateRevisionRequest.ts
src/models/CreateTopicDestinationRouteRequest.ts
src/models/CreateTopicRequest.ts
src/models/CustomAuthConnectRequest.ts
src/models/CustomAuthConnectResponse.ts
src/models/CustomAuthConnectResponseOneOf.ts
src/models/CustomAuthConnectResponseOneOf1.ts
src/models/CustomAuthHeader.ts
src/models/CustomAuthInput.ts
src/models/CustomAuthInputOption.ts
src/models/CustomAuthOpts.ts
src/models/CustomAuthQueryParam.ts
src/models/DefaultPeriod.ts
Expand Down Expand Up @@ -198,6 +203,7 @@ src/models/ReadConfig.ts
src/models/ReadConfigAllOf.ts
src/models/ReadConfigObject.ts
src/models/ReadFilter.ts
src/models/RedirectResponse.ts
src/models/Revision.ts
src/models/SearchOperators.ts
src/models/SearchSupport.ts
Expand Down
73 changes: 73 additions & 0 deletions generated-sources/api/src/apis/ConnectionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import * as runtime from '../runtime';
import type {
ApiProblem,
Connection,
CustomAuthConnectRequest,
CustomAuthConnectResponse,
GenerateConnectionRequest,
InputValidationProblem,
UpdateConnectionRequest,
Expand All @@ -26,6 +28,10 @@ import {
ApiProblemToJSON,
ConnectionFromJSON,
ConnectionToJSON,
CustomAuthConnectRequestFromJSON,
CustomAuthConnectRequestToJSON,
CustomAuthConnectResponseFromJSON,
CustomAuthConnectResponseToJSON,
GenerateConnectionRequestFromJSON,
GenerateConnectionRequestToJSON,
InputValidationProblemFromJSON,
Expand All @@ -34,6 +40,10 @@ import {
UpdateConnectionRequestToJSON,
} from '../models';

export interface CustomAuthConnectOperationRequest {
customAuthConnectParams: CustomAuthConnectRequest;
}

export interface DeleteConnectionRequest {
projectIdOrName: string;
connectionId: string;
Expand Down Expand Up @@ -72,6 +82,22 @@ export interface UpdateConnectionOperationRequest {
* @interface ConnectionApiInterface
*/
export interface ConnectionApiInterface {
/**
* Drives a multi-step custom auth flow (browser redirects and/or server-side credential-exchange calls). Call it once with the flow inputs to start; if the response contains a redirect, open it, then call again with the returned sessionId and the provider\'s callback params to continue. Repeat until the response contains a connection. Used by the prebuilt UI components; only providers whose ProviderInfo has customOpts.multiStep present can use this endpoint.
* @summary Start or continue a multi-step custom auth flow
* @param {CustomAuthConnectRequest} customAuthConnectParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ConnectionApiInterface
*/
customAuthConnectRaw(requestParameters: CustomAuthConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomAuthConnectResponse>>;

/**
* Drives a multi-step custom auth flow (browser redirects and/or server-side credential-exchange calls). Call it once with the flow inputs to start; if the response contains a redirect, open it, then call again with the returned sessionId and the provider\'s callback params to continue. Repeat until the response contains a connection. Used by the prebuilt UI components; only providers whose ProviderInfo has customOpts.multiStep present can use this endpoint.
* Start or continue a multi-step custom auth flow
*/
customAuthConnect(requestParameters: CustomAuthConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomAuthConnectResponse>;

/**
*
* @summary Delete a connection
Expand Down Expand Up @@ -167,6 +193,53 @@ export interface ConnectionApiInterface {
*/
export class ConnectionApi extends runtime.BaseAPI implements ConnectionApiInterface {

/**
* Drives a multi-step custom auth flow (browser redirects and/or server-side credential-exchange calls). Call it once with the flow inputs to start; if the response contains a redirect, open it, then call again with the returned sessionId and the provider\'s callback params to continue. Repeat until the response contains a connection. Used by the prebuilt UI components; only providers whose ProviderInfo has customOpts.multiStep present can use this endpoint.
* Start or continue a multi-step custom auth flow
*/
async customAuthConnectRaw(requestParameters: CustomAuthConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CustomAuthConnectResponse>> {
if (requestParameters.customAuthConnectParams === null || requestParameters.customAuthConnectParams === undefined) {
throw new runtime.RequiredError('customAuthConnectParams','Required parameter requestParameters.customAuthConnectParams was null or undefined when calling customAuthConnect.');
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = this.configuration.apiKey("X-Api-Key"); // APIKeyHeader authentication
}

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("Bearer", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/custom-auth/connect`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CustomAuthConnectRequestToJSON(requestParameters.customAuthConnectParams),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => CustomAuthConnectResponseFromJSON(jsonValue));
}

/**
* Drives a multi-step custom auth flow (browser redirects and/or server-side credential-exchange calls). Call it once with the flow inputs to start; if the response contains a redirect, open it, then call again with the returned sessionId and the provider\'s callback params to continue. Repeat until the response contains a connection. Used by the prebuilt UI components; only providers whose ProviderInfo has customOpts.multiStep present can use this endpoint.
* Start or continue a multi-step custom auth flow
*/
async customAuthConnect(requestParameters: CustomAuthConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CustomAuthConnectResponse> {
const response = await this.customAuthConnectRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Delete a connection
*/
Expand Down
153 changes: 153 additions & 0 deletions generated-sources/api/src/models/CustomAuthConnectRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/* tslint:disable */
/* eslint-disable */
/**
* Ampersand public API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import type { ProviderMetadataInfo } from './ProviderMetadataInfo';
import {
ProviderMetadataInfoFromJSON,
ProviderMetadataInfoFromJSONTyped,
ProviderMetadataInfoToJSON,
} from './ProviderMetadataInfo';

/**
* Request body for the /custom-auth/connect endpoint. The first call supplies the flow inputs; subsequent calls supply sessionId and callbackParams to resume after a redirect.
* @export
* @interface CustomAuthConnectRequest
*/
export interface CustomAuthConnectRequest {
/**
* The Ampersand project ID or project name. Required on the first call.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
projectIdOrName: string;
/**
* The provider that this app connects to. Required on the first call (when sessionId is not present); ignored on resume calls. Conditional requirement is enforced at the application layer.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
provider?: string;
/**
* Your application's identifier for the organization or workspace that this connection belongs to. Supplied on the first call; ignored on resume calls (the parked flow's identity is used).
* @type {string}
* @memberof CustomAuthConnectRequest
*/
groupRef?: string;
/**
* The display name for the group. Defaults to groupRef if not provided. Supplied on the first call; ignored on resume calls.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
groupName?: string;
/**
* The ID that your app uses to identify the user whose SaaS credential will be used. Supplied on the first call; ignored on resume calls (the parked flow's identity is used).
* @type {string}
* @memberof CustomAuthConnectRequest
*/
consumerRef?: string;
/**
* The display name for the consumer. Defaults to consumerRef if not provided. Supplied on the first call; ignored on resume calls.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
consumerName?: string;
/**
*
* @type {{ [key: string]: ProviderMetadataInfo; }}
* @memberof CustomAuthConnectRequest
*/
providerMetadata?: { [key: string]: ProviderMetadataInfo; };
/**
* ID of the provider app. If omitted, the default provider app set up on the Dashboard is assumed.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
providerAppId?: string;
/**
* The consumer-supplied custom auth inputs (keyed by CustomAuthInput.name). Supplied on the first call (when sessionId is not present).
* @type {{ [key: string]: any; }}
* @memberof CustomAuthConnectRequest
*/
customAuth?: { [key: string]: any; };
/**
* Identifies an in-progress flow to resume after a redirect. Returned in a prior redirect response. When present, provider and customAuth are not required.
* @type {string}
* @memberof CustomAuthConnectRequest
*/
sessionId?: string;
/**
* The query/body params the provider sent to the callback, forwarded to resume the flow.
* @type {{ [key: string]: string; }}
* @memberof CustomAuthConnectRequest
*/
callbackParams?: { [key: string]: string; };
}

/**
* Check if a given object implements the CustomAuthConnectRequest interface.
*/
export function instanceOfCustomAuthConnectRequest(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "projectIdOrName" in value;

return isInstance;
}

export function CustomAuthConnectRequestFromJSON(json: any): CustomAuthConnectRequest {
return CustomAuthConnectRequestFromJSONTyped(json, false);
}

export function CustomAuthConnectRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomAuthConnectRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'projectIdOrName': json['projectIdOrName'],
'provider': !exists(json, 'provider') ? undefined : json['provider'],
'groupRef': !exists(json, 'groupRef') ? undefined : json['groupRef'],
'groupName': !exists(json, 'groupName') ? undefined : json['groupName'],
'consumerRef': !exists(json, 'consumerRef') ? undefined : json['consumerRef'],
'consumerName': !exists(json, 'consumerName') ? undefined : json['consumerName'],
'providerMetadata': !exists(json, 'providerMetadata') ? undefined : (mapValues(json['providerMetadata'], ProviderMetadataInfoFromJSON)),
'providerAppId': !exists(json, 'providerAppId') ? undefined : json['providerAppId'],
'customAuth': !exists(json, 'customAuth') ? undefined : json['customAuth'],
'sessionId': !exists(json, 'sessionId') ? undefined : json['sessionId'],
'callbackParams': !exists(json, 'callbackParams') ? undefined : json['callbackParams'],
};
}

export function CustomAuthConnectRequestToJSON(value?: CustomAuthConnectRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'projectIdOrName': value.projectIdOrName,
'provider': value.provider,
'groupRef': value.groupRef,
'groupName': value.groupName,
'consumerRef': value.consumerRef,
'consumerName': value.consumerName,
'providerMetadata': value.providerMetadata === undefined ? undefined : (mapValues(value.providerMetadata, ProviderMetadataInfoToJSON)),
'providerAppId': value.providerAppId,
'customAuth': value.customAuth,
'sessionId': value.sessionId,
'callbackParams': value.callbackParams,
};
}

65 changes: 65 additions & 0 deletions generated-sources/api/src/models/CustomAuthConnectResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* Ampersand public API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import {
CustomAuthConnectResponseOneOf,
instanceOfCustomAuthConnectResponseOneOf,
CustomAuthConnectResponseOneOfFromJSON,
CustomAuthConnectResponseOneOfFromJSONTyped,
CustomAuthConnectResponseOneOfToJSON,
} from './CustomAuthConnectResponseOneOf';
import {
CustomAuthConnectResponseOneOf1,
instanceOfCustomAuthConnectResponseOneOf1,
CustomAuthConnectResponseOneOf1FromJSON,
CustomAuthConnectResponseOneOf1FromJSONTyped,
CustomAuthConnectResponseOneOf1ToJSON,
} from './CustomAuthConnectResponseOneOf1';

/**
* @type CustomAuthConnectResponse
* Response from /custom-auth/connect. Exactly one of redirect or connection is set. A redirect means the client should open the URL and call again with sessionId + callbackParams; a connection means the flow is complete.
* @export
*/
export type CustomAuthConnectResponse = CustomAuthConnectResponseOneOf | CustomAuthConnectResponseOneOf1;

export function CustomAuthConnectResponseFromJSON(json: any): CustomAuthConnectResponse {
return CustomAuthConnectResponseFromJSONTyped(json, false);
}

export function CustomAuthConnectResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomAuthConnectResponse {
if ((json === undefined) || (json === null)) {
return json;
}
return { ...CustomAuthConnectResponseOneOfFromJSONTyped(json, true), ...CustomAuthConnectResponseOneOf1FromJSONTyped(json, true) };
}

export function CustomAuthConnectResponseToJSON(value?: CustomAuthConnectResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}

if (instanceOfCustomAuthConnectResponseOneOf(value)) {
return CustomAuthConnectResponseOneOfToJSON(value as CustomAuthConnectResponseOneOf);
}
if (instanceOfCustomAuthConnectResponseOneOf1(value)) {
return CustomAuthConnectResponseOneOf1ToJSON(value as CustomAuthConnectResponseOneOf1);
}

return {};
}

Loading
Loading