Skip to content

Commit

Permalink
added flows and forms intital endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharpandey13 committed Oct 21, 2024
1 parent 0c8a4aa commit 7e2b5f4
Show file tree
Hide file tree
Showing 6 changed files with 2,097 additions and 85 deletions.
4 changes: 4 additions & 0 deletions src/management/__generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
DeviceCredentialsManager,
EmailTemplatesManager,
EmailsManager,
FlowsManager,
FormsManager,
GrantsManager,
GuardianManager,
HooksManager,
Expand Down Expand Up @@ -53,6 +55,8 @@ export abstract class ManagementClientBase {
public readonly deviceCredentials = new DeviceCredentialsManager(this.configuration);
public readonly emailTemplates = new EmailTemplatesManager(this.configuration);
public readonly emails = new EmailsManager(this.configuration);
public readonly flows = new FlowsManager(this.configuration);
public readonly forms = new FormsManager(this.configuration);
public readonly grants = new GrantsManager(this.configuration);
public readonly guardian = new GuardianManager(this.configuration);
public readonly hooks = new HooksManager(this.configuration);
Expand Down
163 changes: 163 additions & 0 deletions src/management/__generated/managers/flows-manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import * as runtime from '../../../lib/runtime.js';
import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
import type {
GetFlows200Response,
PatchFlowsByIdRequest,
PostFlows201Response,
PostFlowsRequest,
GetFlows200ResponseOneOf,
GetFlows200ResponseOneOfInner,
GetFlowsRequest,
GetFlowsByIdRequest,
PatchFlowsByIdOperationRequest,
} from '../models/index.js';

const { BaseAPI } = runtime;

/**
*
*/
export class FlowsManager extends BaseAPI {
/**
* Get flows
*
* @throws {RequiredError}
*/
async getFlows(
requestParameters: GetFlowsRequest & { include_totals: true },
initOverrides?: InitOverride
): Promise<ApiResponse<GetFlows200ResponseOneOf>>;
async getFlows(
requestParameters?: GetFlowsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetFlows200ResponseOneOfInner>>>;
async getFlows(
requestParameters: GetFlowsRequest = {},
initOverrides?: InitOverride
): Promise<ApiResponse<GetFlows200Response>> {
const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'page',
config: {},
},
{
key: 'per_page',
config: {},
},
{
key: 'include_totals',
config: {},
},
{
key: 'hydrate',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
{
key: 'synchronous',
config: {},
},
]);

const response = await this.request(
{
path: `/flows`,
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Get a flow
*
* @throws {RequiredError}
*/
async getFlowsById(
requestParameters: GetFlowsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostFlows201Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'hydrate',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
]);

const response = await this.request(
{
path: `/flows/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))),
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Update a flow
*
* @throws {RequiredError}
*/
async patchFlowsById(
requestParameters: PatchFlowsByIdOperationRequest,
bodyParameters: PatchFlowsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostFlows201Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const headerParameters: runtime.HTTPHeaders = {};

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

const response = await this.request(
{
path: `/flows/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))),
method: 'PATCH',
headers: headerParameters,
body: bodyParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Create a flow
*
* @throws {RequiredError}
*/
async postFlows(
bodyParameters: PostFlowsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostFlows201Response>> {
const headerParameters: runtime.HTTPHeaders = {};

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

const response = await this.request(
{
path: `/flows`,
method: 'POST',
headers: headerParameters,
body: bodyParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}
}
159 changes: 159 additions & 0 deletions src/management/__generated/managers/forms-manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import * as runtime from '../../../lib/runtime.js';
import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
import type {
GetForms200Response,
PatchFormsByIdRequest,
PostForms201Response,
PostFormsRequest,
GetForms200ResponseOneOf,
GetForms200ResponseOneOfInner,
GetFormsRequest,
GetFormsByIdRequest,
PatchFormsByIdOperationRequest,
} from '../models/index.js';

const { BaseAPI } = runtime;

/**
*
*/
export class FormsManager extends BaseAPI {
/**
* Get forms
*
* @throws {RequiredError}
*/
async getForms(
requestParameters: GetFormsRequest & { include_totals: true },
initOverrides?: InitOverride
): Promise<ApiResponse<GetForms200ResponseOneOf>>;
async getForms(
requestParameters?: GetFormsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetForms200ResponseOneOfInner>>>;
async getForms(
requestParameters: GetFormsRequest = {},
initOverrides?: InitOverride
): Promise<ApiResponse<GetForms200Response>> {
const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'page',
config: {},
},
{
key: 'per_page',
config: {},
},
{
key: 'include_totals',
config: {},
},
{
key: 'hydrate',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
]);

const response = await this.request(
{
path: `/forms`,
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Get a form
*
* @throws {RequiredError}
*/
async getFormsById(
requestParameters: GetFormsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostForms201Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'hydrate',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
]);

const response = await this.request(
{
path: `/forms/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))),
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Update a form
*
* @throws {RequiredError}
*/
async patchFormsById(
requestParameters: PatchFormsByIdOperationRequest,
bodyParameters: PatchFormsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostForms201Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const headerParameters: runtime.HTTPHeaders = {};

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

const response = await this.request(
{
path: `/forms/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))),
method: 'PATCH',
headers: headerParameters,
body: bodyParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Create a form
*
* @throws {RequiredError}
*/
async postForms(
bodyParameters: PostFormsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostForms201Response>> {
const headerParameters: runtime.HTTPHeaders = {};

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

const response = await this.request(
{
path: `/forms`,
method: 'POST',
headers: headerParameters,
body: bodyParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}
}
2 changes: 2 additions & 0 deletions src/management/__generated/managers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export * from './custom-domains-manager.js';
export * from './device-credentials-manager.js';
export * from './email-templates-manager.js';
export * from './emails-manager.js';
export * from './flows-manager.js';
export * from './forms-manager.js';
export * from './grants-manager.js';
export * from './guardian-manager.js';
export * from './hooks-manager.js';
Expand Down
Loading

0 comments on commit 7e2b5f4

Please sign in to comment.