diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index 38d44230..42399bad 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -139,5 +139,4 @@ async def get_work_by_identifier( security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"]) ), ): - print("RUN SERVICE") return await logic.get_work(identifier,title=title) \ No newline at end of file diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index 20d855a3..82f38cbe 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -619,14 +619,16 @@ export class WorksService extends BaseService { } /** - * Returns one publication. - * @endpoint get /api/works/detail/{work_id} - * @param workId The OpenAlex work id, for example W2741809807. + * Returns one publication by OpenAlex ID or DOI. + * @endpoint get /api/works/detail/{identifier} + * @param identifier The OpenAlex work id (e.g., W2741809807) or DOI number of the publication. + * @param title Do we want to fallback to title search if ID and DOI dont work? * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public getWork( - workId: string, + identifier: string, + title?: string, observe?: 'body', reportProgress?: boolean, options?: { @@ -636,7 +638,8 @@ export class WorksService extends BaseService { }, ): Observable; public getWork( - workId: string, + identifier: string, + title?: string, observe?: 'response', reportProgress?: boolean, options?: { @@ -646,7 +649,8 @@ export class WorksService extends BaseService { }, ): Observable>; public getWork( - workId: string, + identifier: string, + title?: string, observe?: 'events', reportProgress?: boolean, options?: { @@ -656,7 +660,8 @@ export class WorksService extends BaseService { }, ): Observable>; public getWork( - workId: string, + identifier: string, + title?: string, observe: any = 'body', reportProgress: boolean = false, options?: { @@ -665,12 +670,19 @@ export class WorksService extends BaseService { transferCache?: boolean; }, ): Observable { - if (workId === null || workId === undefined) { + if (identifier === null || identifier === undefined) { throw new Error( - 'Required parameter workId was null or undefined when calling getWork.', + 'Required parameter identifier was null or undefined when calling getWork.', ); } + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + title, + 'title', + ); + let localVarHeaders = this.defaultHeaders; // authentication (bearer) required @@ -709,10 +721,11 @@ export class WorksService extends BaseService { } } - let localVarPath = `/api/works/detail/${this.configuration.encodeParam({ name: 'workId', value: workId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; + let localVarPath = `/api/works/detail/${this.configuration.encodeParam({ name: 'identifier', value: identifier, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; const { basePath, withCredentials } = this.configuration; return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, + params: localVarQueryParameters, responseType: responseType_, ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders,