diff --git a/src/Coscine.Api/@coscine/api/project-sub-projects-api.ts b/src/Coscine.Api/@coscine/api/project-sub-projects-api.ts new file mode 100644 index 0000000000000000000000000000000000000000..2fd52a3b6941452bd4b1fa56a8cc801cb9748c5b --- /dev/null +++ b/src/Coscine.Api/@coscine/api/project-sub-projects-api.ts @@ -0,0 +1,286 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Coscine Web API + * Coscine (short for <b>CO</b>llaborative <b>SC</b>ientific <b>IN</b>tegration <b>E</b>nvironment) is the research data management platform for your research project. + * + * The version of the OpenAPI document: 2.0 + * Contact: servicedesk@rwth-aachen.de + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../../base'; +// @ts-ignore +import type { ProjectDtoPagedResponse } from '../../@coscine/model'; +/** + * ProjectSubProjectsApi - axios parameter creator + * @export + */ +export const ProjectSubProjectsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Responds with the HTTP methods allowed for the endpoint. + * @param {string} projectId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ProjectsProjectIdSubprojectsOptions: async (projectId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'projectId' is not null or undefined + assertParamExists('apiV2ProjectsProjectIdSubprojectsOptions', 'projectId', projectId) + const localVarPath = `/api/v2/projects/{projectId}/subprojects` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'OPTIONS', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Retrieves all subprojects for a specified project. + * @param {string} projectId The Id or slug of the project. + * @param {boolean} [includeOrganizations] Gets or sets a value indicating whether to retrieve the organizations. + * @param {number} [pageNumber] The desired page number. Should be greater than or equal to 1. Default is 1. + * @param {number} [pageSize] The desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10. + * @param {string} [orderBy] Gets or sets the field name used for ordering the results. The order is constructed by an order string. Use the property followed by \"asc\" or \"desc\" and separate properties by commas. Default is asc. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSubProjectsForProject: async (projectId: string, includeOrganizations?: boolean, pageNumber?: number, pageSize?: number, orderBy?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'projectId' is not null or undefined + assertParamExists('getSubProjectsForProject', 'projectId', projectId) + const localVarPath = `/api/v2/projects/{projectId}/subprojects` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + if (includeOrganizations !== undefined) { + localVarQueryParameter['IncludeOrganizations'] = includeOrganizations; + } + + if (pageNumber !== undefined) { + localVarQueryParameter['PageNumber'] = pageNumber; + } + + if (pageSize !== undefined) { + localVarQueryParameter['PageSize'] = pageSize; + } + + if (orderBy !== undefined) { + localVarQueryParameter['OrderBy'] = orderBy; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ProjectSubProjectsApi - functional programming interface + * @export + */ +export const ProjectSubProjectsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ProjectSubProjectsApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Responds with the HTTP methods allowed for the endpoint. + * @param {string} projectId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV2ProjectsProjectIdSubprojectsOptions(projectId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV2ProjectsProjectIdSubprojectsOptions(projectId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ProjectSubProjectsApi.apiV2ProjectsProjectIdSubprojectsOptions']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary Retrieves all subprojects for a specified project. + * @param {string} projectId The Id or slug of the project. + * @param {boolean} [includeOrganizations] Gets or sets a value indicating whether to retrieve the organizations. + * @param {number} [pageNumber] The desired page number. Should be greater than or equal to 1. Default is 1. + * @param {number} [pageSize] The desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10. + * @param {string} [orderBy] Gets or sets the field name used for ordering the results. The order is constructed by an order string. Use the property followed by \"asc\" or \"desc\" and separate properties by commas. Default is asc. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSubProjectsForProject(projectId: string, includeOrganizations?: boolean, pageNumber?: number, pageSize?: number, orderBy?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProjectDtoPagedResponse>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSubProjectsForProject(projectId, includeOrganizations, pageNumber, pageSize, orderBy, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ProjectSubProjectsApi.getSubProjectsForProject']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ProjectSubProjectsApi - factory interface + * @export + */ +export const ProjectSubProjectsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ProjectSubProjectsApiFp(configuration) + return { + /** + * + * @summary Responds with the HTTP methods allowed for the endpoint. + * @param {ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2ProjectsProjectIdSubprojectsOptions(requestParameters: ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> { + return localVarFp.apiV2ProjectsProjectIdSubprojectsOptions(requestParameters.projectId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Retrieves all subprojects for a specified project. + * @param {ProjectSubProjectsApiGetSubProjectsForProjectRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSubProjectsForProject(requestParameters: ProjectSubProjectsApiGetSubProjectsForProjectRequest, options?: RawAxiosRequestConfig): AxiosPromise<ProjectDtoPagedResponse> { + return localVarFp.getSubProjectsForProject(requestParameters.projectId, requestParameters.includeOrganizations, requestParameters.pageNumber, requestParameters.pageSize, requestParameters.orderBy, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for apiV2ProjectsProjectIdSubprojectsOptions operation in ProjectSubProjectsApi. + * @export + * @interface ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest + */ +export interface ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest { + /** + * + * @type {string} + * @memberof ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptions + */ + readonly projectId: string +} + +/** + * Request parameters for getSubProjectsForProject operation in ProjectSubProjectsApi. + * @export + * @interface ProjectSubProjectsApiGetSubProjectsForProjectRequest + */ +export interface ProjectSubProjectsApiGetSubProjectsForProjectRequest { + /** + * The Id or slug of the project. + * @type {string} + * @memberof ProjectSubProjectsApiGetSubProjectsForProject + */ + readonly projectId: string + + /** + * Gets or sets a value indicating whether to retrieve the organizations. + * @type {boolean} + * @memberof ProjectSubProjectsApiGetSubProjectsForProject + */ + readonly includeOrganizations?: boolean + + /** + * The desired page number. Should be greater than or equal to 1. Default is 1. + * @type {number} + * @memberof ProjectSubProjectsApiGetSubProjectsForProject + */ + readonly pageNumber?: number + + /** + * The desired page size. Should be between 1 and the maximum allowed page size (50). Default is 10. + * @type {number} + * @memberof ProjectSubProjectsApiGetSubProjectsForProject + */ + readonly pageSize?: number + + /** + * Gets or sets the field name used for ordering the results. The order is constructed by an order string. Use the property followed by \"asc\" or \"desc\" and separate properties by commas. Default is asc. + * @type {string} + * @memberof ProjectSubProjectsApiGetSubProjectsForProject + */ + readonly orderBy?: string +} + +/** + * ProjectSubProjectsApi - object-oriented interface + * @export + * @class ProjectSubProjectsApi + * @extends {BaseAPI} + */ +export class ProjectSubProjectsApi extends BaseAPI { + /** + * + * @summary Responds with the HTTP methods allowed for the endpoint. + * @param {ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProjectSubProjectsApi + */ + public apiV2ProjectsProjectIdSubprojectsOptions(requestParameters: ProjectSubProjectsApiApiV2ProjectsProjectIdSubprojectsOptionsRequest, options?: RawAxiosRequestConfig) { + return ProjectSubProjectsApiFp(this.configuration).apiV2ProjectsProjectIdSubprojectsOptions(requestParameters.projectId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Retrieves all subprojects for a specified project. + * @param {ProjectSubProjectsApiGetSubProjectsForProjectRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProjectSubProjectsApi + */ + public getSubProjectsForProject(requestParameters: ProjectSubProjectsApiGetSubProjectsForProjectRequest, options?: RawAxiosRequestConfig) { + return ProjectSubProjectsApiFp(this.configuration).getSubProjectsForProject(requestParameters.projectId, requestParameters.includeOrganizations, requestParameters.pageNumber, requestParameters.pageSize, requestParameters.orderBy, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/src/Coscine.Api/@coscine/model/project-admin-dto.ts b/src/Coscine.Api/@coscine/model/project-admin-dto.ts index d448e080e48d7b0eb351429899a6ff975e6bc979..55bac067df68c551c6e0285b32a549018292ab00 100644 --- a/src/Coscine.Api/@coscine/model/project-admin-dto.ts +++ b/src/Coscine.Api/@coscine/model/project-admin-dto.ts @@ -150,6 +150,7 @@ export interface ProjectAdminDto { * Collection of sub-projects associated with this project. * @type {Array<ProjectDto>} * @memberof ProjectAdminDto + * @deprecated */ 'subProjects'?: Array<ProjectDto> | null; /** diff --git a/src/Coscine.Api/@coscine/model/project-dto.ts b/src/Coscine.Api/@coscine/model/project-dto.ts index fd2edb28cf05c61c1bc8a51ebe897ee5b8b52f26..40bae6138ca2158e6b0560ac56a2619738494aa4 100644 --- a/src/Coscine.Api/@coscine/model/project-dto.ts +++ b/src/Coscine.Api/@coscine/model/project-dto.ts @@ -135,6 +135,7 @@ export interface ProjectDto { * Collection of sub-projects associated with this project. * @type {Array<ProjectDto>} * @memberof ProjectDto + * @deprecated */ 'subProjects'?: Array<ProjectDto> | null; /** diff --git a/src/Coscine.Api/api.ts b/src/Coscine.Api/api.ts index fc297c0762aae45ecadbe8246b9ebd3ef4964cec..dcf677d4d8272a5187f7e273cd020506e678adda 100644 --- a/src/Coscine.Api/api.ts +++ b/src/Coscine.Api/api.ts @@ -33,6 +33,7 @@ export * from './@coscine/api/project-quota-api'; export * from './@coscine/api/project-resource-api'; export * from './@coscine/api/project-resource-quota-api'; export * from './@coscine/api/project-resource-type-api'; +export * from './@coscine/api/project-sub-projects-api'; export * from './@coscine/api/provenance-api'; export * from './@coscine/api/resource-api'; export * from './@coscine/api/resource-type-api'; diff --git a/src/apis.ts b/src/apis.ts index d14538f2de36ec3635ee4487d4a0123fa59c5471..e8b897b15592c568a89c903cb6eafd2d347972b8 100644 --- a/src/apis.ts +++ b/src/apis.ts @@ -23,6 +23,7 @@ import { ProjectResourceApiFactory, ProjectResourceQuotaApiFactory, ProjectResourceTypeApiFactory, + ProjectSubProjectsApiFactory, ResourceApiFactory, ResourceTypeApiFactory, ResourceTypeGitLabApiFactory, @@ -100,6 +101,7 @@ function implementations(axios?: AxiosInstance) { ProjectResourceApi: ProjectResourceApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), ProjectResourceQuotaApi: ProjectResourceQuotaApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), ProjectResourceTypeApi: ProjectResourceTypeApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), + ProjectSubProjectsApi: ProjectSubProjectsApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), ResourceApi: ResourceApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), ResourceTypeApi: ResourceTypeApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), ResourceTypeGitLabApi: ResourceTypeGitLabApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), diff --git a/src/index.ts b/src/index.ts index 4b84e2d94c393d5df155fa5bed789b485a24f83c..2f80770a6b40cc9dc8220d8fc8c4548bff315054 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,6 +27,7 @@ export const ProjectQuotaApi = apis.ProjectQuotaApi; export const ProjectResourceApi = apis.ProjectResourceApi; export const ProjectResourceQuotaApi = apis.ProjectResourceQuotaApi; export const ProjectResourceTypeApi = apis.ProjectResourceTypeApi; +export const ProjectSubProjectsApi = apis.ProjectSubProjectsApi; export const ResourceApi = apis.ResourceApi; export const ResourceTypeApi = apis.ResourceTypeApi; export const ResourceTypeGitLabApi = apis.ResourceTypeGitLabApi;