Skip to content

Commit

Permalink
CH-126 update python client generation
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Sep 13, 2024
1 parent 5adab28 commit c10719e
Show file tree
Hide file tree
Showing 289 changed files with 13,318 additions and 33,755 deletions.
45 changes: 30 additions & 15 deletions applications/samples/frontend/src/rest/apis/ResourceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ export class ResourceApi extends runtime.BaseAPI {
* Create a SampleResource
*/
async createSampleResourceRaw(requestParameters: CreateSampleResourceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.sampleResource === null || requestParameters.sampleResource === undefined) {
throw new runtime.RequiredError('sampleResource','Required parameter requestParameters.sampleResource was null or undefined when calling createSampleResource.');
if (requestParameters['sampleResource'] == null) {
throw new runtime.RequiredError(
'sampleResource',
'Required parameter "sampleResource" was null or undefined when calling createSampleResource().'
);
}

const queryParameters: any = {};
Expand All @@ -64,7 +67,7 @@ export class ResourceApi extends runtime.BaseAPI {
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: SampleResourceToJSON(requestParameters.sampleResource),
body: SampleResourceToJSON(requestParameters['sampleResource']),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand All @@ -83,16 +86,19 @@ export class ResourceApi extends runtime.BaseAPI {
* Delete a SampleResource
*/
async deleteSampleResourceRaw(requestParameters: DeleteSampleResourceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.sampleresourceId === null || requestParameters.sampleresourceId === undefined) {
throw new runtime.RequiredError('sampleresourceId','Required parameter requestParameters.sampleresourceId was null or undefined when calling deleteSampleResource.');
if (requestParameters['sampleresourceId'] == null) {
throw new runtime.RequiredError(
'sampleresourceId',
'Required parameter "sampleresourceId" was null or undefined when calling deleteSampleResource().'
);
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters.sampleresourceId))),
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters['sampleresourceId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
Expand All @@ -114,16 +120,19 @@ export class ResourceApi extends runtime.BaseAPI {
* Get a SampleResource
*/
async getSampleResourceRaw(requestParameters: GetSampleResourceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SampleResource>> {
if (requestParameters.sampleresourceId === null || requestParameters.sampleresourceId === undefined) {
throw new runtime.RequiredError('sampleresourceId','Required parameter requestParameters.sampleresourceId was null or undefined when calling getSampleResource.');
if (requestParameters['sampleresourceId'] == null) {
throw new runtime.RequiredError(
'sampleresourceId',
'Required parameter "sampleresourceId" was null or undefined when calling getSampleResource().'
);
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters.sampleresourceId))),
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters['sampleresourceId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand Down Expand Up @@ -174,12 +183,18 @@ export class ResourceApi extends runtime.BaseAPI {
* Update a SampleResource
*/
async updateSampleResourceRaw(requestParameters: UpdateSampleResourceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters.sampleresourceId === null || requestParameters.sampleresourceId === undefined) {
throw new runtime.RequiredError('sampleresourceId','Required parameter requestParameters.sampleresourceId was null or undefined when calling updateSampleResource.');
if (requestParameters['sampleresourceId'] == null) {
throw new runtime.RequiredError(
'sampleresourceId',
'Required parameter "sampleresourceId" was null or undefined when calling updateSampleResource().'
);
}

if (requestParameters.sampleResource === null || requestParameters.sampleResource === undefined) {
throw new runtime.RequiredError('sampleResource','Required parameter requestParameters.sampleResource was null or undefined when calling updateSampleResource.');
if (requestParameters['sampleResource'] == null) {
throw new runtime.RequiredError(
'sampleResource',
'Required parameter "sampleResource" was null or undefined when calling updateSampleResource().'
);
}

const queryParameters: any = {};
Expand All @@ -189,11 +204,11 @@ export class ResourceApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters.sampleresourceId))),
path: `/sampleresources/{sampleresourceId}`.replace(`{${"sampleresourceId"}}`, encodeURIComponent(String(requestParameters['sampleresourceId']))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: SampleResourceToJSON(requestParameters.sampleResource),
body: SampleResourceToJSON(requestParameters['sampleResource']),
}, initOverrides);

return new runtime.VoidApiResponse(response);
Expand Down
22 changes: 14 additions & 8 deletions applications/samples/frontend/src/rest/apis/WorkflowsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,28 @@ export class WorkflowsApi extends runtime.BaseAPI {
* @deprecated
*/
async submitSyncWithResultsRaw(requestParameters: SubmitSyncWithResultsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
if (requestParameters.a === null || requestParameters.a === undefined) {
throw new runtime.RequiredError('a','Required parameter requestParameters.a was null or undefined when calling submitSyncWithResults.');
if (requestParameters['a'] == null) {
throw new runtime.RequiredError(
'a',
'Required parameter "a" was null or undefined when calling submitSyncWithResults().'
);
}

if (requestParameters.b === null || requestParameters.b === undefined) {
throw new runtime.RequiredError('b','Required parameter requestParameters.b was null or undefined when calling submitSyncWithResults.');
if (requestParameters['b'] == null) {
throw new runtime.RequiredError(
'b',
'Required parameter "b" was null or undefined when calling submitSyncWithResults().'
);
}

const queryParameters: any = {};

if (requestParameters.a !== undefined) {
queryParameters['a'] = requestParameters.a;
if (requestParameters['a'] != null) {
queryParameters['a'] = requestParameters['a'];
}

if (requestParameters.b !== undefined) {
queryParameters['b'] = requestParameters.b;
if (requestParameters['b'] != null) {
queryParameters['b'] = requestParameters['b'];
}

const headerParameters: runtime.HTTPHeaders = {};
Expand Down
21 changes: 8 additions & 13 deletions applications/samples/frontend/src/rest/models/InlineResponse202.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
import type { InlineResponse202Task } from './InlineResponse202Task';
import {
InlineResponse202TaskFromJSON,
Expand All @@ -37,36 +37,31 @@ export interface InlineResponse202 {
/**
* Check if a given object implements the InlineResponse202 interface.
*/
export function instanceOfInlineResponse202(value: object): boolean {
let isInstance = true;

return isInstance;
export function instanceOfInlineResponse202(value: object): value is InlineResponse202 {
return true;
}

export function InlineResponse202FromJSON(json: any): InlineResponse202 {
return InlineResponse202FromJSONTyped(json, false);
}

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

'task': !exists(json, 'task') ? undefined : InlineResponse202TaskFromJSON(json['task']),
'task': json['task'] == null ? undefined : InlineResponse202TaskFromJSON(json['task']),
};
}

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

'task': InlineResponse202TaskToJSON(value.task),
'task': InlineResponse202TaskToJSON(value['task']),
};
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
/**
*
* @export
Expand All @@ -36,38 +36,33 @@ export interface InlineResponse202Task {
/**
* Check if a given object implements the InlineResponse202Task interface.
*/
export function instanceOfInlineResponse202Task(value: object): boolean {
let isInstance = true;

return isInstance;
export function instanceOfInlineResponse202Task(value: object): value is InlineResponse202Task {
return true;
}

export function InlineResponse202TaskFromJSON(json: any): InlineResponse202Task {
return InlineResponse202TaskFromJSONTyped(json, false);
}

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

'href': !exists(json, 'href') ? undefined : json['href'],
'name': !exists(json, 'name') ? undefined : json['name'],
'href': json['href'] == null ? undefined : json['href'],
'name': json['name'] == null ? undefined : json['name'],
};
}

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

'href': value.href,
'name': value.name,
'href': value['href'],
'name': value['name'],
};
}

29 changes: 12 additions & 17 deletions applications/samples/frontend/src/rest/models/SampleResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
import { mapValues } from '../runtime';
/**
*
* @export
Expand Down Expand Up @@ -42,41 +42,36 @@ export interface SampleResource {
/**
* Check if a given object implements the SampleResource interface.
*/
export function instanceOfSampleResource(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "a" in value;

return isInstance;
export function instanceOfSampleResource(value: object): value is SampleResource {
if (!('a' in value) || value['a'] === undefined) return false;
return true;
}

export function SampleResourceFromJSON(json: any): SampleResource {
return SampleResourceFromJSONTyped(json, false);
}

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

'a': json['a'],
'b': !exists(json, 'b') ? undefined : json['b'],
'id': !exists(json, 'id') ? undefined : json['id'],
'b': json['b'] == null ? undefined : json['b'],
'id': json['id'] == null ? undefined : json['id'],
};
}

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

'a': value.a,
'b': value.b,
'id': value.id,
'a': value['a'],
'b': value['b'],
'id': value['id'],
};
}

9 changes: 2 additions & 7 deletions applications/samples/frontend/src/rest/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down Expand Up @@ -310,11 +310,6 @@ export interface RequestOpts {
body?: HTTPBody;
}

export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}

export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
Expand Down
Loading

0 comments on commit c10719e

Please sign in to comment.