Skip to content

Commit

Permalink
Update RBAC client
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac committed Sep 26, 2024
1 parent cff517d commit cf81320
Show file tree
Hide file tree
Showing 5 changed files with 518 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions packages/rbac/v2/WorkspacesList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ import type { ProblemsProblem403, WorkspacesList401Response, WorkspacesList500Re


export type WorkspacesListParams = {
/**
*
* @type { number }
* @memberof WorkspacesListApi
*/
limit?: number,
/**
*
* @type { number }
* @memberof WorkspacesListApi
*/
offset?: number,
options?: AxiosRequestConfig
}

const isWorkspacesListObjectParams = (params: [WorkspacesListParams] | unknown[]): params is [WorkspacesListParams] => {
return params.length === 1
return params.length === 1 && true && true
}
/**
* List workspaces in a tenant
Expand All @@ -25,16 +37,24 @@ const isWorkspacesListObjectParams = (params: [WorkspacesListParams] | unknown[]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const workspacesListParamCreator = async (...config: ([WorkspacesListParams] | [AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isWorkspacesListObjectParams(config) ? config[0] : ['options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as WorkspacesListParams;
const { options = {} } = params;
export const workspacesListParamCreator = async (...config: ([WorkspacesListParams] | [number, number, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isWorkspacesListObjectParams(config) ? config[0] : ['limit', 'offset', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as WorkspacesListParams;
const { limit, offset, options = {} } = params;
const localVarPath = `/workspaces/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const localVarRequestOptions = { method: 'GET' as Method, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}

if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}



setSearchParams(localVarUrlObj, localVarQueryParameter);
Expand Down
20 changes: 15 additions & 5 deletions packages/rbac/v2/WorkspacesRead/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BaseAPI } from '@redhat-cloud-services/javascript-clients-shared/dist/b
import { Configuration } from '@redhat-cloud-services/javascript-clients-shared/dist/configuration';

// @ts-ignore
import type { ProblemsProblem403, ProblemsProblem404, WorkspacesList401Response, WorkspacesList500Response, WorkspacesReadWorkspaceResponse } from '../types';
import type { ProblemsProblem403, ProblemsProblem404, WorkspacesList401Response, WorkspacesList500Response, WorkspacesRead200Response } from '../types';


export type WorkspacesReadParams = {
Expand All @@ -18,11 +18,17 @@ export type WorkspacesReadParams = {
* @memberof WorkspacesReadApi
*/
uuid: string,
/**
* When true, the response will include the ancestry of the workspace.
* @type { boolean }
* @memberof WorkspacesReadApi
*/
includeAncestry?: boolean,
options?: AxiosRequestConfig
}

const isWorkspacesReadObjectParams = (params: [WorkspacesReadParams] | unknown[]): params is [WorkspacesReadParams] => {
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'uuid')
return params.length === 1 && Object.prototype.hasOwnProperty.call(params, 'uuid') && true
}
/**
* Get a workspace in tenant
Expand All @@ -31,9 +37,9 @@ const isWorkspacesReadObjectParams = (params: [WorkspacesReadParams] | unknown[]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
export const workspacesReadParamCreator = async (...config: ([WorkspacesReadParams] | [string, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isWorkspacesReadObjectParams(config) ? config[0] : ['uuid', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as WorkspacesReadParams;
const { uuid, options = {} } = params;
export const workspacesReadParamCreator = async (...config: ([WorkspacesReadParams] | [string, boolean, AxiosRequestConfig])): Promise<RequestArgs> => {
const params = isWorkspacesReadObjectParams(config) ? config[0] : ['uuid', 'includeAncestry', 'options'].reduce((acc, curr, index) => ({ ...acc, [curr]: config[index] }), {}) as WorkspacesReadParams;
const { uuid, includeAncestry, options = {} } = params;
const localVarPath = `/workspaces/{uuid}/`
.replace(`{${"uuid"}}`, encodeURIComponent(String(uuid)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
Expand All @@ -42,6 +48,10 @@ export const workspacesReadParamCreator = async (...config: ([WorkspacesReadPara
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (includeAncestry !== undefined) {
localVarQueryParameter['include_ancestry'] = includeAncestry;
}



setSearchParams(localVarUrlObj, localVarQueryParameter);
Expand Down
Loading

0 comments on commit cf81320

Please sign in to comment.