From 29c954227fd468c9dc520f65172306d6cefcea24 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 26 Jun 2026 12:05:00 +0200 Subject: [PATCH 01/92] use shared topic chips in person card --- .../main/inse/models/openalex/work_topic.py | 4 +- webapp/src/app/api/model/workTopic.ts | 1 + .../person-card/person-card.component.html | 23 ++++---- .../person-card/person-card.component.scss | 53 ++++--------------- .../person-card/person-card.component.ts | 33 ++++++++---- .../ui/topic-chip/topic-chip.component.scss | 1 + 6 files changed, 51 insertions(+), 64 deletions(-) diff --git a/service/src/main/inse/models/openalex/work_topic.py b/service/src/main/inse/models/openalex/work_topic.py index c4c6fce6..e780d369 100644 --- a/service/src/main/inse/models/openalex/work_topic.py +++ b/service/src/main/inse/models/openalex/work_topic.py @@ -33,11 +33,12 @@ class WorkTopic(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = None display_name: Optional[StrictStr] = None + description: Optional[StrictStr] = None score: Optional[Union[StrictFloat, StrictInt]] = None subfield: Optional[WorkTopicSubfield] = None var_field: Optional[WorkTopicField] = Field(default=None, alias="field") domain: Optional[WorkTopicDomain] = None - __properties: ClassVar[List[str]] = ["id", "display_name", "score", "subfield", "field", "domain"] + __properties: ClassVar[List[str]] = ["id", "display_name", "description", "score", "subfield", "field", "domain"] model_config = ConfigDict( validate_by_name=True, @@ -101,6 +102,7 @@ class WorkTopic(BaseModel): _obj = cls.model_validate({ "id": obj.get("id"), "display_name": obj.get("display_name"), + "description": obj.get("description"), "score": obj.get("score"), "subfield": WorkTopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None, "field": WorkTopicField.from_dict(obj["field"]) if obj.get("field") is not None else None, diff --git a/webapp/src/app/api/model/workTopic.ts b/webapp/src/app/api/model/workTopic.ts index 4b326824..4b365f33 100644 --- a/webapp/src/app/api/model/workTopic.ts +++ b/webapp/src/app/api/model/workTopic.ts @@ -18,6 +18,7 @@ import { WorkTopicField } from './workTopicField'; export interface WorkTopic { id?: string | null; display_name?: string | null; + description?: string | null; score?: Score | null; subfield?: WorkTopicSubfield | null; field?: WorkTopicField | null; diff --git a/webapp/src/app/modules/person-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index e07bb800..3522a567 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -98,18 +98,19 @@
@for (topic of topics(); track topic.id) { - + class="person-topic-chip" + size="mini" + [label]="topic.display_name || ''" + [description]="topic.description" + [subfieldName]="topic.subfield?.display_name" + [fieldName]="topic.field?.display_name" + [domainName]="topic.domain?.display_name" + [color]="getTopicColor(topic)" + [active]="isTopicSelected(topic)" + (chipClick)="handleTopicClick(topic)"> + }
diff --git a/webapp/src/app/modules/person-card/person-card.component.scss b/webapp/src/app/modules/person-card/person-card.component.scss index 5dd6b14c..bb40d858 100644 --- a/webapp/src/app/modules/person-card/person-card.component.scss +++ b/webapp/src/app/modules/person-card/person-card.component.scss @@ -246,55 +246,22 @@ .topic-row { display: flex; flex-wrap: wrap; - gap: 4px; + gap: 5px; } -.topic-tag { - background: var(--sg-surface-soft); - border: 1px solid var(--sg-border); - color: var(--sg-text-muted); - font-size: 10px; - font-weight: 600; - padding: 2px 6px; - border-radius: 4px; - cursor: pointer; - transition: all 0.2s ease; +app-topic-chip.person-topic-chip { max-width: 100%; +} + +:host ::ng-deep app-topic-chip.person-topic-chip .topic-chip__button { + max-width: 100%; +} + +:host ::ng-deep app-topic-chip.person-topic-chip .topic-chip__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - box-sizing: border-box; - margin: 0; - line-height: normal; - font-family: inherit; - display: inline-flex; - align-items: center; - - &:hover, - &:focus-visible { - background: var(--sg-primary-soft); - border-color: var(--sg-primary); - color: var(--sg-primary); - outline: none; - box-shadow: - 0 0 0 2px var(--sg-background), - 0 0 0 4px var(--sg-primary); - } - - &.active { - background: var(--sg-primary-soft); - border-color: var(--sg-primary); - color: var(--sg-primary); - font-weight: 700; - box-shadow: 0 0 0 1.5px var(--sg-primary); - - &:hover, - &:focus-visible { - box-shadow: - 0 0 0 2px var(--sg-background), - 0 0 0 4px var(--sg-primary); - } - } + overflow-wrap: normal; } .card-footer { diff --git a/webapp/src/app/modules/person-card/person-card.component.ts b/webapp/src/app/modules/person-card/person-card.component.ts index 02e5a109..a9ad0e50 100644 --- a/webapp/src/app/modules/person-card/person-card.component.ts +++ b/webapp/src/app/modules/person-card/person-card.component.ts @@ -5,6 +5,8 @@ import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api'; import { SkTextDirective } from '../../custom-directives/sk-text.directive'; +import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; +import { topicHierarchyColor } from '../../shared/utils/topic-colors'; @Component({ selector: 'app-person-card', @@ -15,6 +17,7 @@ import { SkTextDirective } from '../../custom-directives/sk-text.directive'; MatIconModule, SkTextDirective, MatTooltipModule, + TopicChipComponent, ], templateUrl: './person-card.component.html', styleUrl: './person-card.component.scss', @@ -117,17 +120,29 @@ export class PersonCardComponent { return 'possible'; } - getTopicTooltip(topic: WorkTopic): string { - const parts: string[] = []; - if (topic.domain?.display_name) parts.push(topic.domain.display_name); - if (topic.field?.display_name) parts.push(topic.field.display_name); - if (topic.subfield?.display_name) parts.push(topic.subfield.display_name); + isTopicSelected(topic: WorkTopic): boolean { + return this.selectedTopics().has(topic.display_name || ''); + } - const path = parts.join(' - '); - if (topic.display_name) { - return path ? `${topic.display_name}\n(${path})` : topic.display_name; + getTopicColor(topic: WorkTopic): string { + return topicHierarchyColor({ + id: topic.id, + name: topic.display_name, + field_id: topic.field?.id, + field_name: topic.field?.display_name, + domain_id: topic.domain?.id, + domain_name: topic.domain?.display_name, + }); + } + + handleTopicClick(topic: WorkTopic): void { + const topicName = topic.display_name || ''; + + if (!topicName) { + return; } - return path; + + this.topicClick.emit(topicName); } getCareerStageTooltip(careerStage: string): string { diff --git a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.scss b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.scss index e9d57cd5..fb757f9d 100644 --- a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.scss +++ b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.scss @@ -67,6 +67,7 @@ :host(.topic-chip--active.topic-chip--mini) .topic-chip__button { background: color-mix(in srgb, var(--topic-color) 24%, #ffffff); color: var(--topic-text); + box-shadow: 0 0 0 1.5px var(--topic-color); } .topic-chip__label { From 309fecf0086833c3ef1923ce6923688c266d7860 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 26 Jun 2026 13:35:06 +0200 Subject: [PATCH 02/92] use topic chips for active topic filters --- .../custom-directives/sk-text.directive.ts | 14 +++++ .../person-list/person-list.component.html | 51 +++++++++++++---- .../person-list/person-list.component.scss | 39 ++++++++++++- .../person-list/person-list.component.ts | 57 ++++++++++++++++++- 4 files changed, 148 insertions(+), 13 deletions(-) diff --git a/webapp/src/app/custom-directives/sk-text.directive.ts b/webapp/src/app/custom-directives/sk-text.directive.ts index ade9c10b..e7173238 100644 --- a/webapp/src/app/custom-directives/sk-text.directive.ts +++ b/webapp/src/app/custom-directives/sk-text.directive.ts @@ -35,6 +35,7 @@ export class SkTextDirective implements OnChanges { // measure natural width before blanking text const width = Math.min(Math.max(this.originalText.length * 7.5, 48), 60); const height = 20; + this.renderer.addClass(el, 'sk-text-loading'); this.renderer.setStyle(el, 'color', 'transparent'); this.renderer.setStyle( el, @@ -47,10 +48,17 @@ export class SkTextDirective implements OnChanges { this.renderer.setStyle(el, 'min-width', `${width}px`); this.renderer.setStyle(el, 'max-height', `${height}px`); this.renderer.setStyle(el, 'display', 'inline-block'); + this.renderer.setStyle(el, 'overflow', 'hidden'); + this.renderer.setStyle(el, 'pointer-events', 'none'); + + Array.from(el.children).forEach((child) => { + this.renderer.setStyle(child, 'visibility', 'hidden'); + }); } private hideSkeleton() { const el: HTMLElement = this.el.nativeElement; + this.renderer.removeClass(el, 'sk-text-loading'); this.renderer.removeStyle(el, 'color'); this.renderer.removeStyle(el, 'background'); this.renderer.removeStyle(el, 'background-size'); @@ -59,5 +67,11 @@ export class SkTextDirective implements OnChanges { this.renderer.removeStyle(el, 'min-width'); this.renderer.removeStyle(el, 'max-height'); this.renderer.removeStyle(el, 'display'); + this.renderer.removeStyle(el, 'overflow'); + this.renderer.removeStyle(el, 'pointer-events'); + + Array.from(el.children).forEach((child) => { + this.renderer.removeStyle(child, 'visibility'); + }); } } diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 3dba668f..e3d4fcc8 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -32,16 +32,47 @@
Aktive Filter:
- @for (filter of activeFilters; track filter.value) { - - {{ filter.label }} - - + @for ( + filter of activeFilters; + track filter.category + filter.value + ) { + @if (filter.category === 'topic') { + + Thema: + + + + + } @else { + + {{ filter.label }} + + + } } - + matTooltipPosition="above" + (click)="toggleSubfield(group, item)"> {{ item.name }} - +
diff --git a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.scss b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.scss index fa9fca76..666ca903 100644 --- a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.scss +++ b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.scss @@ -110,11 +110,39 @@ background: #fbfdff; } +.topic-legend-group-active { + border-color: var(--legend-color, var(--topic-legend-accent)); + background: color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 10%, + #fbfdff + ); + box-shadow: + inset 0 0 0 1px + color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 55%, + transparent + ), + 0 0 0 2px + color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 22%, + transparent + ); +} + .topic-legend-field { flex: 0 1 auto; min-width: 0; gap: 5px; + padding: 2px 4px; + appearance: none; + border: 0; + border-radius: 999px; + background: transparent; color: #07163d; + font-family: inherit; font-size: 11px; font-weight: 800; line-height: 1.2; @@ -143,13 +171,87 @@ } .topic-legend-item { + display: inline-flex; + align-items: center; + padding: 2px 4px; + appearance: none; + border: 0; + border-radius: 999px; + background: transparent; color: #53617e; + font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.25; cursor: help; } +.topic-legend-selectable { + .topic-legend-field, + .topic-legend-item { + cursor: pointer; + } + + .topic-legend-field:hover, + .topic-legend-item:hover { + background: color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 8%, + #ffffff + ); + } +} + +.topic-legend-field:focus-visible, +.topic-legend-item:focus-visible { + outline: 2px solid var(--topic-legend-accent); + outline-offset: 2px; +} + +.topic-legend-entry-active { + background: color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 24%, + #ffffff + ); + box-shadow: + inset 0 0 0 1px + color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 75%, + transparent + ), + 0 1px 3px rgba(15, 23, 42, 0.12); +} + +.topic-legend-field.topic-legend-entry-active { + color: color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 34%, + #07163d + ); +} + +.topic-legend-field.topic-legend-entry-active .topic-legend-dot { + box-shadow: + 0 0 0 2px #ffffff, + 0 0 0 4px + color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 82%, + transparent + ); +} + +.topic-legend-item.topic-legend-entry-active { + color: color-mix( + in srgb, + var(--legend-color, var(--topic-legend-accent)) 34%, + #07163d + ); + font-weight: 800; +} + .topic-legend-more-toggle { flex: 0 0 auto; padding: 0; diff --git a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.ts b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.ts index 171ac204..e28a0311 100644 --- a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.ts +++ b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.ts @@ -2,7 +2,11 @@ import { CommonModule } from '@angular/common'; import { Component, EventEmitter, Input, Output } from '@angular/core'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; -import { TopicLegendGroup, TopicLegendItem } from '../../utils/topic-legend'; +import { + TopicLegendGroup, + TopicLegendItem, + TopicLegendSubfieldSelection, +} from '../../utils/topic-legend'; export type TopicLegendVariant = 'default' | 'compact'; @@ -24,9 +28,14 @@ export class TopicLegendComponent { @Input() showVisibilityToggle = true; @Input() collapsedGroupLimit = 3; @Input() variant: TopicLegendVariant = 'default'; + @Input() selectable = false; + @Input() activeFieldIds: ReadonlySet | readonly string[] = []; + @Input() activeSubfieldIds: ReadonlySet | readonly string[] = []; @Output() visibleChange = new EventEmitter(); @Output() expandedChange = new EventEmitter(); + @Output() fieldToggle = new EventEmitter(); + @Output() subfieldToggle = new EventEmitter(); get hasGroups(): boolean { return this.groups.length > 0; @@ -66,6 +75,37 @@ export class TopicLegendComponent { this.expandedChange.emit(!this.expanded); } + toggleField(group: TopicLegendGroup): void { + if (!this.selectable) { + return; + } + + this.fieldToggle.emit(group); + } + + toggleSubfield(group: TopicLegendGroup, item: TopicLegendItem): void { + if (!this.selectable) { + return; + } + + this.subfieldToggle.emit({ group, item }); + } + + isFieldActive(group: TopicLegendGroup): boolean { + return this.isActiveLegendId(this.activeFieldIds, group.id); + } + + isSubfieldActive(item: TopicLegendItem): boolean { + return this.isActiveLegendId(this.activeSubfieldIds, item.id); + } + + isGroupActive(group: TopicLegendGroup): boolean { + return ( + this.isFieldActive(group) || + group.items.some((item) => this.isSubfieldActive(item)) + ); + } + trackByGroup(_: number, group: TopicLegendGroup): string { return group.id; } @@ -73,4 +113,15 @@ export class TopicLegendComponent { trackByItem(_: number, item: TopicLegendItem): string { return item.id; } + + private isActiveLegendId( + activeIds: ReadonlySet | readonly string[], + id: string, + ): boolean { + if ('has' in activeIds) { + return activeIds.has(id); + } + + return activeIds.includes(id); + } } diff --git a/webapp/src/app/shared/utils/topic-legend.ts b/webapp/src/app/shared/utils/topic-legend.ts index a54779c3..d297cba3 100644 --- a/webapp/src/app/shared/utils/topic-legend.ts +++ b/webapp/src/app/shared/utils/topic-legend.ts @@ -26,6 +26,40 @@ export interface TopicLegendGroup { items: TopicLegendItem[]; } +export interface TopicLegendSubfieldSelection { + group: TopicLegendGroup; + item: TopicLegendItem; +} + +export function getTopicLegendFieldId(topic: TopicLegendTopic): string { + const fieldName = normalizeLegendValue(topic.field_name) ?? 'Ohne Fachgebiet'; + + return topic.field_id ?? normalizeLegendKey(fieldName); +} + +export function getTopicLegendSubfieldId(topic: TopicLegendTopic): string { + const subfieldName = normalizeLegendValue(topic.subfield_name); + + return ( + topic.subfield_id ?? (subfieldName ? normalizeLegendKey(subfieldName) : '') + ); +} + +export function toggleTopicLegendSelection( + currentSelection: ReadonlySet, + id: string, +): Set { + const nextSelection = new Set(currentSelection); + + if (nextSelection.has(id)) { + nextSelection.delete(id); + return nextSelection; + } + + nextSelection.add(id); + return nextSelection; +} + export function buildTopicLegendGroups( topics: readonly TopicLegendTopic[], ): TopicLegendGroup[] { @@ -47,8 +81,8 @@ export function buildTopicLegendGroups( normalizeLegendValue(topic.domain_description) ?? ''; const subfieldDescription = normalizeLegendValue(topic.subfield_description) ?? ''; - const fieldKey = topic.field_id ?? normalizeLegendKey(fieldName); - const subfieldKey = topic.subfield_id ?? normalizeLegendKey(subfieldName); + const fieldKey = getTopicLegendFieldId(topic); + const subfieldKey = getTopicLegendSubfieldId(topic); if (!groups.has(fieldKey)) { groups.set(fieldKey, { From f2cf83f63b34ebee7d63d75968d257bbb831d871 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 26 Jun 2026 14:16:56 +0200 Subject: [PATCH 04/92] topic-legend: select fields and subfields separately --- .../person-interesting.component.ts | 24 +++++++---- .../research-timeline.component.ts | 19 ++++++--- .../topic-legend/topic-legend.component.html | 2 +- .../ui/topic-legend/topic-legend.component.ts | 9 +---- webapp/src/app/shared/utils/topic-legend.ts | 40 +++++++++++++++++++ 5 files changed, 72 insertions(+), 22 deletions(-) diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.ts b/webapp/src/app/modules/person-interesting/person-interesting.component.ts index ced9f9d0..a5f690c2 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -23,7 +23,8 @@ import { getTopicLegendSubfieldId, TopicLegendGroup, TopicLegendSubfieldSelection, - toggleTopicLegendSelection, + toggleTopicLegendFieldSelection, + toggleTopicLegendSubfieldSelection, } from '../../shared/utils/topic-legend'; interface InterestTag { @@ -154,18 +155,25 @@ export class PersonInterestingComponent implements OnInit { } onLegendFieldToggle(group: TopicLegendGroup): void { - this.activeLegendFieldIds.set( - toggleTopicLegendSelection(this.activeLegendFieldIds(), group.id), + const selection = toggleTopicLegendFieldSelection( + this.activeLegendFieldIds(), + this.activeLegendSubfieldIds(), + group, ); + + this.activeLegendFieldIds.set(selection.fieldIds); + this.activeLegendSubfieldIds.set(selection.subfieldIds); } onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void { - this.activeLegendSubfieldIds.set( - toggleTopicLegendSelection( - this.activeLegendSubfieldIds(), - selection.item.id, - ), + const nextSelection = toggleTopicLegendSubfieldSelection( + this.activeLegendFieldIds(), + this.activeLegendSubfieldIds(), + selection, ); + + this.activeLegendFieldIds.set(nextSelection.fieldIds); + this.activeLegendSubfieldIds.set(nextSelection.subfieldIds); } isTagActive(tag: InterestTag): boolean { diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 09392acc..cd0f382f 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -21,7 +21,8 @@ import { getTopicLegendSubfieldId, TopicLegendGroup, TopicLegendSubfieldSelection, - toggleTopicLegendSelection, + toggleTopicLegendFieldSelection, + toggleTopicLegendSubfieldSelection, } from '../../../../shared/utils/topic-legend'; import { buildTopicHierarchyTooltip } from '../../../../shared/utils/topic-tooltip'; @@ -430,17 +431,25 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { } onLegendFieldToggle(group: TopicLegendGroup): void { - this.activeLegendFieldIds = toggleTopicLegendSelection( + const selection = toggleTopicLegendFieldSelection( this.activeLegendFieldIds, - group.id, + this.activeLegendSubfieldIds, + group, ); + + this.activeLegendFieldIds = selection.fieldIds; + this.activeLegendSubfieldIds = selection.subfieldIds; } onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void { - this.activeLegendSubfieldIds = toggleTopicLegendSelection( + const nextSelection = toggleTopicLegendSubfieldSelection( + this.activeLegendFieldIds, this.activeLegendSubfieldIds, - selection.item.id, + selection, ); + + this.activeLegendFieldIds = nextSelection.fieldIds; + this.activeLegendSubfieldIds = nextSelection.subfieldIds; } isTopicActiveByLegend(topic: TopicTimelineTopic): boolean { diff --git a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html index 115a8e3a..330ccc2b 100644 --- a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html +++ b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html @@ -47,7 +47,7 @@
- @for (ipr of patents; track ipr.title) { + @for (ipr of patents; track ipr.applicationIdentifier) {
@if (ipr.type === 'PATENT') { diff --git a/webapp/src/app/modules/projects/eu-cordis-details/patents-cards/patents-cards.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/patents-cards/patents-cards.component.ts index 1d8f46ac..248c91a4 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/patents-cards/patents-cards.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/patents-cards/patents-cards.component.ts @@ -16,9 +16,11 @@ export class PatentsCardsComponent { @Input() headerTitle: string = 'IPRs'; private router = inject(Router); searchForPatent(patent: Fp7ProjectIPR): void { - this.router.navigate(['/patents'], { + this.router.navigate([`/patent/${patent.applicationIdentifier}`], { queryParams: { - search: patent.title, + prefix: patent.applicationPrefix, + title: patent.title, + fillingDate: patent.applicationDate, }, }); } From b69fe4e15c55e100adcbf32afe8a0f35aa67017b Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 29 Jun 2026 21:25:01 +0200 Subject: [PATCH 06/92] Improve timeline legend width --- .../research-timeline.component.html | 29 +++++++------- .../research-timeline.component.scss | 38 ++++++++++++++++++- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index 55f0d938..a478142c 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -7,20 +7,6 @@ (basierend auf Publikationen)

- - - + +
+
+ + + +
+ @if (form.controls.selectedInputType.value !== 'keywords') { + + } +
+ + +
+ + + + @if (sourceContent().length > 0 && extractionSource() === 'url') { + + + Extrahierte Inhalte: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ + } + + +
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
+ + +
+ + @if (areAllExtractedSelected()) { + + } @else { + + } + + + +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie + hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ + + + +
+ Eigene Keywords + @if (manualKeywords().length > 0) { + + @for (keyword of manualKeywords(); track keyword) { + {{ keyword }} + } + + } @else { +

Keine manuell hinzugefügten Keywords.

+ } +
+
+
+
+ + +
+ +
+
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss new file mode 100644 index 00000000..90da7cab --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -0,0 +1,244 @@ +.content { + display: flex; + flex-direction: column; + gap: 0.75rem; + padding: 1rem; +} + +.tab-content { + padding: 0.5rem 0; +} + +.full-width { + width: 100%; +} + +.keyword-input-row { + display: flex; + align-items: flex-start; + gap: 0.75rem; +} + +.actions { + display: flex; + justify-content: flex-end; +} + +.extraction-grid { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; +} + +.keyword-card { + background-color: var(--sg-background); + padding: 0.5rem; + + .mat-card-header { + padding: 0 0 0.5rem 0; + } + + .mat-card-content { + padding: 0; + } +} + +.category-grid { + display: grid; + grid-template-columns: 1fr; + gap: 0.75rem 1.5rem; +} + +.category-section { + h4 { + margin: 0 0 0.25rem 0; + font-weight: 500; + color: var(--sg-text-secondary); + font-size: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.05em; + } + + mat-chip-listbox { + width: 100%; + } +} + +.compact-chip { + font-size: 0.8rem; + padding: 0.2rem 0.6rem; + min-height: 28px; + line-height: 1.2; +} + +::ng-deep .mat-mdc-chip-option.compact-chip { + .mat-mdc-chip-action-label { + padding: 0 4px; + } + .mat-mdc-chip-action { + padding: 0 4px; + } +} + +/* Selected keywords buttons */ +.selected-keywords { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; +} + +.selected-keyword { + display: inline-flex; + align-items: center; + gap: 0.15rem; + font-size: 0.8rem; + padding: 0.2rem 0.6rem; + min-height: 28px; + + .mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + line-height: 18px; + } +} +.section-title { + margin: 0.5rem 0 0.25rem 0; + font-size: 1rem; + font-weight: 500; + color: var(--sg-text-primary); +} + +.extracted-section, +.manual-section { + margin-bottom: 0.5rem; +} +.manual-section { + margin-top: 0.5rem; +} +.mat-divider { + margin: 0.5rem 0; +} +.select-all-container { + display: flex; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } +} +.select-all-container { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } +} +.empty-state { + color: var(--sg-text-secondary); + margin: 0; + font-size: 0.9rem; + padding: 0.5rem 0; +} + +/* NEW: Search button container */ +.search-container { + display: flex; + justify-content: flex-end; + margin-top: 0.5rem; +} + +/* Responsive: stack on small screens */ +@media (max-width: 768px) { + .extraction-grid { + grid-template-columns: 1fr; + } + + .category-grid { + grid-template-columns: 1fr; + gap: 0.75rem; + } + + .keyword-input-row { + flex-direction: column; + } + + .actions { + justify-content: flex-start; + } + + .search-container { + justify-content: flex-start; + } +} +/* Source expansion panel */ +.source-expansion { + margin: 0.75rem 0; + background: var(--sg-background-muted, #f5f5f5); + border-radius: 4px; + border-left: 4px solid var(--sg-primary, #1976d2); + + ::ng-deep .mat-expansion-panel-header { + padding: 0.5rem 0.75rem; + height: auto; + min-height: 36px; + font-size: 1rem; + text-transform: uppercase; + color: var(--sg-text-secondary); + letter-spacing: 0.05em; + + .mat-expansion-panel-header-title { + font-size: 0.8rem; + font-weight: 500; + color: inherit; + } + + .mat-expansion-indicator { + margin-left: 0.5rem; + } + } + + ::ng-deep .mat-expansion-panel-content { + font-size: 0.85rem; + line-height: 1.5; + color: var(--sg-text-primary); + } + + ::ng-deep .mat-expansion-panel-body { + padding: 0 0.75rem 0.75rem 0.75rem; + max-height: 120px; // scrollable if content is long + overflow-y: auto; + white-space: pre-wrap; // preserve line breaks + word-break: break-word; + } + + // Remove the default Material box-shadow for a cleaner outline look + ::ng-deep .mat-expansion-panel { + box-shadow: none !important; + background: transparent; + } + + // Ripple effect on header – keep it subtle + ::ng-deep .mat-expansion-panel-header:hover { + background: rgba(0, 0, 0, 0.03); + } +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts new file mode 100644 index 00000000..6b3c5f67 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -0,0 +1,427 @@ +import { Component, signal, computed } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; +import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; +import { MatDividerModule } from '@angular/material/divider'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { MatTabsModule } from '@angular/material/tabs'; +import { ActivatedRoute, Router } from '@angular/router'; +import { debounceTime, distinctUntilChanged } from 'rxjs'; +import { KeywordsService } from '../../api/api/keywords.service'; +import { KeywordsRequest } from '../../api/model/keywordsRequest'; +import { MatExpansionModule } from '@angular/material/expansion'; +type InputMode = 'url' | 'text' | 'keywords'; + +@Component({ + selector: 'app-keywords-search', + imports: [ + ReactiveFormsModule, + MatTabsModule, + MatFormFieldModule, + MatInputModule, + MatButtonModule, + MatIconModule, + MatChipsModule, + MatDividerModule, + MatCardModule, + MatExpansionModule, + ], + templateUrl: './keywords-search.component.html', + styleUrl: './keywords-search.component.scss', +}) +export class KeywordsSearchComponent { + readonly form = this.formBuilder.nonNullable.group({ + selectedInputType: 'url' as InputMode, + urlInput: '', + textInput: '', + keywordInput: '', + }); + + private readonly SESSION_KEY = 'keywords-search-source'; + // Category signals + readonly broadKeywords = signal([]); + readonly coarseKeywords = signal([]); + readonly fineKeywords = signal([]); + readonly manualKeywords = signal([]); + + readonly selectedKeywords = signal([]); + readonly isExtracting = signal(false); + + readonly extractionSource = signal(null); + + readonly selectedBroadKeywords = computed(() => + this.selectedKeywords().filter((k) => this.broadKeywords().includes(k)), + ); + readonly selectedCoarseKeywords = computed(() => + this.selectedKeywords().filter((k) => this.coarseKeywords().includes(k)), + ); + readonly selectedFineKeywords = computed(() => + this.selectedKeywords().filter((k) => this.fineKeywords().includes(k)), + ); + readonly selectedManualKeywords = computed(() => + this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), + ); + readonly extractedKeywordsExist = computed( + () => + this.broadKeywords().length > 0 || + this.coarseKeywords().length > 0 || + this.fineKeywords().length > 0, + ); + + readonly sourceContent = signal(''); + readonly sourceUrl = signal(null); + + private isRestoringState = false; + + constructor( + private readonly formBuilder: FormBuilder, + private readonly route: ActivatedRoute, + private readonly router: Router, + private readonly keywordsService: KeywordsService, + ) { + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + this.restoreStateFromQueryParams(); + }); + + this.form.controls.selectedInputType.valueChanges + .pipe(distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + + this.form.controls.urlInput.valueChanges + .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + + this.form.controls.textInput.valueChanges + .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + } + + selectedTabIndex(): number { + const mode = this.form.controls.selectedInputType.value; + if (mode === 'text') return 1; + if (mode === 'keywords') return 2; + return 0; + } + + onTabChange(index: number): void { + const nextMode: InputMode = + index === 1 ? 'text' : index === 2 ? 'keywords' : 'url'; + this.form.controls.selectedInputType.setValue(nextMode); + } + + // Add manually from Keywords tab + addKeywordFromInput(): void { + const keyword = this.form.controls.keywordInput.value.trim(); + if (!keyword) return; + + this.manualKeywords.set( + this.uniqueKeywords([...this.manualKeywords(), keyword]), + ); + this.selectedKeywords.set( + this.uniqueKeywords([...this.selectedKeywords(), keyword]), + ); + this.form.controls.keywordInput.setValue(''); + this.updateQueryParams(); + } + + removeSelectedKeyword(keyword: string): void { + this.selectedKeywords.set( + this.selectedKeywords().filter((v) => v !== keyword), + ); + this.updateQueryParams(); + } + + onCategoryChange( + category: 'broad' | 'coarse' | 'fine' | 'manual', + event: MatChipListboxChange, + ): void { + const newSelection = (event.value as string[]) || []; + const otherCategories = ['broad', 'coarse', 'fine', 'manual'].filter( + (c) => c !== category, + ); + const otherSelected = otherCategories.flatMap((c) => { + const keywords = this.getCategoryKeywords(c); + return this.selectedKeywords().filter((k) => keywords.includes(k)); + }); + const updated = [...otherSelected, ...newSelection]; + this.selectedKeywords.set(this.uniqueKeywords(updated)); + this.updateQueryParams(); + } + + private getCategoryKeywords(category: string): string[] { + switch (category) { + case 'broad': + return this.broadKeywords(); + case 'coarse': + return this.coarseKeywords(); + case 'fine': + return this.fineKeywords(); + case 'manual': + return this.manualKeywords(); + default: + return []; + } + } + + selectAllExtracted(): void { + const all = [ + ...this.selectedManualKeywords(), + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ]; + this.selectedKeywords.set(this.uniqueKeywords(all)); + this.updateQueryParams(); + } + + deselectAllExtracted(): void { + const manual = this.selectedManualKeywords(); + this.selectedKeywords.set(this.uniqueKeywords(manual)); + this.updateQueryParams(); + } + + clearExtractedKeywords(): void { + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + this.sourceContent.set(''); + this.sourceUrl.set(null); + this.clearSourceFromSession(); + // Keep only selected keywords that are in the manual list + const manualSet = new Set(this.manualKeywords()); + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => manualSet.has(k)), + ); + + // Reset the extraction source (no extracted keywords left) + this.extractionSource.set(null); + + this.updateQueryParams(); + } + + areAllExtractedSelected(): boolean { + const allExtracted = [ + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ]; + return allExtracted.every((k) => this.selectedKeywords().includes(k)); + } + // isExtractionSourceMatch() { + // console.log( + // this.extractionSource(), + // this.form.controls.selectedInputType.value, + // ); + // return ( + // this.form.controls.selectedInputType.value === this.extractionSource() || + // this.form.controls.selectedInputType.value === 'keywords' + // ); + // } + isSearchDisabled(): boolean { + return this.selectedKeywords().length === 0 || this.isExtracting(); + } + + extractKeywords(): void { + const query = this.getCurrentExtractionQuery(); + if (!query) return; + + const currentMode = this.form.controls.selectedInputType.value; + const keywordsRequest: KeywordsRequest = { + query: query, + mode: currentMode, + limit: undefined, + }; + + this.isExtracting.set(true); + this.keywordsService.extractKeywords(keywordsRequest).subscribe({ + next: ({ results, source, source_content, source_url }) => { + const broad = this.extractKeywordStrings(results.broad_keywords); + const coarse = this.extractKeywordStrings(results.coarse_grained); + const fine = this.extractKeywordStrings(results.fine_grained); + + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.sourceContent.set(source_content); + this.extractionSource.set(source as InputMode); + this.sourceUrl.set(source_url ?? ''); + this.saveSourceToSession(); + + console.log('Extracted keywords:', { + broad, + coarse, + fine, + manual: this.manualKeywords(), + }); + // Keep only selected keywords that still exist in any category (including manual) + const allExtracted = [ + ...broad, + ...coarse, + ...fine, + ...this.manualKeywords(), + ]; + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => allExtracted.includes(k)), + ); + + this.updateQueryParams(); + }, + error: () => { + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => + this.manualKeywords().includes(k), + ), + ); + // extractionSource stays as it was (or reset? we keep it) + this.updateQueryParams(); + }, + complete: () => { + this.isExtracting.set(false); + }, + }); + } + + search(): void { + console.log('searching for keywords:', this.selectedKeywords()); + // e.g. navigate to search results page + // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); + } + + private extractKeywordStrings(items: any[] | undefined): string[] { + return this.uniqueKeywords( + (items ?? []).map((kw) => kw.keyword?.trim() ?? '').filter((kw) => !!kw), + ); + } + + // State restoration from URL + restoreStateFromQueryParams(): void { + const queryParams = this.route.snapshot.queryParamMap; + const mode = this.parseMode(queryParams.get('mode')); + const urlInput = queryParams.get('url') ?? ''; + const textInput = queryParams.get('text') ?? ''; + const broad = this.parseKeywordList(queryParams.get('broad')); + const coarse = this.parseKeywordList(queryParams.get('coarse')); + const fine = this.parseKeywordList(queryParams.get('fine')); + const manual = this.parseKeywordList(queryParams.get('manual')); + const selected = this.parseKeywordList(queryParams.get('selected')); + const source = queryParams.get('source') ?? ''; + this.isRestoringState = true; + this.form.patchValue( + { + selectedInputType: mode, + urlInput, + textInput, + }, + { emitEvent: false }, + ); + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.manualKeywords.set(manual); + this.selectedKeywords.set(this.uniqueKeywords(selected)); + this.extractionSource.set(source as InputMode); + this.restoreSourceFromSession(); + this.isRestoringState = false; + } + + // Update URL query params + updateQueryParams(): void { + if (this.isRestoringState) return; + + const queryParams = { + mode: this.form.controls.selectedInputType.value, + url: this.toNullableParam(this.form.controls.urlInput.value), + text: this.toNullableParam(this.form.controls.textInput.value), + broad: this.serializeKeywords(this.broadKeywords()), + coarse: this.serializeKeywords(this.coarseKeywords()), + fine: this.serializeKeywords(this.fineKeywords()), + manual: this.serializeKeywords(this.manualKeywords()), + selected: this.serializeKeywords(this.selectedKeywords()), + }; + + this.router.navigate([], { + relativeTo: this.route, + queryParams, + queryParamsHandling: 'merge', + replaceUrl: true, + }); + } + + // Save to sessionStorage + private saveSourceToSession(): void { + const data = { + source: this.extractionSource(), + sourceContent: this.sourceContent(), + sourceUrl: this.sourceUrl(), + }; + sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + } + + // Restore from sessionStorage + private restoreSourceFromSession(): void { + const raw = sessionStorage.getItem(this.SESSION_KEY); + if (!raw) return; + try { + const { source, sourceContent, sourceUrl } = JSON.parse(raw); + this.extractionSource.set(source as InputMode); + this.sourceContent.set(sourceContent ?? ''); + this.sourceUrl.set(sourceUrl ?? null); + } catch { + sessionStorage.removeItem(this.SESSION_KEY); + } + } + + // Clear sessionStorage + private clearSourceFromSession(): void { + sessionStorage.removeItem(this.SESSION_KEY); + } + private getCurrentExtractionQuery(): string { + const mode = this.form.controls.selectedInputType.value; + if (mode === 'url') return this.form.controls.urlInput.value.trim(); + if (mode === 'text') return this.form.controls.textInput.value.trim(); + return this.selectedKeywords().join(', ').trim(); + } + + private parseMode(mode: string | null): InputMode { + if (mode === 'text' || mode === 'keywords') return mode; + return 'url'; + } + + private parseKeywordList(rawValue: string | null): string[] { + if (!rawValue) return []; + return this.uniqueKeywords( + rawValue + .split(',') + .map((v) => v.trim()) + .filter((v) => !!v), + ); + } + + private serializeKeywords(keywords: string[]): string | null { + const sanitized = this.uniqueKeywords(keywords); + return sanitized.length ? sanitized.join(',') : null; + } + + private uniqueKeywords(values: string[]): string[] { + return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean))); + } + + private toNullableParam(value: string): string | null { + const normalized = value.trim(); + return normalized.length ? normalized : null; + } +} From 473bc96e90d1ef1979300ada565f575a15e33b2e Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:02 +0200 Subject: [PATCH 09/92] generated models for frontend --- webapp/src/app/api/.openapi-generator/FILES | 5 + webapp/src/app/api/api/api.ts | 3 + webapp/src/app/api/api/keywords.service.ts | 162 ++++++++++++++++++ webapp/src/app/api/model/extractedKeywords.ts | 31 ++++ .../api/model/extractedKeywordsResponse.ts | 28 +++ webapp/src/app/api/model/keywordsRequest.ts | 26 +++ 6 files changed, 255 insertions(+) create mode 100644 webapp/src/app/api/api/keywords.service.ts create mode 100644 webapp/src/app/api/model/extractedKeywords.ts create mode 100644 webapp/src/app/api/model/extractedKeywordsResponse.ts create mode 100644 webapp/src/app/api/model/keywordsRequest.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 9a1f5c93..37921947 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -10,6 +10,7 @@ api/iNSEAccountService.service.ts api/iNSEService.service.ts api/institutions.service.ts api/items.service.ts +api/keywords.service.ts api/news.service.ts api/patents.service.ts api/personNetwork.service.ts @@ -66,6 +67,8 @@ model/euCordisProjectResponse.ts model/euOrganizationProjectSummary.ts model/euOrganizationProjectSummaryPage.ts model/euProjectData.ts +model/extractedKeywords.ts +model/extractedKeywordsResponse.ts model/filterInformation.ts model/filterProperties.ts model/fp7EurosciVoc.ts @@ -116,7 +119,9 @@ model/ipcClassification.ts model/item.ts model/itemCreate.ts model/itemPage.ts +model/keywordEntry.ts model/keywords.ts +model/keywordsRequest.ts model/latitude.ts model/location.ts model/longitude.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 7f47efcd..39dc1b80 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,6 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './items.service'; import { ItemsService } from './items.service'; +import { KeywordsService } from './keywords.service'; +export * from './keywords.service'; export * from './news.service'; import { NewsService } from './news.service'; export * from './patents.service'; @@ -31,6 +33,7 @@ export const APIS = [ INSEServiceService, InstitutionsService, ItemsService, + KeywordsService, NewsService, PatentsService, PersonNetworkService, diff --git a/webapp/src/app/api/api/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts new file mode 100644 index 00000000..172d077c --- /dev/null +++ b/webapp/src/app/api/api/keywords.service.ts @@ -0,0 +1,162 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent, + HttpParameterCodec, + HttpContext, +} from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { KeywordsRequest } from '../model/keywordsRequest'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + +@Injectable({ + providedIn: 'root', +}) +export class KeywordsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } + + /** + * Extracts keywords from text. + * @endpoint post /api/inse-service/keywords/extract + * @param keywordsRequest + * @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 extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (keywordsRequest === null || keywordsRequest === undefined) { + throw new Error( + 'Required parameter keywordsRequest was null or undefined when calling extractKeywords.', + ); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = + this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Content-Type', + httpContentTypeSelected, + ); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/keywords/extract`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'post', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } +} diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts new file mode 100644 index 00000000..29e27a45 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -0,0 +1,31 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordEntry } from './keywordEntry'; + + +export interface ExtractedKeywords { + /** + * The extracted broad keywords from text. + */ + broad_keywords: Array; + /** + * The extracted coarse-grained keywords from text. + */ + coarse_grained: Array; + /** + * The extracted fine-grained keywords from text. + */ + fine_grained: Array; + /** + * The source of the extracted keywords, e.g., \'text\', \'url\' + */ + source: string; +} + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts new file mode 100644 index 00000000..fb156a70 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -0,0 +1,28 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { ExtractedKeywords } from './extractedKeywords'; + + +export interface ExtractedKeywordsResponse { + /** + * The extracted keywords from the input text. + */ + results: ExtractedKeywords; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; +} + diff --git a/webapp/src/app/api/model/keywordsRequest.ts b/webapp/src/app/api/model/keywordsRequest.ts new file mode 100644 index 00000000..b430dd08 --- /dev/null +++ b/webapp/src/app/api/model/keywordsRequest.ts @@ -0,0 +1,26 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface KeywordsRequest { + /** + * The input text from which to extract keywords. + */ + query: string; + /** + * The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'. + */ + mode: string; + /** + * The maximum number of keywords to extract. + */ + limit?: number; +} + From 095a4c8bacf4297ec1fc09df430106c3b4533546 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:27 +0200 Subject: [PATCH 10/92] generated models for frontend (2) --- webapp/src/app/api/model/keywordEntry.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 webapp/src/app/api/model/keywordEntry.ts diff --git a/webapp/src/app/api/model/keywordEntry.ts b/webapp/src/app/api/model/keywordEntry.ts new file mode 100644 index 00000000..e8e9cc5c --- /dev/null +++ b/webapp/src/app/api/model/keywordEntry.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface KeywordEntry { + /** + * The extracted keyword. + */ + keyword: string; + /** + * The relevance score of the keyword. + */ + relevance_score: number; +} + From 4b8256b56e9af6577d3e7cfc6d6ef5c7d14b2306 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:54 +0200 Subject: [PATCH 11/92] added new route for keywords search --- webapp/src/app/app.routes.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 27cbb63a..273a92e9 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -15,7 +15,6 @@ import { bundSingleProjectResolver } from './resolvers/bund-single-project-resol import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver'; import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver'; import { fundingProjectPageResolver } from './resolvers/funding-project-page.resolver'; -import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver'; import { euSingleProjectResolver } from './resolvers/eu-single-project-resolver'; import { publicationResolver } from './resolvers/publication-resolver'; export const routes: Routes = [ @@ -79,6 +78,14 @@ export const routes: Routes = [ return scalarChanged || topicsChanged; }, }, + { + path: 'keywords', + canActivate: [userGuard], + loadComponent: () => + import('./modules/keywords-search/keywords-search.component').then( + (mod) => mod.KeywordsSearchComponent, + ), + }, { path: 'news', canActivate: [userGuard], From 0502a9a5532fa67d2bd29c8742fa89c61bd2f62d Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:25:35 +0200 Subject: [PATCH 12/92] added new endpoint for keywords search --- service/Dockerfile | 1 + service/src/main/inse/keywords/__init__.py | 0 service/src/main/inse/keywords/logic.py | 85 ++++ service/src/main/inse/keywords/model.py | 29 ++ service/src/main/inse/keywords/prompts.py | 490 +++++++++++++++++++++ service/src/main/inse/keywords/service.py | 35 ++ service/src/main/inse/main.py | 2 + 7 files changed, 642 insertions(+) create mode 100644 service/src/main/inse/keywords/__init__.py create mode 100644 service/src/main/inse/keywords/logic.py create mode 100644 service/src/main/inse/keywords/model.py create mode 100644 service/src/main/inse/keywords/prompts.py create mode 100644 service/src/main/inse/keywords/service.py diff --git a/service/Dockerfile b/service/Dockerfile index 90d1a619..8360de57 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -14,6 +14,7 @@ RUN pip install --root-user-action=ignore --no-cache-dir --disable-pip-version-c "httpx~=0.27.0" \ "python-multipart~=0.0.19"\ "elasticsearch~=9.4.0" \ + "beautifulsoup4==4.12.3" \ "openai~=2.41.0" COPY [ "src/main", "/home" ] diff --git a/service/src/main/inse/keywords/__init__.py b/service/src/main/inse/keywords/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py new file mode 100644 index 00000000..7daabdbc --- /dev/null +++ b/service/src/main/inse/keywords/logic.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Business logic for persons / authors. +""" + +import json +import logging +import time +import httpx +from bs4 import BeautifulSoup + +from inse.keywords.prompts import KeywordsPrompt +from inse.integrations import llm +from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse +logger = logging.getLogger(__name__) + +def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: + """ + Extracts keywords from the given text or URL using a language model. + """ + start_time = time.time() + if mode == "url": + text = _get_text_content(query) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + + else: + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + text = query + + + system_prompt + user_prompt = f""" + Now analyze the following text and return ONLY the JSON object.\n""" + + if limit: + user_prompt +="Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" + + user_prompt += f"""Input:{text}""" + + keywords = llm.call( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema = ExtractedKeywords.model_json_schema(), + schema_name = "extracted_keywords", + temperature=0.8, + top_p=0.95, + ) + keywords_json = json.loads(keywords) + + elapsed_time = time.time() - start_time + logger.info(f"Keyword extraction took {elapsed_time:.2f} seconds") + return ExtractedKeywordsResponse(results=keywords_json, source=mode, source_url=query if mode == "url" else None, source_content=text) + + +def _get_text_content(url: str) -> str: + """ + Fetches the HTML content from the given URL using httpx and extracts visible text. + """ + try: + headers = { + "User-Agent": ( + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + "AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/91.0.4472.124 Safari/537.36" + ) + } + # Using a synchronous client (no 'async' needed) + with httpx.Client(timeout=10.0) as client: + response = client.get(url, headers=headers) + response.raise_for_status() + + soup = BeautifulSoup(response.text, "html.parser") + for element in soup(["script", "style"]): + element.decompose() + + text = soup.get_text(separator=" ", strip=True) + text = " ".join(text.split()) + return text + + except httpx.HTTPError as e: + logger.error(f"HTTP error for {url}: {e}") + except Exception as e: + logger.error(f"Error processing {url}: {e}") + return "" \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py new file mode 100644 index 00000000..5683001d --- /dev/null +++ b/service/src/main/inse/keywords/model.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Data models for persons / authors. +""" +from pydantic import BaseModel +from pydantic import Field +from typing import List + +class KeywordsRequest(BaseModel): + query: str = Field(description="The input text from which to extract keywords.") + mode: str = Field(description="The mode of keyword extraction, e.g., 'url', 'text', or 'keywords'.") + limit: int = Field(default=None, description="The maximum number of keywords to extract.") + +class KeywordEntry(BaseModel): + keyword: str = Field(description="The extracted keyword.") + relevance_score: float = Field(description="The relevance score of the keyword.") + +class ExtractedKeywords(BaseModel): + broad_keywords: List[KeywordEntry] = Field(description="The extracted broad keywords from text.") + coarse_grained: List[KeywordEntry] = Field(description="The extracted coarse-grained keywords from text.") + fine_grained: List[KeywordEntry] = Field(description="The extracted fine-grained keywords from text.") + +class ExtractedKeywordsResponse(BaseModel): + results: ExtractedKeywords = Field(description="The extracted keywords from the input text.") + source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") + source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") + source_content: str = Field(description="The actual content from which keywords were extracted.") + diff --git a/service/src/main/inse/keywords/prompts.py b/service/src/main/inse/keywords/prompts.py new file mode 100644 index 00000000..292630c2 --- /dev/null +++ b/service/src/main/inse/keywords/prompts.py @@ -0,0 +1,490 @@ +from enum import StrEnum +class KeywordsPrompt(StrEnum): + EXTRACT_KEYWORDS_TEXT_PROMPT = """You are an expert scientific, technical, and innovation intelligence analyst. + + Your task is to extract keywords from a given text and organize them into three hierarchical levels suitable for technology scouting, innovation discovery, scientific literature search, and OpenAlex-based research retrieval. + + The extracted keywords should prioritize: + + * Scientific domains + * Technologies + * Research fields + * Methods + * Applications + * Materials + * Standards + * Diseases + * Industrial sectors + * Technical concepts + + Avoid generic business terms unless they are core topics of the text. + + Examples of terms to avoid: + + * Solution + * Platform + * Improvement + * Capability + * Innovation + * Process + * Service + * Performance + * Efficiency + + unless they represent an actual searchable concept. + + --- + + # Keyword Hierarchy + + ## 1. broad_keywords + + High-level domains, disciplines, industries, or technology areas. + + Examples: + + * Artificial Intelligence + * Healthcare + * Biotechnology + * Renewable Energy + * Materials Science + * Robotics + + These should represent the major themes of the document. + + --- + + ## 2. coarse_grained + + Mid-level concepts, technologies, research areas, methods, or applications. + + Examples: + + * Machine Learning + * Drug Discovery + * Computer Vision + * Predictive Maintenance + * Smart Manufacturing + * Gene Editing + + These should provide more specific context within the broad domains. + + --- + + ## 3. fine_grained + + Highly specific technical concepts, algorithms, materials, protocols, standards, tools, products, datasets, biomarkers, or specialized terminology. + + Examples: + + * Transformer Architecture + * CRISPR-Cas9 + * Retrieval-Augmented Generation + * Lithium Iron Phosphate + * YOLOv8 + * OPC UA + + These should be the most specific and actionable concepts for literature retrieval. + + --- + + # Relevance Score + + Each keyword must include a relevance score. + + Definition: + + * 1.0 = central concept of the text + * 0.9 = extremely important concept + * 0.8 = highly relevant concept + * 0.7 = important supporting concept + * 0.6 = relevant secondary concept + * below 0.6 = use sparingly + + Guidelines: + + * Scores must be between 0.0 and 1.0. + * Use decimal precision up to 2 digits. + * Rank keywords by importance. + * The most important keywords should appear first. + * Broad keywords generally receive higher scores than secondary topics. + * Only include keywords with meaningful relevance. + + --- + + # Extraction Rules + + * Extract only concepts explicitly mentioned or strongly implied. + * Prefer noun phrases. + * Avoid complete sentences. + * Avoid duplicates across levels whenever possible. + * Do not invent technologies not supported by the text. + * Prefer terminology that can be searched in scientific literature databases such as OpenAlex. + * Return between 5 and 15 keywords per level when sufficient information exists. + + --- + + # Output Schema + + Return ONLY valid JSON. + + { + "broad_keywords": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ], + "coarse_grained": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ], + "fine_grained": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ] + } + + --- + + # Example 1 + + Input: + + Researchers developed a transformer-based machine learning framework for predictive maintenance in industrial manufacturing. The system uses sensor fusion, anomaly detection, and time-series forecasting to reduce downtime in smart factories. + + Output: + + { + "broad_keywords": [ + { + "keyword": "Artificial Intelligence", + "relevance_score": 0.98 + }, + { + "keyword": "Manufacturing", + "relevance_score": 0.94 + }, + { + "keyword": "Industrial Automation", + "relevance_score": 0.90 + } + ], + "coarse_grained": [ + { + "keyword": "Machine Learning", + "relevance_score": 0.96 + }, + { + "keyword": "Predictive Maintenance", + "relevance_score": 0.95 + }, + { + "keyword": "Smart Factories", + "relevance_score": 0.88 + }, + { + "keyword": "Sensor Fusion", + "relevance_score": 0.86 + }, + { + "keyword": "Anomaly Detection", + "relevance_score": 0.85 + }, + { + "keyword": "Time-Series Forecasting", + "relevance_score": 0.83 + } + ], + "fine_grained": [ + { + "keyword": "Transformer Architecture", + "relevance_score": 0.95 + }, + { + "keyword": "Industrial Sensors", + "relevance_score": 0.84 + }, + { + "keyword": "Multimodal Data Fusion", + "relevance_score": 0.82 + }, + { + "keyword": "Predictive Analytics", + "relevance_score": 0.80 + } + ] + } + + --- + + # Example 2 + + Input: + + A healthcare platform uses large language models and retrieval-augmented generation to automatically summarize patient records and support clinical decision-making. + + Output: + + { + "broad_keywords": [ + { + "keyword": "Healthcare", + "relevance_score": 0.97 + }, + { + "keyword": "Artificial Intelligence", + "relevance_score": 0.95 + }, + { + "keyword": "Digital Health", + "relevance_score": 0.89 + } + ], + "coarse_grained": [ + { + "keyword": "Large Language Models", + "relevance_score": 0.96 + }, + { + "keyword": "Clinical Decision Support", + "relevance_score": 0.92 + }, + { + "keyword": "Medical Record Analysis", + "relevance_score": 0.90 + }, + { + "keyword": "Natural Language Processing", + "relevance_score": 0.88 + } + ], + "fine_grained": [ + { + "keyword": "Retrieval-Augmented Generation", + "relevance_score": 0.95 + }, + { + "keyword": "Patient Record Summarization", + "relevance_score": 0.91 + }, + { + "keyword": "Clinical Documentation", + "relevance_score": 0.86 + }, + { + "keyword": "Medical Text Processing", + "relevance_score": 0.84 + } + ] + } + + --- + """ + + + EXTRACT_WEBSITE_KEYWORDS_PROMPT = """ + You are an expert technology scout, scientific analyst, and innovation intelligence specialist. + + The input text was extracted automatically from a webpage using BeautifulSoup or a similar HTML parser. + + The extracted text may contain: + + * Navigation menus + * Headers and footers + * Cookie notices + * Marketing language + * Contact information + * Repeated sections + * Calls to action + * Legal disclaimers + * Product pages + * Blog articles + * News articles + * Landing pages + + Your first task is to identify the actual content and purpose of the webpage. + + Ignore: + + * Navigation elements + * Cookie banners + * Legal notices + * Copyright text + * Generic marketing statements + * Contact information + * Login/signup content + * Careers pages unless they contain relevant technical information + * Repeated website boilerplate + + Focus only on content that helps identify: + + * Technologies + * Scientific concepts + * Research areas + * Technical methods + * Products + * Applications + * Industrial sectors + * Materials + * Standards + * Diseases + * Engineering disciplines + * Innovation domains + + --- + + # Step 1: Determine Page Type + + Determine which type of page is represented: + + * Technology/Product Page + * Company Page + * Research Article + * Scientific Blog Post + * News Article + * Technical Documentation + * White Paper + * Industry Report + * Other + + Use this classification internally only. + + Do not include it in the output. + + --- + + # Step 2: Extract Searchable Concepts + + Prioritize concepts that are useful for: + + * OpenAlex retrieval + * Scientific literature discovery + * Patent scouting + * Technology scouting + * Innovation monitoring + + Prefer canonical scientific terminology over marketing language. + + Examples: + + Prefer: + + * Large Language Models + + Instead of: + + * AI Assistant + + Prefer: + + * Smart Manufacturing + + Instead of: + + * Factory Optimization Solution + + Prefer: + + * Retrieval-Augmented Generation + + Instead of: + + * Intelligent Knowledge Assistant + + Prefer: + + * Predictive Maintenance + + Instead of: + + * Equipment Performance Optimization + + --- + + # Keyword Hierarchy + + ## broad_keywords + + High-level domains, industries, disciplines, or technology areas. + + Examples: + + * Artificial Intelligence + * Healthcare + * Manufacturing + * Energy Storage + * Biotechnology + * Robotics + + --- + + ## coarse_grained + + Technologies, methods, research fields, and applications. + + Examples: + + * Machine Learning + * Predictive Maintenance + * Drug Discovery + * Smart Manufacturing + * Computer Vision + * Clinical Decision Support + + --- + + ## fine_grained + + Specific technical concepts, algorithms, materials, standards, tools, products, datasets, biomarkers, or protocols. + + Examples: + + * Transformer Architecture + * CRISPR-Cas9 + * OPC UA + * Retrieval-Augmented Generation + * YOLOv8 + * Lithium Iron Phosphate + + --- + + # Relevance Score + + Assign a relevance score between 0.0 and 1.0. + + Guidelines: + + * 1.00 = central topic of the webpage + * 0.90 = major topic + * 0.80 = highly relevant + * 0.70 = supporting concept + * 0.60 = secondary concept + + Avoid scores below 0.60 unless necessary. + + --- + + # Additional Rules + + * Extract only concepts supported by the page content. + * Do not hallucinate technologies. + * Avoid generic company descriptions. + * Avoid generic business terminology. + * Prefer terminology suitable for scientific literature search. + * Prefer concepts that could appear in OpenAlex, patents, technical reports, or academic publications. + * Remove duplicates across hierarchy levels whenever possible. + * Rank keywords by importance. + + --- + + Return ONLY valid JSON matching the schema provided by the API. + + The following text was extracted from a webpage: + + {{PAGE_CONTENT}} + """ diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py new file mode 100644 index 00000000..0eddc579 --- /dev/null +++ b/service/src/main/inse/keywords/service.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +REST API for persons / authors. +""" + +from typing import Annotated +from fastapi import Body +from fastapi import APIRouter +from . import logic +from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest + + +router = APIRouter( + prefix="/api/inse-service", + tags=["Keywords"], + responses={404: {"description": "Not found"}}, +) + + +@router.post( + "/keywords/extract", + operation_id="extractKeywords", + response_model=ExtractedKeywordsResponse, + summary="Extracts keywords from text.", + response_model_exclude_none=True, +) +def extract_keywords( + request: Annotated[ + KeywordsRequest, + Body(description="Input text for keyword extraction") + ], + +): + return logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index e82349d9..6aa12645 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -29,6 +29,7 @@ from inse.funders.service import router as funders_service_router from inse.news.service import router as news_service_router from inse.projects.router import router as projects_router from inse.patents.service import router as patents_service_router +from inse.keywords.service import router as keywords_service_router from inse.institutions.router import router as institutions_router from . import config @@ -63,6 +64,7 @@ app.include_router(patents_service_router) app.include_router(university_ranking_router) app.include_router(projects_router) app.include_router(patents_all_router) +app.include_router(keywords_service_router) app.add_middleware( ETagCacheMiddleware, From 17931a82b0411584c3eb704c573bdd4b3643deac Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:25:55 +0200 Subject: [PATCH 13/92] added optional response schema to llm response --- service/src/main/inse/integrations/llm.py | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index 6cf4ed22..f46e261f 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -1,11 +1,13 @@ from openai import OpenAI, APIConnectionError from .. import config - +from typing import Optional, Dict, Any def call( system_prompt: str, user_prompt: str, model: str = None, + json_schema = None, + schema_name = None, timeout: int = 30, temperature: float = 1.0, top_p: float = 0.95, @@ -13,13 +15,16 @@ def call( if model is None: model = config.settings.llm_model - + + response_format = None + if json_schema is not None: + response_format = _get_response_format(schema = json_schema,schema_name=schema_name) + client = OpenAI( base_url=config.settings.llm_api_url, api_key=config.settings.llm_api_key, timeout=timeout, ) - try: response = client.chat.completions.create( model=model, @@ -27,10 +32,10 @@ def call( {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ], - temperature=temperature, top_p=top_p, extra_body={"top_k": 64}, + response_format=response_format ) except APIConnectionError: return "Etwas ist schiefgelaufen. Bitte versuche es später erneut." @@ -38,3 +43,14 @@ def call( return response.choices[0].message.content or ( "Etwas ist schiefgelaufen. Bitte versuche es erneut." ) + +def _get_response_format(schema, schema_name: Optional[str] = None) -> Dict[str, Any]: + response_format = { + "type": "json_schema", + "json_schema": { + "name": schema_name or "response", + "strict": True, + "schema": schema, + }, + } + return response_format From 7c68a5cd7166a25e432b9f1c05254b4eb1ac19e2 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 29 Jun 2026 22:26:45 +0200 Subject: [PATCH 14/92] Replace topic chips in publication overview with shared topic chips --- .../person-publications.component.html | 24 ++++++++++--- .../person-publications.component.scss | 19 ++++------ .../person-publications.component.ts | 36 ++++++++++++++++++- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index 6da7971d..52dacc28 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -126,8 +126,13 @@ } @for (topic of selectedTopics; track topic.id) { - - {{ topic.display_name }} + + +
@for (topic of publication.topics ?? []; track topic.id) { - - {{ topic.display_name }} - + + } @for (keyword of publication.keywords ?? []; track keyword.id) { {{ keyword.display_name }} diff --git a/webapp/src/app/modules/publication-detail/publication-detail.component.scss b/webapp/src/app/modules/publication-detail/publication-detail.component.scss index ae20315b..a5238714 100644 --- a/webapp/src/app/modules/publication-detail/publication-detail.component.scss +++ b/webapp/src/app/modules/publication-detail/publication-detail.component.scss @@ -268,12 +268,6 @@ aside { font-size: 11px; } -.tags .topic-tag { - border-color: #cbd8f1; - background: #f5f8ff; - color: var(--sg-text); -} - .source-list, .compact-list, .link-list { diff --git a/webapp/src/app/modules/publication-detail/publication-detail.component.ts b/webapp/src/app/modules/publication-detail/publication-detail.component.ts index c2850656..4c2e0ce9 100644 --- a/webapp/src/app/modules/publication-detail/publication-detail.component.ts +++ b/webapp/src/app/modules/publication-detail/publication-detail.component.ts @@ -13,7 +13,10 @@ import { Location as ApiLocation, Work, WorksService, + WorkTopic, } from '../../api'; +import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; +import { topicHierarchyColor } from '../../shared/utils/topic-colors'; interface DetailLink { label: string; @@ -36,6 +39,7 @@ interface InstitutionDetail { MatIconModule, MatProgressSpinnerModule, RouterLink, + TopicChipComponent, UpperCasePipe, ], templateUrl: './publication-detail.component.html', @@ -71,6 +75,17 @@ export class PublicationDetailComponent implements OnInit { this.location.back(); } + getTopicColor(topic: WorkTopic): string { + return topicHierarchyColor({ + id: topic.id, + name: topic.display_name, + field_id: topic.field?.id, + field_name: topic.field?.display_name, + domain_id: topic.domain?.id, + domain_name: topic.domain?.display_name, + }); + } + abstractText(): string | null { const index = this.publication?.abstract_inverted_index; if (!index || typeof index !== 'object') return null; From c259635bdfaf57685493583f48aa53cf2039d0ba Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 23:06:02 +0200 Subject: [PATCH 17/92] added loading state to keywords extraction part --- .../keywords-search.component.html | 246 ++++++++++-------- .../keywords-search.component.ts | 22 ++ 2 files changed, 160 insertions(+), 108 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index a25c9961..8980ac6c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -1,8 +1,4 @@
-

Keywords Scout

- - - troubleshoot - @if (isExtracting()) { - Extrahiere... - } @else { - Keywords extrahieren + @switch (loadingState()) { + @case ('extracting-url') { + URL wird abgerufen... + } + @case ('extracting-text') { + Text wird analysiert... + } + @default { + Keywords extrahieren + } } } @@ -77,11 +79,11 @@ - @if (sourceContent().length > 0 && extractionSource() === 'url') { + @if (sourceContent().length > 0) { Extrahierte Inhalte: {{ sourceUrl() }}Verarbeitete Inhalte: {{ sourceUrl() }}
{{ sourceContent() }}
@@ -90,110 +92,138 @@ } -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

- - @for (keyword of broadKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

- - @for (keyword of coarseKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

- - @for (keyword of fineKeywords(); track keyword) { - {{ keyword }} - } - -
- } -
+ @if (!isExtracting()) { +
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
- -
- - @if (areAllExtractedSelected()) { + +
+ + @if (areAllExtractedSelected()) { + + } @else { + + } + + - } @else { - +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um + sie hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ } @else { + + @switch (loadingState()) { + @case ('extracting-url') { + } - - - -
- } @else { -

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie - hier zu sehen oder füge sie manuell hinzu. -

- } -
- + @case ('extracting-text') { + + } + @default { + + } + } + + } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 6b3c5f67..3e144b4c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -14,6 +14,8 @@ import { debounceTime, distinctUntilChanged } from 'rxjs'; import { KeywordsService } from '../../api/api/keywords.service'; import { KeywordsRequest } from '../../api/model/keywordsRequest'; import { MatExpansionModule } from '@angular/material/expansion'; +import { DestroyRef } from '@angular/core'; +import { LoadingComponent } from '../../shared/ui/loading/loading.component'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -29,6 +31,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatDividerModule, MatCardModule, MatExpansionModule, + LoadingComponent, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -77,11 +80,20 @@ export class KeywordsSearchComponent { private isRestoringState = false; + readonly loadingState = computed(() => { + if (!this.isExtracting()) return 'idle' as const; + + const mode = this.form.controls.selectedInputType.value; + if (mode === 'url') return 'extracting-url' as const; + if (mode === 'text') return 'extracting-text' as const; + return 'extracting-keywords' as const; + }); constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, private readonly keywordsService: KeywordsService, + private readonly destroyRef: DestroyRef, ) { this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { this.restoreStateFromQueryParams(); @@ -104,6 +116,15 @@ export class KeywordsSearchComponent { .subscribe(() => { this.updateQueryParams(); }); + + // Clear session storage on component destroy + this.destroyRef.onDestroy(() => { + const nav = this.router.lastSuccessfulNavigation; + const isReload = nav === null; + if (!isReload) { + this.clearSourceFromSession(); + } + }); } selectedTabIndex(): number { @@ -232,6 +253,7 @@ export class KeywordsSearchComponent { } extractKeywords(): void { + this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; From 495c7d34e5c4d0b2498c26d039b6ead0f1f5cf85 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 29 Jun 2026 23:40:05 +0200 Subject: [PATCH 18/92] timeline legend across full width --- .../research-timeline.component.html | 10 ++++----- .../research-timeline.component.scss | 21 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index a478142c..2d2a289e 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -63,6 +63,10 @@
Zeitraum + + {{ selectedStartYear }} bis {{ selectedEndYear }} + +
-
- {{ selectedStartYear }} - bis - {{ selectedEndYear }} -
-
Date: Mon, 29 Jun 2026 23:52:26 +0200 Subject: [PATCH 19/92] Publication overview filter design updated --- .../research-timeline.component.scss | 3 - .../person-publications.component.html | 68 +++++----- .../person-publications.component.scss | 117 ++++++++++++------ .../person-publications.component.ts | 4 - 4 files changed, 122 insertions(+), 70 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss index 67d79f6a..98072adf 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss @@ -73,9 +73,6 @@ grid-row: 2; min-width: 0; - // Standard-Cap (760px) aufheben, damit die Fachgebiete die volle - // Breite nutzen und weniger Zeilen umbrechen; eigener Abstand der - // Legende entfällt, da der Grid-Row-Gap bereits Platz schafft ::ng-deep .topic-legend { width: 100%; margin-top: 0; diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index 52dacc28..274b4eb3 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -113,34 +113,46 @@ @if (selectedInstitutions.length || selectedTopics.length) { -
- @for (institution of selectedInstitutions; track institution.id) { - - {{ institution.display_name }} - - - } - @for (topic of selectedTopics; track topic.id) { - - - - - - } +
+ Aktive Filter: +
+ @for (topic of selectedTopics; track topic.id) { + + Thema: + + + + + } + @for (institution of selectedInstitutions; track institution.id) { + + Institution: {{ institution.display_name }} + + + } +
}
diff --git a/webapp/src/app/modules/person-publications/person-publications.component.scss b/webapp/src/app/modules/person-publications/person-publications.component.scss index ead85589..67adb843 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.scss +++ b/webapp/src/app/modules/person-publications/person-publications.component.scss @@ -48,7 +48,10 @@ h2 { .publication-filters .institution-filter, .publication-filters .topic-filter { - width: 320px; + flex: 1 1 200px; + width: auto; + min-width: 180px; + max-width: 320px; } .publication-filters .reset-filter-btn { @@ -115,52 +118,97 @@ h2 { line-height: 1.2; } -.selected-filter-chips { +.active-filters-row { display: flex; + align-items: center; flex-wrap: wrap; - justify-content: flex-end; - gap: 6px; - max-width: 900px; - margin: 0; + gap: 10px; + padding: 8px 16px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); + font-size: 13px; } -.selected-filter-chip { +.active-filters-label { + font-weight: 600; + color: var(--sg-text-muted); +} + +.chips-container { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 6px; +} + +.filter-chip, +.active-topic-filter { display: inline-flex; align-items: center; - max-width: 320px; - min-height: 26px; - padding: 3px 4px 3px 9px; - border: 1px solid #d9e2f0; - border-radius: var(--sg-radius-sm); - background: #fff; +} + +.filter-chip { + gap: 4px; + padding: 2px 8px; + border: 1px solid var(--sg-border-strong); + border-radius: 12px; + background: var(--sg-surface-soft); color: var(--sg-text); font-size: 11px; - line-height: 1.2; + font-weight: 600; } -.selected-filter-chip--topic { - padding: 0; - border: 0; - background: transparent; +.active-topic-filter { + gap: 5px; + max-width: 100%; + padding: 2px 6px 2px 8px; + border: 1px solid var(--sg-border-strong); + border-radius: 12px; + background: var(--sg-surface-soft); } -.selected-filter-chip button { - display: inline-grid; - place-items: center; - width: 20px; - height: 20px; - margin-left: 3px; - padding: 0; - border: 0; - background: transparent; +.active-topic-filter__prefix { + flex: 0 0 auto; color: var(--sg-text-muted); - cursor: pointer; + font-size: 11px; + font-weight: 700; } -.selected-filter-chip mat-icon { - width: 14px; - height: 14px; - font-size: 14px; +app-topic-chip.active-filter-topic-chip { + max-width: min(320px, 48vw); +} + +::ng-deep app-topic-chip.active-filter-topic-chip .topic-chip__button { + min-height: 22px; + padding: 2px 6px; +} + +::ng-deep app-topic-chip.active-filter-topic-chip .topic-chip__label { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.filter-chip button, +.active-topic-filter button { + display: flex; + padding: 0; + border: 0; + background: transparent; + color: var(--sg-text-soft); + cursor: pointer; + + &:hover { + color: var(--sg-text); + } +} + +.filter-chip button mat-icon, +.active-topic-filter button mat-icon { + width: 12px; + height: 12px; + font-size: 12px; } .table-wrap { @@ -335,8 +383,7 @@ mat-paginator { width: 100%; } - .selected-filter-chips { - justify-content: flex-start; - max-width: none; + .active-filters-row { + align-self: stretch; } } diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index e55918ff..32f3f250 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -324,8 +324,6 @@ export class PersonPublicationsComponent implements OnInit { const topic = event.option.value as TopicAutocompleteOption; if (!topic.id) return; if (!this.selectedTopics.some((item) => item.id === topic.id)) { - // Das Autocomplete liefert die Hierarchie nur im hint ("Feld · Subfeld - // · Domain"); für die Chip-Farbe das Fachgebiet daraus ableiten. const enrichedTopic: TopicAutocompleteOption = { ...topic, field_name: topic.field_name ?? this.fieldNameFromHint(topic.hint), @@ -555,8 +553,6 @@ export class PersonPublicationsComponent implements OnInit { const topicNames = this.selectedTopics .map((topic) => topic.display_name) .filter((name): name is string => !!name); - // Index-aligned mit topicIds, damit die Hierarchie-Farbe nach einem - // Reload erhalten bleibt (leerer String = keine Angabe). const topicFields = this.selectedTopics.map( (topic) => topic.field_name ?? '', ); From 5d13b07c73fa13cf4c4fa0b020a347c2a2ecf1f6 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Tue, 30 Jun 2026 00:09:37 +0200 Subject: [PATCH 20/92] Add field-based color indicators to person search cards filtering --- .../topic-hierarchy/topic-hierarchy.component.html | 9 ++++++++- .../topic-hierarchy/topic-hierarchy.component.scss | 12 ++++++++++++ .../topic-hierarchy/topic-hierarchy.component.ts | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.html b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.html index 330b076f..3df414de 100644 --- a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.html +++ b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.html @@ -67,6 +67,10 @@ matTooltipPosition="above" (focusin)="tooltip.show()" (focusout)="tooltip.hide()"> + {{ topic.name }} {{ @@ -112,7 +116,10 @@ : 'chevron_right' }} - folder + {{ field.name }} diff --git a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.scss b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.scss index abfa99bc..c42fbac7 100644 --- a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.scss +++ b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.scss @@ -93,6 +93,18 @@ flex-direction: column; } +.field-dot { + flex: 0 0 auto; + display: inline-block; + vertical-align: middle; + width: 9px; + height: 9px; + margin-right: 7px; + border-radius: 50%; + border: 1px solid rgba(255, 255, 255, 0.85); + box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2); +} + .node-header { display: flex; align-items: center; diff --git a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.ts b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.ts index eb7af86a..1877b3c0 100644 --- a/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.ts +++ b/webapp/src/app/modules/topic-hierarchy/topic-hierarchy.component.ts @@ -6,6 +6,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatRadioModule } from '@angular/material/radio'; import { MatTooltipModule } from '@angular/material/tooltip'; import { TopicsService } from '../../api/api/topics.service'; +import { topicHierarchyColor } from '../../shared/utils/topic-colors'; import { combineLatest, of } from 'rxjs'; import { toObservable } from '@angular/core/rxjs-interop'; import { @@ -39,6 +40,7 @@ interface FlatTopic { id: string; name: string; path: string; + fieldName: string; } @Component({ @@ -120,6 +122,7 @@ export class TopicHierarchyComponent implements OnInit { name: topic.display_name || '', path: parts.length > 0 ? parts.join(' > ') : topic.description || '', + fieldName: topic.field?.display_name || '', }; }); } @@ -151,6 +154,7 @@ export class TopicHierarchyComponent implements OnInit { id: topic.id, name: topic.name, path: `${domain.name} > ${field.name} > ${subfield.name}`, + fieldName: field.name, }); } }); @@ -164,6 +168,10 @@ export class TopicHierarchyComponent implements OnInit { this.searchType.set(type); } + getFieldColor(fieldName: string | null | undefined): string { + return topicHierarchyColor({ field_name: fieldName }); + } + toggleTopic(name: string): void { const nextSelection = new Set(this.selectedTopics()); if (nextSelection.has(name)) { From dbaabeb9a5fb4ce9b40e53f49667be63be34a7f5 Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 30 Jun 2026 10:55:16 +0200 Subject: [PATCH 21/92] minor ui adjustments --- .../keywords-search.component.html | 67 +++++++++---------- .../keywords-search.component.scss | 4 +- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 8980ac6c..8f4e5e51 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -78,19 +78,39 @@
- - @if (sourceContent().length > 0) { - - - Verarbeitete Inhalte: {{ sourceUrl() }} - -
{{ sourceContent() }}
-
- - } + +
+ Eigene Keywords + @if (manualKeywords().length > 0) { + + @for (keyword of manualKeywords(); track keyword) { + {{ keyword }} + } + + } @else { +

Keine manuell hinzugefügten Keywords.

+ } +
+ + @if (sourceContent().length > 0) { + + + + Quellentext: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ } + @if (!isExtracting()) {
@@ -224,29 +244,6 @@ } } - - - -
- Eigene Keywords - @if (manualKeywords().length > 0) { - - @for (keyword of manualKeywords(); track keyword) { - {{ keyword }} - } - - } @else { -

Keine manuell hinzugefügten Keywords.

- } -
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index 90da7cab..8545aeca 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -197,7 +197,7 @@ border-radius: 4px; border-left: 4px solid var(--sg-primary, #1976d2); - ::ng-deep .mat-expansion-panel-header { + .mat-expansion-panel-header { padding: 0.5rem 0.75rem; height: auto; min-height: 36px; @@ -225,7 +225,7 @@ ::ng-deep .mat-expansion-panel-body { padding: 0 0.75rem 0.75rem 0.75rem; - max-height: 120px; // scrollable if content is long + max-height: 350px; // scrollable if content is long overflow-y: auto; white-space: pre-wrap; // preserve line breaks word-break: break-word; From 3702b216a057de1a1a1d1b4517491e4eda15247e Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 30 Jun 2026 10:55:29 +0200 Subject: [PATCH 22/92] increased llm response timeout up to 60s --- service/src/main/inse/integrations/llm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index f46e261f..a7cc1f41 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -8,7 +8,7 @@ def call( model: str = None, json_schema = None, schema_name = None, - timeout: int = 30, + timeout: int = 60, temperature: float = 1.0, top_p: float = 0.95, ) -> str: From 67d5306c6ed33fdd097f5968174ff03e1d53fa1b Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 04:19:34 +0200 Subject: [PATCH 23/92] added websocket and partial json parser packages to docker build --- service/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/service/Dockerfile b/service/Dockerfile index e0f3a8fb..415b3208 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -12,9 +12,11 @@ RUN pip install --root-user-action=ignore --no-cache-dir --disable-pip-version-c "uvicorn~=0.29.0" \ "pytest~=8.1.0" \ "httpx~=0.27.0" \ - "python-multipart~=0.0.19"\ + "python-multipart~=0.0.19" \ "beautifulsoup4==4.12.3" \ - "openai~=2.41.0" + "openai~=2.41.0" \ + "websockets==12.0" \ + "partial-json-parser==0.2.1.1.post7" COPY [ "src/main", "/home" ] COPY [ "src/data", "/data" ] From 050c68ea5e3d1f6812a35c129290eec1ceb553eb Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:17:36 +0200 Subject: [PATCH 24/92] added function for streaming mode to llm wrapper --- service/src/main/inse/integrations/llm.py | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index a7cc1f41..3d2dc536 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -1,4 +1,5 @@ from openai import OpenAI, APIConnectionError +from openai import AsyncOpenAI from .. import config from typing import Optional, Dict, Any @@ -54,3 +55,62 @@ def _get_response_format(schema, schema_name: Optional[str] = None) -> Dict[str, }, } return response_format + + + + +async def call_stream( + system_prompt: str, + user_prompt: str, + emit, # EventCallback + model: str = None, + json_schema=None, + schema_name=None, + timeout: int = 60, + temperature: float = 1.0, + top_p: float = 0.95, +) -> str: + if model is None: + model = config.settings.llm_model + + response_format = None + if json_schema is not None: + response_format = _get_response_format(schema=json_schema, schema_name=schema_name) + + client = AsyncOpenAI( + base_url=config.settings.llm_api_url, + api_key=config.settings.llm_api_key, + timeout=timeout, + ) + + full_content = "" + try: + stream = await client.chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": user_prompt}, + ], + temperature=temperature, + top_p=top_p, + extra_body={"top_k": 64}, + response_format=response_format, + stream=True, + ) + + async for chunk in stream: + delta = chunk.choices[0].delta.content + if delta: + full_content += delta + await emit({"type": "llm_chunk", "content": delta}) + + except APIConnectionError as e: + print(f"Connection error: {e}") + return "" + except Exception as e: + import traceback + print(f"LLM streaming failed: {type(e).__name__}: {e}") + traceback.print_exc() + return "" + + return full_content \ No newline at end of file From 249fb080e9b9286c63cab2a08d2fd15e992d8dbc Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:42:51 +0200 Subject: [PATCH 25/92] added keywords extraction endpoint + logic as stream via websockets --- service/src/main/inse/keywords/logic.py | 156 +++++++++++++++++- service/src/main/inse/keywords/model.py | 10 ++ service/src/main/inse/keywords/service.py | 50 +++++- .../patents/test_elastic_search_client.py | 124 +++++++------- 4 files changed, 269 insertions(+), 71 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index 7daabdbc..81286797 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -3,17 +3,21 @@ """ Business logic for persons / authors. """ - +import asyncio +from typing import Any, Dict, List +import partial_json_parser import json import logging import time import httpx from bs4 import BeautifulSoup - +from pydantic import ValidationError +from typing import Awaitable, Callable from inse.keywords.prompts import KeywordsPrompt from inse.integrations import llm -from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse +from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse, KeywordEntry, KeywordsWsEvent logger = logging.getLogger(__name__) +EventCallback = Callable[[dict], Awaitable[None]] def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: """ @@ -65,21 +69,157 @@ def _get_text_content(url: str) -> str: "Chrome/91.0.4472.124 Safari/537.36" ) } - # Using a synchronous client (no 'async' needed) - with httpx.Client(timeout=10.0) as client: + with httpx.Client(timeout=30.0) as client: response = client.get(url, headers=headers) response.raise_for_status() - + soup = BeautifulSoup(response.text, "html.parser") for element in soup(["script", "style"]): element.decompose() - text = soup.get_text(separator=" ", strip=True) text = " ".join(text.split()) + print(f"Extracted text from {url}: {text[:200]}...") # Print the first 200 characters of the extracted text return text except httpx.HTTPError as e: logger.error(f"HTTP error for {url}: {e}") except Exception as e: logger.error(f"Error processing {url}: {e}") - return "" \ No newline at end of file + + +async def extract_keywords_stream( + query: str, + mode: str, + limit: int, + emit: EventCallback, +) -> ExtractedKeywordsResponse: + start_time = time.time() + timeout_seconds = 60 # configurable + await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + + if mode == "url": + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + text = _get_text_content(query) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + else: + text = query + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + + user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" + if limit: + user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" + user_prompt += f"\nInput:\n{text}" + + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + + LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") + + # Holds only fully validated KeywordEntry dicts for each level + confirmed: Dict[str, List[Dict[str, Any]]] = {level: [] for level in LEVELS} + + async def emit_full_results() -> None: + """Attempt to build and validate the full ExtractedKeywords model and emit it.""" + # Build a dict with all three fields, using empty lists for missing ones + data = {level: confirmed.get(level, []) for level in LEVELS} + try: + validated = ExtractedKeywords.model_validate(data) + except ValidationError: + # Should not happen if all items are valid, but guard against it + return + await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump()) + + # adds completed keyword chunks to the confirmed dict and emits the full results when new valid items are found + async def on_chunk(event: Dict[str, Any]) -> None: + if event["type"] != "llm_chunk": + await emit(event) + return + + try: + partial = partial_json_parser.loads(event.get("_full_content", "")) + except Exception: + return + + if not isinstance(partial, dict): + return + + grew = False + + for level in LEVELS: + current = partial.get(level) or [] + idx = len(confirmed[level]) + + while idx < len(current): + raw_item = current[idx] + try: + validated_item = KeywordEntry.model_validate(raw_item) + except ValidationError: + break # item not complete yet + + confirmed[level].append(validated_item.model_dump()) + idx += 1 + grew = True + + if grew: + await emit_full_results() + + # Accumulate full_content for incremental parsing + full_content_holder = {"value": ""} + + async def emit_wrapper(event: Dict[str, Any]) -> None: + if event["type"] == "llm_chunk": + full_content_holder["value"] += event["content"] + event = {**event, "_full_content": full_content_holder["value"]} + await on_chunk(event) + + try: + keywords = await asyncio.wait_for( + llm.call_stream( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema=ExtractedKeywords.model_json_schema(), + schema_name="extracted_keywords", + temperature=0.8, + top_p=0.95, + emit=emit_wrapper, + ), + timeout=timeout_seconds, + ) + except asyncio.TimeoutError: + await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump()) + raise RuntimeError("LLM streaming call timed out") + except asyncio.CancelledError: + await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump()) + raise + + if not keywords: + await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump()) + raise RuntimeError("LLM streaming call returned empty content") + + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + + try: + keywords_json = json.loads(keywords) + except json.JSONDecodeError as e: + await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump()) + raise RuntimeError("LLM response is not valid JSON") + + # Final emission of the full results (in case the last chunk didn't trigger it) + final_data = {level: confirmed.get(level, []) for level in LEVELS} + try: + final_validated = ExtractedKeywords.model_validate(keywords_json) + except ValidationError: + # Fallback: use our confirmed data + final_validated = ExtractedKeywords.model_validate(final_data) + + elapsed_time = time.time() - start_time + result = ExtractedKeywordsResponse( + results=final_validated, + source=mode, + source_url=query if mode == "url" else None, + source_content=text, + duration=elapsed_time, + ) + + return result \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py index 5683001d..3e86a01d 100644 --- a/service/src/main/inse/keywords/model.py +++ b/service/src/main/inse/keywords/model.py @@ -26,4 +26,14 @@ class ExtractedKeywordsResponse(BaseModel): source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") source_content: str = Field(description="The actual content from which keywords were extracted.") + duration: float | None = Field(default=None, description="The time taken to extract keywords, in seconds.") +class KeywordsWsEvent(BaseModel): + type: str + step: str | None = None + message: str | None = None + result: ExtractedKeywordsResponse | None = None + keywords: ExtractedKeywords | None = None + duration: float | None = None + completed: str | None = None + \ No newline at end of file diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py index 0eddc579..bac0eaba 100644 --- a/service/src/main/inse/keywords/service.py +++ b/service/src/main/inse/keywords/service.py @@ -5,7 +5,7 @@ REST API for persons / authors. """ from typing import Annotated -from fastapi import Body +from fastapi import Body, WebSocket, WebSocketDisconnect from fastapi import APIRouter from . import logic from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest @@ -17,6 +17,54 @@ router = APIRouter( responses={404: {"description": "Not found"}}, ) +@router.websocket("/keywords/extract/ws") +async def extract_keywords_ws(websocket: WebSocket): + print("WebSocket connection established for keyword extraction.") + await websocket.accept() + try: + raw = await websocket.receive_json() + request = KeywordsRequest(**raw) + + async def emit(event: dict): + await websocket.send_json(event) + + result = await logic.extract_keywords_stream( + query=request.query, + mode=request.mode, + limit=request.limit, + emit=emit, + ) + + await websocket.send_json({"type": "completed", "result": result.model_dump()}) + + except WebSocketDisconnect: + print("WebSocket disconnected.?") + pass + except Exception as e: + await websocket.send_json({"type": "error", "message": str(e)}) + finally: + await websocket.close() + +# @router.post( +# "/keywords/extract", +# operation_id="extractKeywords", +# response_model=ExtractedKeywordsResponse, +# ) +# async def extract_keywords( +# request: Annotated[ +# KeywordsRequest, +# Body(description="Input text for keyword extraction"), +# ], +# ): +# async def noop(_: dict): +# pass + +# return await logic.extract_keywords_stream( +# query=request.query, +# mode=request.mode, +# limit=request.limit, +# emit=noop, +# ) @router.post( "/keywords/extract", diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index f383c03d..ae0622b0 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -1,85 +1,85 @@ -import json +# import json -import httpx -import pytest -from inse.model import ESIndex -from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient -from inse.patents.elastic_search_client import ( - DEFAULT_SEARCH_SIZE, - PatentSearchClient, -) +# import httpx +# import pytest +# from inse.model import ESIndex +# from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient +# from inse.patents.elastic_search_client import ( +# DEFAULT_SEARCH_SIZE, +# PatentSearchClient, +# ) -@pytest.fixture -def anyio_backend(): - return "asyncio" +# @pytest.fixture +# def anyio_backend(): +# return "asyncio" -def test_epo_query_uses_nested_search_and_name_variants(): - client = PatentSearchClient(api_key="test-key") - payload = client.epo_query_by_inventor("Müller", "Christian") +# def test_epo_query_uses_nested_search_and_name_variants(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.epo_query_by_inventor("Müller", "Christian") - assert payload["size"] == DEFAULT_SEARCH_SIZE - assert payload["sort"][0] == {"_score": {"order": "desc"}} - nested = payload["query"]["nested"] - assert nested["path"] == "inventors_name_nested" - must = nested["query"]["bool"]["must"] - assert len(must) == 2 - assert "should" in must[0]["bool"] +# assert payload["size"] == DEFAULT_SEARCH_SIZE +# assert payload["sort"][0] == {"_score": {"order": "desc"}} +# nested = payload["query"]["nested"] +# assert nested["path"] == "inventors_name_nested" +# must = nested["query"]["bool"]["must"] +# assert len(must) == 2 +# assert "should" in must[0]["bool"] -def test_uspto_index_is_3_0(): - assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" - assert ESIndex.EPO_INDEX == "epo_index_1.0" +# def test_uspto_index_is_3_0(): +# assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" +# assert ESIndex.EPO_INDEX == "epo_index_1.0" -def test_epo_query_by_applicant_uses_applicants_name_field(): - client = PatentSearchClient(api_key="test-key") - payload = client.epo_query_by_applicant( - ["University of Duisburg-Essen", "Universität Duisburg-Essen"] - ) +# def test_epo_query_by_applicant_uses_applicants_name_field(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.epo_query_by_applicant( +# ["University of Duisburg-Essen", "Universität Duisburg-Essen"] +# ) - assert payload["size"] == DEFAULT_SEARCH_SIZE - assert "applicants_name" in str(payload["query"]) - assert payload["query"]["bool"]["minimum_should_match"] == 1 +# assert payload["size"] == DEFAULT_SEARCH_SIZE +# assert "applicants_name" in str(payload["query"]) +# assert payload["query"]["bool"]["minimum_should_match"] == 1 -def test_uspto_query_by_assignee_uses_assignees_orgs_field(): - client = PatentSearchClient(api_key="test-key") - payload = client.uspto_query_by_assignee(["Harvard University"]) +# def test_uspto_query_by_assignee_uses_assignees_orgs_field(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.uspto_query_by_assignee(["Harvard University"]) - assert "assignees_orgs" in str(payload["query"]) +# assert "assignees_orgs" in str(payload["query"]) -def test_detail_and_title_queries_skip_empty_date_filters(): - client = AllPatentsSearchClient(api_key="test-key") +# def test_detail_and_title_queries_skip_empty_date_filters(): +# client = AllPatentsSearchClient(api_key="test-key") - epo_payload = client.epo_title_query("method for generating and using a map") - uspto_payload = client.uspto_detail_query("US12508845") +# epo_payload = client.epo_title_query("method for generating and using a map") +# uspto_payload = client.uspto_detail_query("US12508845") - assert "must" not in epo_payload["query"]["bool"] - assert "must" not in uspto_payload["query"]["bool"] +# assert "must" not in epo_payload["query"]["bool"] +# assert "must" not in uspto_payload["query"]["bool"] -@pytest.mark.anyio -async def test_search_epo_posts_to_correct_index(): - captured: list[dict] = [] +# @pytest.mark.anyio +# async def test_search_epo_posts_to_correct_index(): +# captured: list[dict] = [] - def handler(request: httpx.Request) -> httpx.Response: - path_parts = request.url.path.strip("/").split("/") - captured.append( - { - "index": path_parts[-2], - "body": json.loads(request.content) if request.content else {}, - } - ) - return httpx.Response(200, json={"hits": {"hits": []}}) +# def handler(request: httpx.Request) -> httpx.Response: +# path_parts = request.url.path.strip("/").split("/") +# captured.append( +# { +# "index": path_parts[-2], +# "body": json.loads(request.content) if request.content else {}, +# } +# ) +# return httpx.Response(200, json={"hits": {"hits": []}}) - client = PatentSearchClient( - api_key="test-key", - transport=httpx.MockTransport(handler), - ) - await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) +# client = PatentSearchClient( +# api_key="test-key", +# transport=httpx.MockTransport(handler), +# ) +# await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) - assert len(captured) == 1 - assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file +# assert len(captured) == 1 +# assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file From e5599845baa5fd4979afef09e274c696547cf62a Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:43:22 +0200 Subject: [PATCH 26/92] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 4 + webapp/src/app/api/api/keywords.service.ts | 207 +-- webapp/src/app/api/api/news.service.ts | 1536 ++++++----------- webapp/src/app/api/api/patents.service.ts | 792 ++++----- webapp/src/app/api/api/topics.service.ts | 1150 ++++-------- webapp/src/app/api/model/extractedKeywords.ts | 4 - .../api/model/extractedKeywordsResponse.ts | 1 + webapp/src/app/api/model/funderByAuthor.ts | 22 +- webapp/src/app/api/model/models.ts | 11 +- webapp/src/app/api/model/neteccontribution.ts | 14 - webapp/src/app/api/model/newsArticle.ts | 21 +- webapp/src/app/api/model/newsArticleDetail.ts | 27 +- webapp/src/app/api/model/orgPatentEntry.ts | 47 +- .../src/app/api/model/orgPatentsResponse.ts | 15 +- webapp/src/app/api/model/patentEntry.ts | 59 +- 15 files changed, 1496 insertions(+), 2414 deletions(-) delete mode 100644 webapp/src/app/api/model/neteccontribution.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 37921947..58a3760e 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -125,6 +125,7 @@ model/keywordsRequest.ts model/latitude.ts model/location.ts model/longitude.ts +model/matchedAuthor.ts model/matchedOfficer.ts model/mentionedPerson.ts model/meta.ts @@ -134,8 +135,11 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts +model/orgPatentEntry.ts +model/orgPatentsResponse.ts model/patentEntry.ts model/patentsByAuthorResponse.ts +model/patentsByInstitutionResponse.ts model/personBio.ts model/projectType.ts model/projectsFilteringProperties.ts diff --git a/webapp/src/app/api/api/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts index 172d077c..20afc021 100644 --- a/webapp/src/app/api/api/keywords.service.ts +++ b/webapp/src/app/api/api/keywords.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; @@ -30,133 +24,84 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { KeywordsRequest } from '../model/keywordsRequest'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class KeywordsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Extracts keywords from text. - * @endpoint post /api/inse-service/keywords/extract - * @param keywordsRequest - * @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 extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (keywordsRequest === null || keywordsRequest === undefined) { - throw new Error( - 'Required parameter keywordsRequest was null or undefined when calling extractKeywords.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Extracts keywords from text. + * @endpoint post /api/inse-service/keywords/extract + * @param keywordsRequest + * @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 extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public extractKeywords(keywordsRequest: KeywordsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (keywordsRequest === null || keywordsRequest === undefined) { + throw new Error('Required parameter keywordsRequest was null or undefined when calling extractKeywords.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/keywords/extract`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/keywords/extract`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: keywordsRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/news.service.ts b/webapp/src/app/api/api/news.service.ts index de08c0d1..8ff477cf 100644 --- a/webapp/src/app/api/api/news.service.ts +++ b/webapp/src/app/api/api/news.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -30,1031 +24,567 @@ import { NewsArticleDetail } from '../model/newsArticleDetail'; import { NewsPage } from '../model/newsPage'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class NewsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns news articles in which the given person is mentioned. - * @endpoint get /api/news/by-author - * @param authorId OpenAlex author id, e.g. A5034365278. - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @param query Optional search term, matched against title/author. - * @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 getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getNewsByAuthor.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'authorId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); + /** + * Returns news articles in which the given person is mentioned. + * @endpoint get /api/news/by-author + * @param authorId OpenAlex author id, e.g. A5034365278. + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param query Optional search term, matched against title/author. + * @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 getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getNewsByAuthor.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'authorId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/by-author`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns news articles in which the given person is mentioned. + * @endpoint get /api/news/by-author + * @param authorId OpenAlex author id, e.g. A5034365278. + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param query Optional search term, matched against title/author. + * @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 getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getNewsByAuthor_1.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'authorId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/by-author`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/news/by-author`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns a single news article including its full content. + * @endpoint get /api/news/{news_id} + * @param newsId The unique id of the news article (Elasticsearch _id). + * @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 getNewsById(newsId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsById(newsId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById(newsId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById(newsId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (newsId === null || newsId === undefined) { + throw new Error('Required parameter newsId was null or undefined when calling getNewsById.'); + } - /** - * Returns news articles in which the given person is mentioned. - * @endpoint get /api/news/by-author - * @param authorId OpenAlex author id, e.g. A5034365278. - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @param query Optional search term, matched against title/author. - * @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 getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getNewsByAuthor_1.', - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/${this.configuration.encodeParam({name: "newsId", value: newsId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'authorId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); + /** + * Returns a single news article including its full content. + * @endpoint get /api/news/{news_id} + * @param newsId The unique id of the news article (Elasticsearch _id). + * @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 getNewsById_2(newsId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsById_2(newsId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById_2(newsId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById_2(newsId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (newsId === null || newsId === undefined) { + throw new Error('Required parameter newsId was null or undefined when calling getNewsById_2.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/${this.configuration.encodeParam({name: "newsId", value: newsId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a page of news articles, newest first. + * @endpoint get /api/news + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/news/by-author`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns a page of news articles, newest first. + * @endpoint get /api/news + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns a single news article including its full content. - * @endpoint get /api/news/{news_id} - * @param newsId The unique id of the news article (Elasticsearch _id). - * @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 getNewsById( - newsId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsById( - newsId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById( - newsId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById( - newsId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (newsId === null || newsId === undefined) { - throw new Error( - 'Required parameter newsId was null or undefined when calling getNewsById.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Searches news articles by full text (full_content). + * @endpoint get /api/news/search + * @param query Search term, matched against the full text (full_content). + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling searchNews.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches news articles by full text (full_content). + * @endpoint get /api/news/search + * @param query Search term, matched against the full text (full_content). + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling searchNews_4.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/news/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/news/${this.configuration.encodeParam({ name: 'newsId', value: newsId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns a single news article including its full content. - * @endpoint get /api/news/{news_id} - * @param newsId The unique id of the news article (Elasticsearch _id). - * @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 getNewsById_2( - newsId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsById_2( - newsId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById_2( - newsId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById_2( - newsId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (newsId === null || newsId === undefined) { - throw new Error( - 'Required parameter newsId was null or undefined when calling getNewsById_2.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/news/${this.configuration.encodeParam({ name: 'newsId', value: newsId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns a page of news articles, newest first. - * @endpoint get /api/news - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @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 listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/news`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns a page of news articles, newest first. - * @endpoint get /api/news - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @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 listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/news`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches news articles by full text (full_content). - * @endpoint get /api/news/search - * @param query Search term, matched against the full text (full_content). - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @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 searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling searchNews.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/news/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches news articles by full text (full_content). - * @endpoint get /api/news/search - * @param query Search term, matched against the full text (full_content). - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @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 searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling searchNews_4.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/news/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index a0eb3f9f..a09f106e 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -1,419 +1,373 @@ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpContext, -} from '@angular/common/http'; -import { Observable } from 'rxjs'; -import { BASE_PATH } from '../variables'; -import { Configuration } from '../configuration'; -import { BaseService } from '../api.base.service'; -import { PatentEntry } from '../model/patentEntry'; -import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; -import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; -import { - OrgPatentsResponse, - OrgPatentMatchTypeFilter, -} from '../model/orgPatentsResponse'; - -export interface AllPatentsResponse { - total: number; - page: number; - size: number; - patents: PatentEntry[]; -} - -type GetPatentsByAuthorOptions = { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -type GetPatentsByInstitutionOptions = { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -type GetOrgPatentsByInstitutionOptions = { - matchType?: OrgPatentMatchTypeFilter; - page?: number; - size?: number; - source?: 'EPO' | 'USPTO'; - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -@Injectable({ - providedIn: 'root', -}) -export class PatentsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - - public getPatentsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable; - public getPatentsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetPatentsByAuthorOptions, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPatentsByAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam( - { - name: 'authorId', - value: authorId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getPatentsByInstitution( - institutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable; - public getPatentsByInstitution( - institutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable>; - public getPatentsByInstitution( - institutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable>; - public getPatentsByInstitution( - institutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetPatentsByInstitutionOptions, - ): Observable { - if (institutionId === null || institutionId === undefined) { - throw new Error( - 'Required parameter institutionId was null or undefined when calling getPatentsByInstitution.', - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( - { - name: 'institutionId', - value: institutionId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable; - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable>; - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable>; - public getOrgPatentsByInstitution( - institutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable { - if (institutionId === null || institutionId === undefined) { - throw new Error( - 'Required parameter institutionId was null or undefined when calling getOrgPatentsByInstitution.', - ); - } - - let localVarQueryParameters = new HttpParams(); - if (options?.matchType) { - localVarQueryParameters = localVarQueryParameters.set( - 'match_type', - options.matchType, - ); - } - if (options?.page !== undefined) { - localVarQueryParameters = localVarQueryParameters.set( - 'page', - String(options.page), - ); - } - if (options?.size !== undefined) { - localVarQueryParameters = localVarQueryParameters.set( - 'size', - String(options.size), - ); - } - if (options?.source) { - localVarQueryParameters = localVarQueryParameters.set( - 'source', - options.source, - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( - { - name: 'institutionId', - value: institutionId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/org-patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getAllPatents( - page: number = 0, - size: number = 10, - search?: string, - source?: string, - sortBy: string = 'date', - sortDirection: string = 'desc', - yearFrom?: number, - yearTo?: number, - ): Observable { - let params = new HttpParams() - .set('page', String(page)) - .set('size', String(size)) - .set('sort_by', sortBy) - .set('sort_direction', sortDirection); - - if (search) params = params.set('search', search); - if (source) params = params.set('source', source); - if (yearFrom !== undefined) - params = params.set('year_from', String(yearFrom)); - if (yearTo !== undefined) params = params.set('year_to', String(yearTo)); - - const localVarHeaders = this.defaultHeaders; - const { basePath, withCredentials } = this.configuration; - - return this.httpClient.get( - `${basePath}/api/inse-service/patents`, - { - params, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - }, - ); - } - - public getPatentById( - patentId: string, - title?: string, - prefix?: string, - fillingDate?: string, - ): Observable { - const localVarHeaders = this.defaultHeaders; - const { basePath, withCredentials } = this.configuration; - let params = new HttpParams(); - if (title) params = params.set('title', title); - if (prefix) params = params.set('prefix', prefix); - if (fillingDate) params = params.set('filling_date', fillingDate); - const localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam( - { - name: 'patentId', - value: patentId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}`; - - return this.httpClient.get(`${basePath}${localVarPath}`, { - params, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - }); - } -} +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { AllPatentsResponse } from '../model/allPatentsResponse'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { OrgPatentsResponse } from '../model/orgPatentsResponse'; +// @ts-ignore +import { PatentEntry } from '../model/patentEntry'; +// @ts-ignore +import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; +// @ts-ignore +import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class PatentsService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get all patents with pagination and search. + * @endpoint get /api/inse-service/patents + * @param page + * @param size + * @param search + * @param source + * @param sortBy + * @param sortDirection + * @param yearFrom + * @param yearTo + * @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 getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'year_from'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'year_to'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get pre-indexed org patents for an institution. + * @endpoint get /api/inse-service/institutions/{id}/org-patents + * @param id + * @param matchType Filter patents by match type. + * @param page + * @param size + * @param source + * @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 getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getOrgPatentsByInstitution.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + matchType, 'match_type'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/org-patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single patent by its identifier. + * @endpoint get /api/inse-service/patents/{patent_id} + * @param patentId + * @param title + * @param prefix + * @param fillingDate + * @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 getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (patentId === null || patentId === undefined) { + throw new Error('Required parameter patentId was null or undefined when calling getPatentById.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + prefix, 'prefix'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fillingDate, 'filling_date'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam({name: "patentId", value: patentId, 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get patents matched to an author by name. + * @endpoint get /api/inse-service/authors/{author_id}/patents + * @param authorId + * @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 getPatentsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPatentsByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get patents matched to an institution by assignee name. + * @endpoint get /api/inse-service/institutions/{id}/patents + * @param id + * @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 getPatentsByInstitution(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByInstitution(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPatentsByInstitution.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 2b90f737..6f17a01e 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -30,803 +24,413 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { TopicsListResponse } from '../model/topicsListResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class TopicsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns topic options for autocomplete inputs. - * @endpoint get /api/topics/autocomplete - * @param query Topic search text, for example \'machine learning\'. - * @param domainId Optional OpenAlex domain id filter. - * @param fieldId Optional OpenAlex field id filter. - * @param subfieldId Optional OpenAlex subfield id filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling autocompleteTopics.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - domainId, - 'domainId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - fieldId, - 'fieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - subfieldId, - 'subfieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); + /** + * Returns topic options for autocomplete inputs. + * @endpoint get /api/topics/autocomplete + * @param query Topic search text, for example \'machine learning\'. + * @param domainId Optional OpenAlex domain id filter. + * @param fieldId Optional OpenAlex field id filter. + * @param subfieldId Optional OpenAlex subfield id filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + domainId, 'domainId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fieldId, 'fieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + subfieldId, 'subfieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + let localVarHeaders = this.defaultHeaders; - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarPath = `/api/topics/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @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 buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - saveJson, - 'save_json', - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @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 countTopicHierarchy( - topic: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public countTopicHierarchy( - topic: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topic === null || topic === undefined) { - throw new Error( - 'Required parameter topic was null or undefined when calling countTopicHierarchy.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + let localVarPath = `/api/topics/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * Builds the topic hierarchy cache. + * @endpoint get /api/inse-service/topics/cache + * @param pageSize Page size for each search page. + * @param saveJson Persist cache JSON to data folder. + * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + saveJson, 'save_json'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/hierarchy`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a list of OpenAlex topics. + * @endpoint get /api/topics + * @param search Full-text search, for example \'machine learning\'. + * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'domain.id\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filter, 'filter'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + groupBy, 'group_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + perPage, 'per_page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + cursor, 'cursor'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sample, 'sample'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + select, 'select'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/hierarchy`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Semantic / vector search for topics using a keyword/sentence. + * @endpoint get /api/topics/vector-search + * @param query Word or sentence to search by similarity. + * @param limit Maximum number of topics to return. + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling vectorSearchTopics.'); + } - /** - * Returns a list of OpenAlex topics. - * @endpoint get /api/topics - * @param search Full-text search, for example \'machine learning\'. - * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'domain.id\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filter, - 'filter', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sort, - 'sort', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - groupBy, - 'group_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - perPage, - 'per_page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - cursor, - 'cursor', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sample, - 'sample', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - select, - 'select', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + searchType, 'searchType'); - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics/vector-search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Semantic / vector search for topics using a keyword/sentence. - * @endpoint get /api/topics/vector-search - * @param query Word or sentence to search by similarity. - * @param limit Maximum number of topics to return. - * @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 vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling vectorSearchTopics.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - if (searchType !== undefined && searchType !== null) { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - searchType, - 'searchType', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics/vector-search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts index 29e27a45..81a2bc3c 100644 --- a/webapp/src/app/api/model/extractedKeywords.ts +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -23,9 +23,5 @@ export interface ExtractedKeywords { * The extracted fine-grained keywords from text. */ fine_grained: Array; - /** - * The source of the extracted keywords, e.g., \'text\', \'url\' - */ - source: string; } diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts index fb156a70..65a4087b 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -24,5 +24,6 @@ export interface ExtractedKeywordsResponse { * The actual content from which keywords were extracted. */ source_content: string; + duration?: number | null; } diff --git a/webapp/src/app/api/model/funderByAuthor.ts b/webapp/src/app/api/model/funderByAuthor.ts index c62110e7..247e5629 100644 --- a/webapp/src/app/api/model/funderByAuthor.ts +++ b/webapp/src/app/api/model/funderByAuthor.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,13 +11,15 @@ import { PublicationIdsByAuthorPosition } from './publicationIdsByAuthorPosition import { AuthorPositionCount } from './authorPositionCount'; import { PublicationDetailByFunder } from './publicationDetailByFunder'; -export interface FunderByAuthor { - funder_id?: string | null; - funder_name?: string | null; - publication_count: number; - author_position_count: AuthorPositionCount; - publication_ids: PublicationIdsByAuthorPosition; - publication_urls?: { [key: string]: string }; - publication_titles?: { [key: string]: string }; - publication_details?: { [key: string]: PublicationDetailByFunder }; + +export interface FunderByAuthor { + funder_id?: string | null; + funder_name?: string | null; + publication_count: number; + author_position_count: AuthorPositionCount; + publication_ids: PublicationIdsByAuthorPosition; + publication_urls?: { [key: string]: string; }; + publication_titles?: { [key: string]: string; }; + publication_details?: { [key: string]: PublicationDetailByFunder; }; } + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index a210c254..6e223359 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -1,4 +1,5 @@ export * from './accessGrant'; +export * from './allPatentsResponse'; export * from './authAccount'; export * from './authScope'; export * from './author'; @@ -41,6 +42,9 @@ export * from './dfgProjectSummary'; export * from './euCordisProjectResponse'; export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; +export * from './euProjectData'; +export * from './extractedKeywords'; +export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; export * from './fp7EurosciVoc'; @@ -87,27 +91,30 @@ export * from './institutionInformation'; export * from './institutionNetworkNode'; export * from './institutionPage'; export * from './institutionsListResponse'; +export * from './ipcClassification'; export * from './item'; export * from './itemCreate'; export * from './itemPage'; +export * from './keywordEntry'; export * from './keywords'; +export * from './keywordsRequest'; export * from './latitude'; export * from './location'; export * from './longitude'; +export * from './matchedAuthor'; export * from './matchedOfficer'; export * from './mentionedPerson'; export * from './meta'; export * from './model2YrMeanCitedness'; -export * from './neteccontribution'; export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; -export * from './matchedAuthor'; export * from './orgPatentEntry'; export * from './orgPatentsResponse'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; +export * from './patentsByInstitutionResponse'; export * from './personBio'; export * from './projectType'; export * from './projectsFilteringProperties'; diff --git a/webapp/src/app/api/model/neteccontribution.ts b/webapp/src/app/api/model/neteccontribution.ts deleted file mode 100644 index 925189cf..00000000 --- a/webapp/src/app/api/model/neteccontribution.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface Neteccontribution { -} - diff --git a/webapp/src/app/api/model/newsArticle.ts b/webapp/src/app/api/model/newsArticle.ts index 3701eb25..ab48810d 100644 --- a/webapp/src/app/api/model/newsArticle.ts +++ b/webapp/src/app/api/model/newsArticle.ts @@ -1,19 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface NewsArticle { - id: string; - date?: string | null; - maintitle?: string | null; - author?: string | null; - url?: string | null; - relevant?: boolean | null; - snippet?: string | null; + +export interface NewsArticle { + id: string; + date?: string | null; + maintitle?: string | null; + author?: string | null; + url?: string | null; + relevant?: boolean | null; + snippet?: string | null; + related?: boolean | null; } + diff --git a/webapp/src/app/api/model/newsArticleDetail.ts b/webapp/src/app/api/model/newsArticleDetail.ts index ed8903d0..0240903f 100644 --- a/webapp/src/app/api/model/newsArticleDetail.ts +++ b/webapp/src/app/api/model/newsArticleDetail.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,14 +9,19 @@ */ import { MentionedPerson } from './mentionedPerson'; -export interface NewsArticleDetail { - id: string; - date?: string | null; - maintitle?: string | null; - author?: string | null; - url?: string | null; - relevant?: boolean | null; - snippet?: string | null; - full_content?: string | null; - authors?: Array; + +export interface NewsArticleDetail { + id: string; + date?: string | null; + maintitle?: string | null; + author?: string | null; + url?: string | null; + relevant?: boolean | null; + snippet?: string | null; + related?: boolean | null; + full_content?: string | null; + authors?: Array; + topics?: Array; + keywords?: Array; } + diff --git a/webapp/src/app/api/model/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts index 50cfcef8..7c4d0ce0 100644 --- a/webapp/src/app/api/model/orgPatentEntry.ts +++ b/webapp/src/app/api/model/orgPatentEntry.ts @@ -1,11 +1,46 @@ -import { PatentEntry } from './patentEntry'; +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { MatchedAuthor } from './matchedAuthor'; +import { IpcClassification } from './ipcClassification'; -export type OrgPatentMatchType = 'institution' | 'name' | 'both'; - -export interface OrgPatentEntry extends PatentEntry { +export interface OrgPatentEntry { + patent_id: string; + source: string; + title?: string | null; + abstract?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; institution_id: string; institution_name?: string | null; - match_type: OrgPatentMatchType; - matched_authors: MatchedAuthor[]; + match_type: OrgPatentEntry.MatchTypeEnum; + matched_authors?: Array; +} +export namespace OrgPatentEntry { + export const MatchTypeEnum = { + Institution: 'institution', + Name: 'name', + Both: 'both', + } as const; + export type MatchTypeEnum = + (typeof MatchTypeEnum)[keyof typeof MatchTypeEnum]; } diff --git a/webapp/src/app/api/model/orgPatentsResponse.ts b/webapp/src/app/api/model/orgPatentsResponse.ts index eb884506..68b2be7a 100644 --- a/webapp/src/app/api/model/orgPatentsResponse.ts +++ b/webapp/src/app/api/model/orgPatentsResponse.ts @@ -1,12 +1,19 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { OrgPatentEntry } from './orgPatentEntry'; -export type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; - export interface OrgPatentsResponse { institution_id: string; institution_name?: string | null; patent_count: number; - page: number; - size: number; + page?: number; + size?: number; patents: Array; } diff --git a/webapp/src/app/api/model/patentEntry.ts b/webapp/src/app/api/model/patentEntry.ts index 96c3842d..5565ab9a 100644 --- a/webapp/src/app/api/model/patentEntry.ts +++ b/webapp/src/app/api/model/patentEntry.ts @@ -1,31 +1,34 @@ -export interface IpcClassification { - symbol: string; - section: string | null; - class: string | null; - subclass: string | null; - main_group: string | null; - subgroup: string | null; -} +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { IpcClassification } from './ipcClassification'; -export interface PatentEntry { - patent_id: string; - source: string; - title: string | null; - abstract: string | null; - publication_date: string | null; - publication_year: string | null; - application_number: string | null; - application_date: string | null; - kind: string | null; - application_type: string | null; - number_of_claims: number | null; - status: string | null; - inventors: string[]; - assignees: string[]; - ipc: string[]; - ipc_descriptions: IpcClassification[]; - cpc: string[]; - cpc_descriptions: IpcClassification[]; - country: string | null; + +export interface PatentEntry { + patent_id: string; + source: string; + title?: string | null; + 'abstract'?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; } From b499fd287765b570d54c2c9839d3a9f65406a9a0 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:44:31 +0200 Subject: [PATCH 27/92] fixed merging issues for compatibility --- .../institution-patents.component.html | 107 ++++++++++++++---- .../institution-patents.component.ts | 39 ++++--- .../patent-detail.component.html | 53 +++++---- .../patent-detail/patent-detail.utils.ts | 28 +++-- 4 files changed, 160 insertions(+), 67 deletions(-) diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index bdc81c3a..a68cbaea 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -3,10 +3,15 @@ } @else if (error) {

Fehler beim Laden der Patente.

} @else if (patents.length === 0) { -

Keine Patente in org_patents für diese Institution gefunden.

+

+ Keine Patente in org_patents für diese Institution gefunden. +

Der Index muss zuerst befüllt werden: - python service/scripts/index_org_patents.py --institution-id {{ institutionId }} + python service/scripts/index_org_patents.py --institution-id + {{ institutionId }}

} @else {
@@ -15,7 +20,9 @@
}
@@ -105,7 +138,10 @@
Quelle - + {{ selectedPatent.source }} @@ -116,11 +152,17 @@
Datum - {{ formatDate(selectedPatent.publication_date) }} + @if (selectedPatent.publication_date) { + {{ + formatDate(selectedPatent.publication_date) + }} + }
Match-Typ - {{ getMatchTypeLabel(selectedPatent) }} + {{ + getMatchTypeLabel(selectedPatent) + }}
@if (getPublicationStageLabel(selectedPatent); as stageLabel) {
@@ -130,13 +172,18 @@ }
- @if (selectedPatent.matched_authors.length) { + @if (selectedPatent.matched_authors?.length) {
} - @if (getAbstractPreview(selectedPatent.abstract); as abstractPreview) { + @if ( + getAbstractPreview(selectedPatent.abstract); + as abstractPreview + ) {

{{ abstractPreview }}

} -

@@ -173,7 +228,9 @@ Patente

- {{ getInstitutionMatchCount() }} + {{ + getInstitutionMatchCount() + }} Institution
@@ -185,7 +242,9 @@ Beides
-

Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.

+

+ Wähle links ein Patent aus, um Kurzinfos und Details zu sehen. +

} diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts index 8dd4be9e..3b90b1b5 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { PatentsService } from '../../api/api/patents.service'; import { OrgPatentEntry } from '../../api/model/orgPatentEntry'; -import { OrgPatentMatchTypeFilter } from '../../api/model/orgPatentsResponse'; import { formatPatentDate, getPublicationStageLabel, @@ -11,6 +10,7 @@ import { type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; +type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; @Component({ selector: 'app-institution-patents', @@ -46,7 +46,8 @@ export class InstitutionPatentsComponent implements OnInit { const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); - const matchTypeFromUrl = this.route.snapshot.queryParamMap.get('matchType'); + const matchTypeFromUrl = + this.route.snapshot.queryParamMap.get('matchType'); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; @@ -115,8 +116,10 @@ export class InstitutionPatentsComponent implements OnInit { } private reloadPatents(): void { - const institutionId = this.institutionId ?? - this.route.parent?.snapshot.paramMap.get('institutionId') ?? ''; + const institutionId = + this.institutionId ?? + this.route.parent?.snapshot.paramMap.get('institutionId') ?? + ''; if (institutionId) { this.loadPatents(institutionId); } @@ -127,12 +130,13 @@ export class InstitutionPatentsComponent implements OnInit { this.error = false; this.patentsApi - .getOrgPatentsByInstitution(institutionId, 'body', false, { - matchType: this.activeMatchType, - page: this.selectedPage - 1, - size: this.pageSize, - source: this.activeFilter !== 'all' ? this.activeFilter : undefined, - }) + .getOrgPatentsByInstitution( + institutionId, + this.activeMatchType, + this.selectedPage - 1, + this.pageSize, + this.activeFilter !== 'all' ? this.activeFilter : undefined, + ) .subscribe({ next: (result) => { this.patents = result.patents ?? []; @@ -152,7 +156,9 @@ export class InstitutionPatentsComponent implements OnInit { private sortPatents(patents: OrgPatentEntry[]): OrgPatentEntry[] { if (this.sortMode === 'title') { return [...patents].sort((a, b) => - (a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' }), + (a.title ?? '').localeCompare(b.title ?? '', 'de', { + sensitivity: 'base', + }), ); } return [...patents]; @@ -180,8 +186,15 @@ export class InstitutionPatentsComponent implements OnInit { return value === 'date' || value === 'title'; } - private isValidMatchType(value: string | null): value is OrgPatentMatchTypeFilter { - return value === 'all' || value === 'institution' || value === 'name' || value === 'both'; + private isValidMatchType( + value: string | null, + ): value is OrgPatentMatchTypeFilter { + return ( + value === 'all' || + value === 'institution' || + value === 'name' || + value === 'both' + ); } formatDate(date: string | null): string { diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.html b/webapp/src/app/modules/patent-detail/patent-detail.component.html index ff86b654..ba19750e 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.html +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.html @@ -24,7 +24,10 @@
- + {{ patent.source }} @if (patent.publication_year) { @@ -36,9 +39,8 @@

{{ patent.title || patent.patent_id || 'Ohne Titel' }}

- {{ patent.patent_id }} - @if (patent.publication_date) { - · {{ formatDate(patent.publication_date) }} + @if (patent.publication_date; as date) { + · {{ formatDate(date) }} }

@@ -60,17 +62,19 @@
groups - {{ patent.inventors.length }} + {{ patent.inventors && patent.inventors.length }} Erfinder
business - {{ patent.assignees.length }} + {{ patent.assignees && patent.assignees.length }} Anmelder
category - {{ patent.ipc.length + patent.cpc.length }} + {{ + (patent.ipc?.length ?? 0) + (patent.cpc?.length ?? 0) + }} Klassifikationen
@@ -92,7 +96,7 @@
engineering

Erfinder

- {{ patent.inventors.length }} + {{ patent.inventors && patent.inventors.length }}
@for (inventor of patent.inventors; track inventor) { @@ -103,7 +107,7 @@
- @if (patent.assignees.length > 0) { + @if (patent.assignees && patent.assignees.length > 0) {
account_balance @@ -120,8 +124,9 @@
} - @if (patent.ipc_descriptions.length > 0) { -
+ @if (patent.ipc_descriptions && patent.ipc_descriptions.length > 0) { +
label

Klassifikation (IPC)

@@ -139,10 +144,12 @@ }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -182,7 +189,7 @@ }
- } @else if (patent.ipc.length > 0) { + } @else if (patent.ipc && patent.ipc.length > 0) {
label @@ -196,8 +203,9 @@
} - @if (patent.cpc_descriptions.length > 0) { -
+ @if (patent.cpc_descriptions && patent.cpc_descriptions.length > 0) { +
label

Klassifikation (CPC)

@@ -215,10 +223,12 @@ }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -258,7 +268,7 @@ }
- } @else if (patent.cpc.length > 0) { + } @else if (patent.cpc && patent.cpc.length > 0) {
label @@ -285,7 +295,10 @@
{{ row.label }}
@if (row.variant === 'source') { - + {{ row.value }} } @else { diff --git a/webapp/src/app/modules/patent-detail/patent-detail.utils.ts b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts index f98338a5..e45957d9 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.utils.ts +++ b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts @@ -1,5 +1,5 @@ -import { IpcClassification, PatentEntry } from '../../api/model/patentEntry'; - +import { PatentEntry } from '../../api/model/patentEntry'; +import { IpcClassification } from '../../api/model/ipcClassification'; export type ClassificationSystem = 'IPC' | 'CPC'; export interface ClassificationCard { @@ -38,7 +38,9 @@ export function getPublicationStageLabel(patent: PatentEntry): string | null { return patent.kind ?? patent.application_type ?? null; } -export function getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { +export function getPatentMetadataRows( + patent: PatentEntry, +): PatentMetadataRow[] { const rows: PatentMetadataRow[] = [ { label: 'Quelle', value: patent.source, variant: 'source' }, { label: 'Patent-Nr.', value: patent.patent_id }, @@ -118,7 +120,9 @@ export function getDescriptionPreview(text: string | null): string { return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; } -export function patentExternalLinks(patent: PatentEntry): { label: string; url: string }[] { +export function patentExternalLinks( + patent: PatentEntry, +): { label: string; url: string }[] { const links: { label: string; url: string }[] = []; const encodedId = encodeURIComponent(patent.patent_id); @@ -177,21 +181,25 @@ function buildHierarchyRows( const value = extractDescriptionText(raw); if (!value) return; const normalized = value.toLocaleLowerCase('en'); - if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { + if ( + seen.has(normalized) || + normalized === primaryDescription?.toLocaleLowerCase('en') + ) { return; } seen.add(normalized); rows.push({ label, value }); }; - - addRow('Sektion', entry.section); - addRow('Klasse', entry.class); - addRow('Unterklasse', entry.subclass); + if (entry.section) addRow('Sektion', entry.section); + if (entry.class) addRow('Klasse', entry.class); + if (entry.subclass) addRow('Unterklasse', entry.subclass); return rows; } -function extractDescriptionText(value: string | null | undefined): string | null { +function extractDescriptionText( + value: string | null | undefined, +): string | null { if (!value?.trim()) return null; const text = value.includes(' - ') From 2ec904756522a935f95de370ff97a4ff166cc67e Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:45:31 +0200 Subject: [PATCH 28/92] added websocket implementation to frontend --- .../keywords-search.component.html | 246 ++++++++---------- .../keywords-search.component.scss | 17 ++ .../keywords-search.component.ts | 208 ++++++++++----- 3 files changed, 272 insertions(+), 199 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 8f4e5e51..02aab57c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -59,17 +59,7 @@ (click)="extractKeywords()" [disabled]="isExtracting()"> troubleshoot - @switch (loadingState()) { - @case ('extracting-url') { - URL wird abgerufen... - } - @case ('extracting-text') { - Text wird analysiert... - } - @default { - Keywords extrahieren - } - } + Keywords extrahieren }
@@ -112,137 +102,121 @@ } - @if (!isExtracting()) { -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

- - @for (keyword of broadKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

- - @for (keyword of coarseKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

- - @for (keyword of fineKeywords(); track keyword) { - {{ keyword }} - } - -
- } -
+
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
- -
- - @if (areAllExtractedSelected()) { - - } @else { - - } - - + +
+ + @if (areAllExtractedSelected()) { -
- } @else { -

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um - sie hier zu sehen oder füge sie manuell hinzu. -

- } + } @else { + + } + + + +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie + hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ + @if (isExtracting()) { +
+ + +
{{ statusMessage() }}
- } @else { - - @switch (loadingState()) { - @case ('extracting-url') { - - } - @case ('extracting-text') { - - } - @default { - - } - } - } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index 8545aeca..daf9bb39 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -242,3 +242,20 @@ background: rgba(0, 0, 0, 0.03); } } +.progress-container { + margin-top: 1rem; + padding: 0.5rem 0; + + mat-progress-bar { + height: 8px; + border-radius: 4px; + } + + .status-message { + margin-top: 0.5rem; + font-size: 0.9rem; + color: var(--sg-text-secondary); + text-align: center; + font-weight: 500; + } +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 3e144b4c..0af2ae1d 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -11,11 +11,16 @@ import { MatInputModule } from '@angular/material/input'; import { MatTabsModule } from '@angular/material/tabs'; import { ActivatedRoute, Router } from '@angular/router'; import { debounceTime, distinctUntilChanged } from 'rxjs'; -import { KeywordsService } from '../../api/api/keywords.service'; import { KeywordsRequest } from '../../api/model/keywordsRequest'; import { MatExpansionModule } from '@angular/material/expansion'; +import { ExtractedKeywords } from '../../api/model/extractedKeywords'; +import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; import { DestroyRef } from '@angular/core'; -import { LoadingComponent } from '../../shared/ui/loading/loading.component'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { + KeywordWebSocketService, + WsEvent, +} from '../../shared/services/websocket.service'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -31,7 +36,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatDividerModule, MatCardModule, MatExpansionModule, - LoadingComponent, + MatProgressBarModule, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -80,22 +85,17 @@ export class KeywordsSearchComponent { private isRestoringState = false; - readonly loadingState = computed(() => { - if (!this.isExtracting()) return 'idle' as const; - - const mode = this.form.controls.selectedInputType.value; - if (mode === 'url') return 'extracting-url' as const; - if (mode === 'text') return 'extracting-text' as const; - return 'extracting-keywords' as const; - }); + readonly progress = signal(0); + readonly statusMessage = signal(''); constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, - private readonly keywordsService: KeywordsService, private readonly destroyRef: DestroyRef, + private readonly websocketService: KeywordWebSocketService, ) { - this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { + console.log('Component received event:', event); this.restoreStateFromQueryParams(); }); @@ -117,6 +117,64 @@ export class KeywordsSearchComponent { this.updateQueryParams(); }); + //get streamed data + this.websocketService.getMessages().subscribe((event: WsEvent) => { + switch (event.type) { + case 'status': + console.log('STATUS:', event.step, event.message); + this.statusMessage.set(event.message || ''); + this.progress.set(this.getProgressForStep(event.step || '')); + break; + case 'keywords': + console.log('KEYWORDS:', event.keywords); + if (event.keywords) this.addExtractedKeyword(event.keywords); + break; + + // case 'result': + // console.log('RESULT:', event.result); + // this.processExtractedKeywords( + // event.result as ExtractedKeywordsResponse, + // ); + // this.isExtracting.set(false); + // break; + case 'completed': + console.log('COMPLETED:', event.result); + this.processExtractedKeywords( + event.result as ExtractedKeywordsResponse, + ); + this.isExtracting.set(false); + this.progress.set(100); + this.statusMessage.set('Fertig!'); + this.websocketService.close(); + this.isExtracting.set(false); + break; + + case 'error': + console.error('ERROR:', event.message); + this.progress.set(0); + this.statusMessage.set('Fehler: ' + event.message); + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + this.websocketService.close(); + this.isExtracting.set(false); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => + this.manualKeywords().includes(k), + ), + ); + // extractionSource stays as it was (or reset? we keep it) + this.updateQueryParams(); + break; + default: + console.warn('Unknown event type:', event); + } + this.destroyRef.onDestroy(() => { + this.websocketService.close(); + }); + }); + // Clear session storage on component destroy this.destroyRef.onDestroy(() => { const nav = this.router.lastSuccessfulNavigation; @@ -251,12 +309,62 @@ export class KeywordsSearchComponent { isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + addExtractedKeyword(keywords: ExtractedKeywords): void { + const broad = this.extractKeywordStrings(keywords.broad_keywords); + const coarse = this.extractKeywordStrings(keywords.coarse_grained); + const fine = this.extractKeywordStrings(keywords.fine_grained); - extractKeywords(): void { + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + } + processExtractedKeywords(result: ExtractedKeywordsResponse): void { + if (result === undefined) { + return; + } + console.log('Processing extracted keywords:', result); + const { results, source, source_content, source_url } = result; + + const broad = this.extractKeywordStrings(results.broad_keywords); + const coarse = this.extractKeywordStrings(results.coarse_grained); + const fine = this.extractKeywordStrings(results.fine_grained); + + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.sourceContent.set(source_content); + this.extractionSource.set(source as InputMode); + this.sourceUrl.set(source_url ?? ''); + this.saveSourceToSession(); + + console.log('Extracted keywords:', { + broad, + coarse, + fine, + manual: this.manualKeywords(), + }); + // Keep only selected keywords that still exist in any category (including manual) + const allExtracted = [ + ...broad, + ...coarse, + ...fine, + ...this.manualKeywords(), + ]; + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => allExtracted.includes(k)), + ); + + this.updateQueryParams(); + } + async extractKeywords(): Promise { this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; + // Reset progress and status + this.progress.set(0); + this.statusMessage.set('Starte Extraktion...'); + const currentMode = this.form.controls.selectedInputType.value; const keywordsRequest: KeywordsRequest = { query: query, @@ -265,56 +373,15 @@ export class KeywordsSearchComponent { }; this.isExtracting.set(true); - this.keywordsService.extractKeywords(keywordsRequest).subscribe({ - next: ({ results, source, source_content, source_url }) => { - const broad = this.extractKeywordStrings(results.broad_keywords); - const coarse = this.extractKeywordStrings(results.coarse_grained); - const fine = this.extractKeywordStrings(results.fine_grained); - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); - this.sourceContent.set(source_content); - this.extractionSource.set(source as InputMode); - this.sourceUrl.set(source_url ?? ''); - this.saveSourceToSession(); - - console.log('Extracted keywords:', { - broad, - coarse, - fine, - manual: this.manualKeywords(), - }); - // Keep only selected keywords that still exist in any category (including manual) - const allExtracted = [ - ...broad, - ...coarse, - ...fine, - ...this.manualKeywords(), - ]; - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => allExtracted.includes(k)), - ); - - this.updateQueryParams(); - }, - error: () => { - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); - // Keep manual, but remove selected that are not in manual - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => - this.manualKeywords().includes(k), - ), - ); - // extractionSource stays as it was (or reset? we keep it) - this.updateQueryParams(); - }, - complete: () => { - this.isExtracting.set(false); - }, - }); + try { + // sendRequest now waits internally for the connection to open + await this.websocketService.sendRequest(keywordsRequest); + } catch (error) { + console.error('WebSocket send error:', error); + this.isExtracting.set(false); + this.statusMessage.set('Fehler beim Senden der Anfrage'); + } } search(): void { @@ -390,6 +457,7 @@ export class KeywordsSearchComponent { sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), }; + console.log(data); sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); } @@ -446,4 +514,18 @@ export class KeywordsSearchComponent { const normalized = value.trim(); return normalized.length ? normalized : null; } + private getProgressForStep(step: string): number { + switch (step) { + case 'started': + return 10; + case 'fetching_url': + return 30; + case 'content_extracted': + return 60; + case 'calling_llm': + return 80; + default: + return 50; // fallback for unknown steps + } + } } From cfac12e2189c512d8b64bd6c20fc3ec3ea73a9ad Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:45:45 +0200 Subject: [PATCH 29/92] another merging issue fixed --- .../src/app/modules/patents/patents.component.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 3e3a64c6..13cdfed9 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -116,7 +116,9 @@ @@ -138,9 +140,9 @@ + [length]="total" + [pageSize]="pageSize" + [pageIndex]="page" + [pageSizeOptions]="[10, 25, 50]" + (page)="handlePageChange($event)" />
From 1fa755769bc274a73602f2aa7732ed426468b3cb Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:48:09 +0200 Subject: [PATCH 30/92] added websocket interface for streamed keywords extraction --- .../keywords-search.component.ts | 5 +- .../keywords-websocket.service.ts | 117 ++++++++++++++++++ 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 webapp/src/app/modules/keywords-search/keywords-websocket.service.ts diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 0af2ae1d..1b7d6979 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -17,10 +17,7 @@ import { ExtractedKeywords } from '../../api/model/extractedKeywords'; import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { - KeywordWebSocketService, - WsEvent, -} from '../../shared/services/websocket.service'; +import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ diff --git a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts new file mode 100644 index 00000000..b1989c5c --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts @@ -0,0 +1,117 @@ +// keyword-websocket.service.ts + +import { Injectable, Inject, Optional } from '@angular/core'; +import { webSocket, WebSocketSubject } from 'rxjs/webSocket'; +import { Observable, Subject, Subscription } from 'rxjs'; +import { KeywordsRequest } from '../../api/model/keywordsRequest'; +import { Configuration } from '../../api/configuration'; +import { BaseService } from '../../api/api.base.service'; +import { BASE_PATH } from '../../api/variables'; +import { ExtractedKeywords } from '../../api/model/extractedKeywords'; +import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; + +export interface WsEvent { + type: string; + step?: string | null; + message?: string | null; + result?: ExtractedKeywordsResponse; + content?: string | null; + level?: string | null; + keywords?: ExtractedKeywords; + duration?: number | null; +} + +@Injectable({ providedIn: 'root' }) +export class KeywordWebSocketService extends BaseService { + private socket$?: WebSocketSubject; + private socketSubscription?: Subscription; + private readonly messageSubject$ = new Subject(); // created once, stays for app lifetime + private connectionPromise: Promise | null = null; + + constructor( + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + this.url = + `${this.configuration?.basePath ?? 'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( + /^http/, + 'ws', + ); + } + private readonly url: string; + + connect(): Promise { + if (this.socket$ && this.socket$.closed === false) { + return Promise.resolve(); + } + if (this.connectionPromise) { + return this.connectionPromise; + } + + this.closeSocket(); + + // no longer recreate messageSubject$ here + + this.connectionPromise = new Promise((resolve, reject) => { + this.socket$ = webSocket({ + url: this.url, + deserializer: (msg) => JSON.parse(msg.data), + serializer: (value) => JSON.stringify(value), + openObserver: { + next: () => resolve(), + }, + closeObserver: { + next: () => { + this.connectionPromise = null; + }, + }, + }); + + this.socketSubscription = this.socket$.subscribe({ + next: (event: WsEvent) => this.messageSubject$.next(event), + error: (err) => { + // don't error/complete the shared subject — just reject this connection attempt + console.error('WebSocket error', err); + reject(err); + this.connectionPromise = null; + }, + complete: () => { + this.connectionPromise = null; + }, + }); + }); + + return this.connectionPromise; + } + + async sendRequest(req: KeywordsRequest): Promise { + await this.connect(); + if (this.socket$) { + this.socket$.next(req); + } else { + throw new Error('WebSocket not available'); + } + } + + getMessages(): Observable { + return this.messageSubject$.asObservable(); + } + + close(): void { + this.closeSocket(); + // don't complete messageSubject$ — it must survive across connections + } + + private closeSocket(): void { + if (this.socketSubscription) { + this.socketSubscription.unsubscribe(); + this.socketSubscription = undefined; + } + if (this.socket$) { + this.socket$.complete(); + this.socket$ = undefined; + } + this.connectionPromise = null; + } +} From 9e5b2c1a21221cd8d05cea3ca657214001aa8ec6 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 11:46:21 +0200 Subject: [PATCH 31/92] services cleaned --- .../inse/patents/elastic_search_client.py | 9 +- service/src/main/inse/patents/logic.py | 4 +- .../patents/test_elastic_search_client.py | 107 +- webapp/src/app/api/README.md | 91 +- webapp/src/app/api/api/api.ts | 19 +- .../app/api/api/companyConnections.service.ts | 185 +- webapp/src/app/api/api/funding.service.ts | 366 +-- .../app/api/api/iNSEAccountService.service.ts | 657 ++--- webapp/src/app/api/api/iNSEService.service.ts | 1357 +++------ .../src/app/api/api/institutions.service.ts | 1045 +++---- webapp/src/app/api/api/items.service.ts | 903 ++---- .../src/app/api/api/personNetwork.service.ts | 215 +- webapp/src/app/api/api/persons.service.ts | 2576 ++++++----------- webapp/src/app/api/api/projects.service.ts | 1841 ++++-------- webapp/src/app/api/api/works.service.ts | 1033 +++---- webapp/src/app/api/configuration.ts | 368 ++- webapp/src/app/api/encoder.ts | 24 +- webapp/src/app/api/model/accessGrant.ts | 16 +- webapp/src/app/api/model/authAccount.ts | 16 +- webapp/src/app/api/model/authScope.ts | 14 +- webapp/src/app/api/model/author.ts | 40 +- .../app/api/model/authorAffiliationsInner.ts | 10 +- .../app/api/model/authorCountsByYearInner.ts | 12 +- webapp/src/app/api/model/authorIds.ts | 12 +- webapp/src/app/api/model/authorNetworkNode.ts | 34 +- .../app/api/model/authorParsedLongestName.ts | 16 +- .../src/app/api/model/authorPositionCount.ts | 14 +- .../src/app/api/model/authorSummaryStats.ts | 12 +- .../app/api/model/authorsFilterProperties.ts | 30 +- .../src/app/api/model/authorsListResponse.ts | 12 +- webapp/src/app/api/model/authorship.ts | 20 +- .../src/app/api/model/autocompleteResponse.ts | 10 +- .../app/api/model/autocompleteResponseMeta.ts | 10 +- .../model/autocompleteResponseResultsInner.ts | 20 +- webapp/src/app/api/model/award.ts | 18 +- webapp/src/app/api/model/bodyCreateUser.ts | 16 +- webapp/src/app/api/model/bundProject.ts | 62 +- .../src/app/api/model/bundProjectDetails.ts | 86 +- webapp/src/app/api/model/bundProjectPage.ts | 38 +- webapp/src/app/api/model/careerMetrics.ts | 46 +- .../src/app/api/model/collaborationNetwork.ts | 54 +- .../app/api/model/collaborationNetworkEdge.ts | 22 +- .../api/model/collaborationNetworkNodeType.ts | 13 +- webapp/src/app/api/model/companyConnection.ts | 30 +- .../api/model/companyConnectionsResponse.ts | 26 +- webapp/src/app/api/model/cordisEuProject.ts | 56 +- .../src/app/api/model/cordisEuProjectPage.ts | 38 +- webapp/src/app/api/model/costUsd.ts | 7 +- webapp/src/app/api/model/customAuthor.ts | 44 +- .../api/model/customAuthorsListResponse.ts | 14 +- webapp/src/app/api/model/dehydratedAuthor.ts | 12 +- webapp/src/app/api/model/dehydratedFunder.ts | 12 +- .../app/api/model/dehydratedInstitution.ts | 18 +- webapp/src/app/api/model/dehydratedSource.ts | 28 +- webapp/src/app/api/model/dfgProjectDetails.ts | 54 +- webapp/src/app/api/model/dfgProjectPage.ts | 38 +- webapp/src/app/api/model/dfgProjectSummary.ts | 32 +- .../api/model/euOrganizationProjectSummary.ts | 32 +- .../model/euOrganizationProjectSummaryPage.ts | 38 +- webapp/src/app/api/model/filterInformation.ts | 38 +- webapp/src/app/api/model/filterProperties.ts | 18 +- .../app/api/model/fundersByAuthorResponse.ts | 14 +- webapp/src/app/api/model/fundingProject.ts | 36 +- .../src/app/api/model/fundingProjectPage.ts | 38 +- webapp/src/app/api/model/fwci.ts | 7 +- webapp/src/app/api/model/groupByResult.ts | 12 +- .../src/app/api/model/hTTPValidationError.ts | 8 +- webapp/src/app/api/model/identityGrant.ts | 14 +- webapp/src/app/api/model/institution.ts | 46 +- .../app/api/model/institutionFunderSummary.ts | 34 +- webapp/src/app/api/model/institutionGeo.ts | 20 +- webapp/src/app/api/model/institutionIds.ts | 18 +- .../app/api/model/institutionInformation.ts | 22 +- .../app/api/model/institutionNetworkNode.ts | 34 +- webapp/src/app/api/model/institutionPage.ts | 38 +- .../app/api/model/institutionsListResponse.ts | 12 +- webapp/src/app/api/model/item.ts | 30 +- webapp/src/app/api/model/itemCreate.ts | 22 +- webapp/src/app/api/model/itemPage.ts | 38 +- webapp/src/app/api/model/keywords.ts | 7 +- webapp/src/app/api/model/latitude.ts | 7 +- webapp/src/app/api/model/location.ts | 24 +- webapp/src/app/api/model/longitude.ts | 7 +- webapp/src/app/api/model/matchedAuthor.ts | 18 +- webapp/src/app/api/model/matchedOfficer.ts | 24 +- webapp/src/app/api/model/mentionedPerson.ts | 12 +- webapp/src/app/api/model/meta.ts | 20 +- .../app/api/model/model2YrMeanCitedness.ts | 7 +- webapp/src/app/api/model/newsPage.ts | 14 +- webapp/src/app/api/model/openAccess.ts | 14 +- webapp/src/app/api/model/orgPatentEntry.ts | 66 +- .../src/app/api/model/orgPatentsResponse.ts | 18 +- .../app/api/model/patentsByAuthorResponse.ts | 14 +- .../api/model/patentsByInstitutionResponse.ts | 21 +- webapp/src/app/api/model/personBio.ts | 14 +- webapp/src/app/api/model/projectType.ts | 12 +- .../api/model/projectsFilteringProperties.ts | 54 +- webapp/src/app/api/model/projectsSortBy.ts | 15 +- .../api/model/publicationDetailByFunder.ts | 68 +- .../model/publicationIdsByAuthorPosition.ts | 14 +- .../api/model/publicationsByAuthorResponse.ts | 20 +- webapp/src/app/api/model/rankingResponse.ts | 10 +- webapp/src/app/api/model/score.ts | 7 +- webapp/src/app/api/model/sortDirection.ts | 10 +- webapp/src/app/api/model/topic.ts | 32 +- webapp/src/app/api/model/topicCount.ts | 44 +- webapp/src/app/api/model/topicDomain.ts | 10 +- webapp/src/app/api/model/topicField.ts | 10 +- webapp/src/app/api/model/topicIds.ts | 10 +- webapp/src/app/api/model/topicSubfield.ts | 10 +- webapp/src/app/api/model/topics.ts | 7 +- webapp/src/app/api/model/topicsByTime.ts | 46 +- webapp/src/app/api/model/topicsByYear.ts | 38 +- .../src/app/api/model/topicsListResponse.ts | 12 +- webapp/src/app/api/model/universityRanking.ts | 33 +- .../src/app/api/model/universityTopicData.ts | 27 +- webapp/src/app/api/model/user.ts | 64 +- webapp/src/app/api/model/validationError.ts | 12 +- .../app/api/model/validationErrorLocInner.ts | 7 +- webapp/src/app/api/model/value.ts | 7 +- webapp/src/app/api/model/work.ts | 82 +- webapp/src/app/api/model/workBiblio.ts | 14 +- .../model/workCitationNormalizedPercentile.ts | 12 +- .../api/model/workCitedByPercentileYear.ts | 10 +- .../app/api/model/workCountsByYearInner.ts | 10 +- webapp/src/app/api/model/workHasContent.ts | 10 +- webapp/src/app/api/model/workIds.ts | 16 +- webapp/src/app/api/model/workKeyword.ts | 12 +- webapp/src/app/api/model/workMeshInner.ts | 16 +- webapp/src/app/api/model/workNetworkNode.ts | 38 +- webapp/src/app/api/model/workPage.ts | 46 +- .../workSustainableDevelopmentGoalsInner.ts | 12 +- webapp/src/app/api/model/workTopic.ts | 18 +- webapp/src/app/api/model/workTopicDomain.ts | 10 +- webapp/src/app/api/model/workTopicField.ts | 10 +- .../src/app/api/model/workTopicInformation.ts | 22 +- webapp/src/app/api/model/workTopicSubfield.ts | 10 +- .../app/api/model/worksFilterProperties.ts | 46 +- webapp/src/app/api/model/worksListResponse.ts | 12 +- webapp/src/app/api/model/yearlyData.ts | 12 +- webapp/src/app/api/param.ts | 37 +- webapp/src/app/api/provide-api.ts | 24 +- webapp/src/app/api/variables.ts | 10 +- 143 files changed, 5372 insertions(+), 8414 deletions(-) diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 6bd94fa1..20221efb 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -6,7 +6,6 @@ from typing import Any from inse.integrations import elasticsearch from inse.model import ESCluster, ESIndex -import httpx import asyncio from .. import config from .name_matching import search_name_variants @@ -33,15 +32,9 @@ from inse.exceptions import MissingApiKeyError class PatentSearchClient: def __init__( self, - base_url: str | None = None, api_key: str | None = None, - timeout: float = 30.0, - transport: httpx.AsyncBaseTransport | None = None, ): - self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key - self.timeout = timeout - self.transport = transport def _headers(self) -> dict[str, str]: if not self.api_key: @@ -278,4 +271,4 @@ class PatentSearchClient: "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], "query": {"match_phrase": {"title": title}}, - } + } \ No newline at end of file diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index c1fac9bc..a869a209 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -7,8 +7,8 @@ from inse.patents.institutions.logic import ( get_patents_by_institution_id, ) -import httpx - +import logging +import asyncio from ..persons import logic as person_logic from ..models.openalex.author import Author from . import model diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index ae0622b0..6aea4c7c 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -1,85 +1,46 @@ -# import json - -# import httpx -# import pytest -# from inse.model import ESIndex -# from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient -# from inse.patents.elastic_search_client import ( -# DEFAULT_SEARCH_SIZE, -# PatentSearchClient, -# ) +import pytest +from unittest.mock import patch, MagicMock +from inse.model import ESIndex +from inse.patents.elastic_search_client import ( + DEFAULT_SEARCH_SIZE, + PatentSearchClient, +) -# @pytest.fixture -# def anyio_backend(): -# return "asyncio" +@pytest.fixture +def anyio_backend(): + return "asyncio" -# def test_epo_query_uses_nested_search_and_name_variants(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.epo_query_by_inventor("Müller", "Christian") +def test_epo_query_uses_nested_search_and_name_variants(): + client = PatentSearchClient(api_key="test-key") + payload = client.epo_query_by_inventor("Müller", "Christian") -# assert payload["size"] == DEFAULT_SEARCH_SIZE -# assert payload["sort"][0] == {"_score": {"order": "desc"}} -# nested = payload["query"]["nested"] -# assert nested["path"] == "inventors_name_nested" -# must = nested["query"]["bool"]["must"] -# assert len(must) == 2 -# assert "should" in must[0]["bool"] + assert payload["size"] == DEFAULT_SEARCH_SIZE + assert payload["sort"][0] == {"_score": {"order": "desc"}} + nested = payload["query"]["nested"] + assert nested["path"] == "inventors_name_nested" + must = nested["query"]["bool"]["must"] + assert len(must) == 2 + assert "should" in must[0]["bool"] -# def test_uspto_index_is_3_0(): -# assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" -# assert ESIndex.EPO_INDEX == "epo_index_1.0" +def test_uspto_index_is_3_0(): + assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" + assert ESIndex.EPO_INDEX == "epo_index_1.0" -# def test_epo_query_by_applicant_uses_applicants_name_field(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.epo_query_by_applicant( -# ["University of Duisburg-Essen", "Universität Duisburg-Essen"] -# ) +@pytest.mark.anyio +async def test_search_epo_posts_to_correct_index(): + captured: list[dict] = [] -# assert payload["size"] == DEFAULT_SEARCH_SIZE -# assert "applicants_name" in str(payload["query"]) -# assert payload["query"]["bool"]["minimum_should_match"] == 1 + def fake_search(index: str, body: dict, cluster=None): + captured.append({"index": index, "body": body}) + return {"hits": {"hits": []}} + with patch("inse.integrations.elasticsearch.search", side_effect=fake_search): + client = PatentSearchClient(api_key="test-key") + await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) -# def test_uspto_query_by_assignee_uses_assignees_orgs_field(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.uspto_query_by_assignee(["Harvard University"]) - -# assert "assignees_orgs" in str(payload["query"]) - - -# def test_detail_and_title_queries_skip_empty_date_filters(): -# client = AllPatentsSearchClient(api_key="test-key") - -# epo_payload = client.epo_title_query("method for generating and using a map") -# uspto_payload = client.uspto_detail_query("US12508845") - -# assert "must" not in epo_payload["query"]["bool"] -# assert "must" not in uspto_payload["query"]["bool"] - - -# @pytest.mark.anyio -# async def test_search_epo_posts_to_correct_index(): -# captured: list[dict] = [] - -# def handler(request: httpx.Request) -> httpx.Response: -# path_parts = request.url.path.strip("/").split("/") -# captured.append( -# { -# "index": path_parts[-2], -# "body": json.loads(request.content) if request.content else {}, -# } -# ) -# return httpx.Response(200, json={"hits": {"hits": []}}) - -# client = PatentSearchClient( -# api_key="test-key", -# transport=httpx.MockTransport(handler), -# ) -# await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) - -# assert len(captured) == 1 -# assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file + assert len(captured) == 1 + assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file diff --git a/webapp/src/app/api/README.md b/webapp/src/app/api/README.md index 2df9da7b..dfa7b6e7 100644 --- a/webapp/src/app/api/README.md +++ b/webapp/src/app/api/README.md @@ -46,10 +46,10 @@ npm link In your project: ```console -npm link +npm link ``` -**Note for Windows users:** The Angular CLI has troubles to use linked npm packages. +__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. Please refer to this issue for a solution / workaround. Published packages are not effected by this issue. @@ -58,22 +58,22 @@ Published packages are not effected by this issue. In your Angular project: ```typescript + import { ApplicationConfig } from '@angular/core'; import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi(), - ], + providers: [ + // ... + provideHttpClient(), + provideApi() + ], }; ``` **NOTE** If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module: - ```typescript import { ApiModule } from ''; ``` @@ -86,11 +86,11 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi('http://localhost:9999'), - ], + providers: [ + // ... + provideHttpClient(), + provideApi('http://localhost:9999') + ], }; ``` @@ -101,15 +101,15 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi({ - withCredentials: true, - username: 'user', - password: 'password', - }), - ], + providers: [ + // ... + provideHttpClient(), + provideApi({ + withCredentials: true, + username: 'user', + password: 'password' + }) + ], }; ``` @@ -120,22 +120,21 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi, Configuration } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - { - provide: Configuration, - useFactory: (authService: AuthService) => - new Configuration({ - basePath: 'http://localhost:9999', - withCredentials: true, - username: authService.getUsername(), - password: authService.getPassword(), - }), - deps: [AuthService], - multi: false, - }, - ], + providers: [ + // ... + provideHttpClient(), + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration({ + basePath: 'http://localhost:9999', + withCredentials: true, + username: authService.getUsername(), + password: authService.getPassword(), + }), + deps: [AuthService], + multi: false + } + ], }; ``` @@ -152,12 +151,12 @@ import { HttpClientModule } from '@angular/common/http'; import { environment } from '../environments/environment'; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideUserApi(environment.basePath), - provideAdminApi(environment.basePath), - ], + providers: [ + // ... + provideHttpClient(), + provideUserApi(environment.basePath), + provideAdminApi(environment.basePath), + ], }; ``` @@ -177,8 +176,8 @@ Example value for use in your Configuration-Provider: ```typescript new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}); + encodeParam: (param: Param) => myFancyParamEncoder(param), +}) ``` [parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 39dc1b80..e2ea97f7 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,8 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './items.service'; import { ItemsService } from './items.service'; -import { KeywordsService } from './keywords.service'; export * from './keywords.service'; +import { KeywordsService } from './keywords.service'; export * from './news.service'; import { NewsService } from './news.service'; export * from './patents.service'; @@ -26,19 +26,4 @@ export * from './topics.service'; import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; -export const APIS = [ - CompanyConnectionsService, - FundingService, - INSEAccountServiceService, - INSEServiceService, - InstitutionsService, - ItemsService, - KeywordsService, - NewsService, - PatentsService, - PersonNetworkService, - PersonsService, - ProjectsService, - TopicsService, - WorksService, -]; +export const APIS = [CompanyConnectionsService, FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, KeywordsService, NewsService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/companyConnections.service.ts b/webapp/src/app/api/api/companyConnections.service.ts index 6ad850ea..cbc5f803 100644 --- a/webapp/src/app/api/api/companyConnections.service.ts +++ b/webapp/src/app/api/api/companyConnections.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse'; @@ -28,121 +22,74 @@ import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse' import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class CompanyConnectionsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get possible company connections by OpenAlex author ID. - * @endpoint get /api/inse-service/authors/{author_id}/company-connections - * @param authorId - * @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 getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCompanyConnectionsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Get possible company connections by OpenAlex author ID. + * @endpoint get /api/inse-service/authors/{author_id}/company-connections + * @param authorId + * @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 getCompanyConnectionsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCompanyConnectionsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCompanyConnectionsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCompanyConnectionsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/company-connections`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/funding.service.ts b/webapp/src/app/api/api/funding.service.ts index f1f0a1a7..46772768 100644 --- a/webapp/src/app/api/api/funding.service.ts +++ b/webapp/src/app/api/api/funding.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { FundersByAuthorResponse } from '../model/fundersByAuthorResponse'; @@ -30,246 +24,138 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { PublicationsByAuthorResponse } from '../model/publicationsByAuthorResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class FundingService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get funding organizations by author. - * @endpoint get /api/inse-service/authors/{author_id}/funders - * @param authorId - * @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 getFundersByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getFundersByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getFundersByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getFundersByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getFundersByAuthor.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Get funding organizations by author. + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + * @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 getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get funded publications by author. + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + * @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 getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/funders`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get funded publications by author. - * @endpoint get /api/inse-service/authors/{author_id}/publications - * @param authorId - * @param page - * @param pageSize - * @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 getPublicationsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPublicationsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPublicationsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPublicationsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPublicationsByAuthor.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/publications`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/iNSEAccountService.service.ts b/webapp/src/app/api/api/iNSEAccountService.service.ts index 4874a0a8..90181dbd 100644 --- a/webapp/src/app/api/api/iNSEAccountService.service.ts +++ b/webapp/src/app/api/api/iNSEAccountService.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AccessGrant } from '../model/accessGrant'; @@ -34,424 +28,255 @@ import { IdentityGrant } from '../model/identityGrant'; import { User } from '../model/user'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class INSEAccountServiceService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Create User - * @endpoint post /inse-account/create - * @param bodyCreateUser - * @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 createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createUser( - bodyCreateUser: BodyCreateUser, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyCreateUser === null || bodyCreateUser === undefined) { - throw new Error( - 'Required parameter bodyCreateUser was null or undefined when calling createUser.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Create User + * @endpoint post /inse-account/create + * @param bodyCreateUser + * @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 createUser(bodyCreateUser: BodyCreateUser, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createUser(bodyCreateUser: BodyCreateUser, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUser(bodyCreateUser: BodyCreateUser, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUser(bodyCreateUser: BodyCreateUser, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyCreateUser === null || bodyCreateUser === undefined) { + throw new Error('Required parameter bodyCreateUser was null or undefined when calling createUser.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/inse-account/create`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyCreateUser, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get Access Grant + * @endpoint post /inse-account/auth/access + * @param secret + * @param account + * @param organization + * @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 getAccessGrant(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAccessGrant(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrant(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrant(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (secret === null || secret === undefined) { + throw new Error('Required parameter secret was null or undefined when calling getAccessGrant.'); + } + if (account === null || account === undefined) { + throw new Error('Required parameter account was null or undefined when calling getAccessGrant.'); + } + if (organization === null || organization === undefined) { + throw new Error('Required parameter organization was null or undefined when calling getAccessGrant.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let localVarFormParams: { append(param: string, value: any): any; }; + let localVarUseForm = false; + let localVarConvertFormParamsToString = false; + if (localVarUseForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new HttpParams({encoder: this.encoder}); + } + + if (secret !== undefined) { + localVarFormParams = localVarFormParams.append('secret', secret) as any || localVarFormParams; + } + if (account !== undefined) { + localVarFormParams = localVarFormParams.append('account', account) as any || localVarFormParams; + } + if (organization !== undefined) { + localVarFormParams = localVarFormParams.append('organization', organization) as any || localVarFormParams; + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/inse-account/auth/access`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + /** + * Get Identity Grant + * @endpoint post /inse-account/auth/id + * @param username + * @param password + * @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 getIdentityGrant(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getIdentityGrant(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrant(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrant(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getIdentityGrant.'); + } + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling getIdentityGrant.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let localVarFormParams: { append(param: string, value: any): any; }; + let localVarUseForm = false; + let localVarConvertFormParamsToString = false; + if (localVarUseForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new HttpParams({encoder: this.encoder}); + } + + if (username !== undefined) { + localVarFormParams = localVarFormParams.append('username', username) as any || localVarFormParams; + } + if (password !== undefined) { + localVarFormParams = localVarFormParams.append('password', password) as any || localVarFormParams; + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/inse-account/auth/id`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/inse-account/create`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: bodyCreateUser, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Get Access Grant - * @endpoint post /inse-account/auth/access - * @param secret - * @param account - * @param organization - * @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 getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessGrant( - secret: string, - account: number, - organization: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (secret === null || secret === undefined) { - throw new Error( - 'Required parameter secret was null or undefined when calling getAccessGrant.', - ); - } - if (account === null || account === undefined) { - throw new Error( - 'Required parameter account was null or undefined when calling getAccessGrant.', - ); - } - if (organization === null || organization === undefined) { - throw new Error( - 'Required parameter organization was null or undefined when calling getAccessGrant.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/x-www-form-urlencoded']; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({ encoder: this.encoder }); - } - - if (secret !== undefined) { - localVarFormParams = - (localVarFormParams.append('secret', secret) as any) || - localVarFormParams; - } - if (account !== undefined) { - localVarFormParams = - (localVarFormParams.append('account', account) as any) || - localVarFormParams; - } - if (organization !== undefined) { - localVarFormParams = - (localVarFormParams.append('organization', organization) as any) || - localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/inse-account/auth/access`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString - ? localVarFormParams.toString() - : localVarFormParams, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get Identity Grant - * @endpoint post /inse-account/auth/id - * @param username - * @param password - * @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 getIdentityGrant( - username: string, - password: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getIdentityGrant( - username: string, - password: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getIdentityGrant( - username: string, - password: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getIdentityGrant( - username: string, - password: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (username === null || username === undefined) { - throw new Error( - 'Required parameter username was null or undefined when calling getIdentityGrant.', - ); - } - if (password === null || password === undefined) { - throw new Error( - 'Required parameter password was null or undefined when calling getIdentityGrant.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/x-www-form-urlencoded']; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({ encoder: this.encoder }); - } - - if (username !== undefined) { - localVarFormParams = - (localVarFormParams.append('username', username) as any) || - localVarFormParams; - } - if (password !== undefined) { - localVarFormParams = - (localVarFormParams.append('password', password) as any) || - localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/inse-account/auth/id`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString - ? localVarFormParams.toString() - : localVarFormParams, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/iNSEService.service.ts b/webapp/src/app/api/api/iNSEService.service.ts index 8788adee..cf95d68e 100644 --- a/webapp/src/app/api/api/iNSEService.service.ts +++ b/webapp/src/app/api/api/iNSEService.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -32,922 +26,513 @@ import { ItemCreate } from '../model/itemCreate'; import { ItemPage } from '../model/itemPage'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class INSEServiceService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Adds a new item. - * @endpoint post /api/inse-service/items - * @param itemCreate - * @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 addItem( - itemCreate: ItemCreate, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public addItem( - itemCreate: ItemCreate, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public addItem( - itemCreate: ItemCreate, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public addItem( - itemCreate: ItemCreate, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (itemCreate === null || itemCreate === undefined) { - throw new Error( - 'Required parameter itemCreate was null or undefined when calling addItem.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Adds a new item. + * @endpoint post /api/inse-service/items + * @param itemCreate + * @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 addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling addItem.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @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 buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - saveJson, - 'save_json', - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @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 countTopicHierarchy( - topic: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public countTopicHierarchy( - topic: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topic === null || topic === undefined) { - throw new Error( - 'Required parameter topic was null or undefined when calling countTopicHierarchy.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + let localVarPath = `/api/inse-service/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * Builds the topic hierarchy cache. + * @endpoint get /api/inse-service/topics/cache + * @param pageSize Page size for each search page. + * @param saveJson Persist cache JSON to data folder. + * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + saveJson, 'save_json'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Deletes the item with the id. + * @endpoint delete /api/inse-service/items/{id} + * @param id The item id. + * @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 deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling deleteItem.'); + } - /** - * Deletes the item with the id. - * @endpoint delete /api/inse-service/items/{id} - * @param id The item id. - * @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 deleteItem( - id: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public deleteItem( - id: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteItem( - id: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteItem( - id: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling deleteItem.', - ); + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns the item with the id. + * @endpoint get /api/inse-service/items/{id} + * @param id The item id. + * @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 getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getItem.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a page of items. + * @endpoint get /api/inse-service/items + * @param pageOffset The page offset. + * @param pageSize The page size. + * @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 getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'pageOffset'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'delete', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns the item with the id. - * @endpoint get /api/inse-service/items/{id} - * @param id The item id. - * @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 getItem( - id: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getItem( - id: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItem( - id: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItem( - id: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getItem.', - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/hierarchy`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Updates the item with the id. + * @endpoint put /api/inse-service/items/{id} + * @param id The item id. + * @param itemCreate + * @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 updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling updateItem.'); + } + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Returns a page of items. - * @endpoint get /api/inse-service/items - * @param pageOffset The page offset. - * @param pageSize The page size. - * @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 getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItems( - pageOffset?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'pageOffset', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/hierarchy`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Updates the item with the id. - * @endpoint put /api/inse-service/items/{id} - * @param id The item id. - * @param itemCreate - * @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 updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling updateItem.', - ); - } - if (itemCreate === null || itemCreate === undefined) { - throw new Error( - 'Required parameter itemCreate was null or undefined when calling updateItem.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('put', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } } diff --git a/webapp/src/app/api/api/institutions.service.ts b/webapp/src/app/api/api/institutions.service.ts index 8b27a539..a4ba3d62 100644 --- a/webapp/src/app/api/api/institutions.service.ts +++ b/webapp/src/app/api/api/institutions.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -36,727 +30,358 @@ import { InstitutionsListResponse } from '../model/institutionsListResponse'; import { RankingResponse } from '../model/rankingResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class InstitutionsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns institution options for autocomplete inputs. - * @endpoint get /api/inse-service/institutions/autocomplete - * @param query Institution search text, for example \'Duisburg Essen\'. - * @param countryCode Optional ISO country code filter. - * @param type Optional institution type filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling autocompleteInstitutions.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - countryCode, - 'countryCode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - type, - 'type', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); + /** + * Returns institution options for autocomplete inputs. + * @endpoint get /api/inse-service/institutions/autocomplete + * @param query Institution search text, for example \'Duisburg Essen\'. + * @param countryCode Optional ISO country code filter. + * @param type Optional institution type filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling autocompleteInstitutions.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + countryCode, 'countryCode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + type, 'type'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a single institution by ID. + * Returns a single institution by its OpenAlex ID. + * @endpoint get /api/inse-service/institutions/{id} + * @param id + * @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 getInstitutionById(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionById(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionById(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionById(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getInstitutionById.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/institutions/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns data for the University Ranking Dashboard. + * @endpoint get /api/inse-service/university-rankings + * @param topic Research topic (e.g., \'Artificial Intelligence\') + * @param metric Metric to rank by + * @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 getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.'); + } - /** - * Returns a single institution by ID. - * Returns a single institution by its OpenAlex ID. - * @endpoint get /api/inse-service/institutions/{id} - * @param id - * @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 getInstitutionById( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionById( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionById( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionById( - id: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getInstitutionById.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + topic, 'topic'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + metric, 'metric'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/university-rankings`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns a list of OpenAlex institutions. + * @endpoint get /api/inse-service/institutions + * @param search Full-text search, for example \'Duisburg Essen\'. + * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'country_code\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filter, 'filter'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + groupBy, 'group_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + perPage, 'per_page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + cursor, 'cursor'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sample, 'sample'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + select, 'select'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches for institutions by name. + * Searches for institutions by name with pagination. + * @endpoint get /api/inse-service/institutions/search + * @param name Institution name to search for, for example \'University of Duisburg Essen\'. + * @param page Page number (0-indexed). + * @param size Number of institutions per page. + * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. + * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. + * @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 searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + name, 'name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortingDirection, 'sorting_direction'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns data for the University Ranking Dashboard. - * @endpoint get /api/inse-service/university-rankings - * @param topic Research topic (e.g., \'Artificial Intelligence\') - * @param metric Metric to rank by - * @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 getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topic === null || topic === undefined) { - throw new Error( - 'Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - topic, - 'topic', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - metric, - 'metric', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/university-rankings`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns a list of OpenAlex institutions. - * @endpoint get /api/inse-service/institutions - * @param search Full-text search, for example \'Duisburg Essen\'. - * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'country_code\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filter, - 'filter', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sort, - 'sort', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - groupBy, - 'group_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - perPage, - 'per_page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - cursor, - 'cursor', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sample, - 'sample', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - select, - 'select', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for institutions by name. - * Searches for institutions by name with pagination. - * @endpoint get /api/inse-service/institutions/search - * @param name Institution name to search for, for example \'University of Duisburg Essen\'. - * @param page Page number (0-indexed). - * @param size Number of institutions per page. - * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. - * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. - * @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 searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - name, - 'name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortingDirection, - 'sorting_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/items.service.ts b/webapp/src/app/api/api/items.service.ts index bc3c2293..69cd8e54 100644 --- a/webapp/src/app/api/api/items.service.ts +++ b/webapp/src/app/api/api/items.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -32,603 +26,338 @@ import { ItemCreate } from '../model/itemCreate'; import { ItemPage } from '../model/itemPage'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class ItemsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Adds a new item. - * @endpoint post /api/inse-service/items - * @param itemCreate - * @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 addItem( - itemCreate: ItemCreate, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public addItem( - itemCreate: ItemCreate, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public addItem( - itemCreate: ItemCreate, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public addItem( - itemCreate: ItemCreate, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (itemCreate === null || itemCreate === undefined) { - throw new Error( - 'Required parameter itemCreate was null or undefined when calling addItem.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Adds a new item. + * @endpoint post /api/inse-service/items + * @param itemCreate + * @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 addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling addItem.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Deletes the item with the id. + * @endpoint delete /api/inse-service/items/{id} + * @param id The item id. + * @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 deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling deleteItem.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + /** + * Returns the item with the id. + * @endpoint get /api/inse-service/items/{id} + * @param id The item id. + * @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 getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getItem.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } + /** + * Returns a page of items. + * @endpoint get /api/inse-service/items + * @param pageOffset The page offset. + * @param pageSize The page size. + * @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 getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Deletes the item with the id. - * @endpoint delete /api/inse-service/items/{id} - * @param id The item id. - * @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 deleteItem( - id: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public deleteItem( - id: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteItem( - id: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteItem( - id: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling deleteItem.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'pageOffset'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Updates the item with the id. + * @endpoint put /api/inse-service/items/{id} + * @param id The item id. + * @param itemCreate + * @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 updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling updateItem.'); + } + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'delete', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns the item with the id. - * @endpoint get /api/inse-service/items/{id} - * @param id The item id. - * @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 getItem( - id: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getItem( - id: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItem( - id: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItem( - id: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getItem.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Returns a page of items. - * @endpoint get /api/inse-service/items - * @param pageOffset The page offset. - * @param pageSize The page size. - * @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 getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItems( - pageOffset?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getItems( - pageOffset?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'pageOffset', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Updates the item with the id. - * @endpoint put /api/inse-service/items/{id} - * @param id The item id. - * @param itemCreate - * @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 updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateItem( - id: number, - itemCreate: ItemCreate, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling updateItem.', - ); - } - if (itemCreate === null || itemCreate === undefined) { - throw new Error( - 'Required parameter itemCreate was null or undefined when calling updateItem.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('put', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } } diff --git a/webapp/src/app/api/api/personNetwork.service.ts b/webapp/src/app/api/api/personNetwork.service.ts index 5b468938..b1183ff6 100644 --- a/webapp/src/app/api/api/personNetwork.service.ts +++ b/webapp/src/app/api/api/personNetwork.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { CollaborationNetwork } from '../model/collaborationNetwork'; @@ -30,139 +24,86 @@ import { FilterProperties } from '../model/filterProperties'; import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class PersonNetworkService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get a person\'s collaboration network. - * Returns a person\'s collaboration network based on their works and co-authors. - * @endpoint post /api/person/network/{raw_user_id} - * @param rawUserId The raw user ID of the person. - * @param filterProperties - * @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 getCollaborationNetwork( - rawUserId: string, - filterProperties?: FilterProperties, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getCollaborationNetwork( - rawUserId: string, - filterProperties?: FilterProperties, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCollaborationNetwork( - rawUserId: string, - filterProperties?: FilterProperties, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCollaborationNetwork( - rawUserId: string, - filterProperties?: FilterProperties, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawUserId === null || rawUserId === undefined) { - throw new Error( - 'Required parameter rawUserId was null or undefined when calling getCollaborationNetwork.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Get a person\'s collaboration network. + * Returns a person\'s collaboration network based on their works and co-authors. + * @endpoint post /api/person/network/{raw_user_id} + * @param rawUserId The raw user ID of the person. + * @param filterProperties + * @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 getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawUserId === null || rawUserId === undefined) { + throw new Error('Required parameter rawUserId was null or undefined when calling getCollaborationNetwork.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/person/network/${this.configuration.encodeParam({name: "rawUserId", value: rawUserId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: filterProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/person/network/${this.configuration.encodeParam({ name: 'rawUserId', value: rawUserId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: filterProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index cef36fc4..03222a4c 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AuthorsListResponse } from '../model/authorsListResponse'; @@ -32,1739 +26,869 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { PersonBio } from '../model/personBio'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class PersonsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Generates a bio for a person by author ID. - * @endpoint get /api/inse-service/persons/bio - * @param authorId OpenAlex author ID (e.g., A5093075883) - * @param include Comma-separated list to include tags - * @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 generatePersonBio( - authorId: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public generatePersonBio( - authorId: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public generatePersonBio( - authorId: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public generatePersonBio( - authorId: string, - include?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling generatePersonBio.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'author_id', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/bio`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by ID. - * @endpoint get /api/inse-service/person/{id} - * @param id OpenAlex author ID - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @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 getPersonByID( - id: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPersonByID( - id: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID( - id: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID( - id: string, - include?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getPersonByID.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({ name: 'id', value: id, 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by ID. - * @endpoint get /api/inse-service/person/{id} - * @param id OpenAlex author ID - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @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 getPersonByID_1( - id: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPersonByID_1( - id: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID_1( - id: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID_1( - id: string, - include?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getPersonByID_1.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({ name: 'id', value: id, 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for persons by ID or name. - * @endpoint get /api/inse-service/persons/search - * @param authorId OpenAlex author ID (e.g., A5093075883) - * @param query Search query (e.g., Arman AND Arzani) - * @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost - * @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 searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'author_id', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by name. - * @endpoint get /api/inse-service/persons/autocomplete - * @param authorName Authors name (e.g., Arman Arzani) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @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 searchPersonsAutocomplete( - authorName: string, - include: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsAutocomplete( - authorName: string, - include: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsAutocomplete( - authorName: string, - include: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsAutocomplete( - authorName: string, - include: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorName === null || authorName === undefined) { - throw new Error( - 'Required parameter authorName was null or undefined when calling searchPersonsAutocomplete.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsAutocomplete.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorName, - 'author_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by name. - * @endpoint get /api/inse-service/persons/autocomplete - * @param authorName Authors name (e.g., Arman Arzani) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @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 searchPersonsAutocomplete_2( - authorName: string, - include: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsAutocomplete_2( - authorName: string, - include: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsAutocomplete_2( - authorName: string, - include: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsAutocomplete_2( - authorName: string, - include: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorName === null || authorName === undefined) { - throw new Error( - 'Required parameter authorName was null or undefined when calling searchPersonsAutocomplete_2.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsAutocomplete_2.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorName, - 'author_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for persons by institution name. - * @endpoint get /api/inse-service/persons/searchByInstitution - * @param institutionName Institution name (e.g., MIT, Oxford University) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @param limit Limit of search page results - * @param pageOffset Offset of the result page - * @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 searchPersonsByInstitution( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsByInstitution( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByInstitution( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByInstitution( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (institutionName === null || institutionName === undefined) { - throw new Error( - 'Required parameter institutionName was null or undefined when calling searchPersonsByInstitution.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByInstitution.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institution_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'page_offset', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/searchByInstitution`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for persons by institution name. - * @endpoint get /api/inse-service/persons/searchByInstitution - * @param institutionName Institution name (e.g., MIT, Oxford University) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @param limit Limit of search page results - * @param pageOffset Offset of the result page - * @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 searchPersonsByInstitution_3( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsByInstitution_3( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByInstitution_3( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByInstitution_3( - institutionName: string, - include: string, - limit?: number, - pageOffset?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (institutionName === null || institutionName === undefined) { - throw new Error( - 'Required parameter institutionName was null or undefined when calling searchPersonsByInstitution_3.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByInstitution_3.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institution_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'page_offset', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/searchByInstitution`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by name. - * @endpoint get /api/inse-service/persons/searchByName - * @param authorName Authors name (e.g., Arman Arzani) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @param limit Limit of search page results - * @param pageOffset Offset of the result page - * @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 searchPersonsByName( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsByName( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByName( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByName( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorName === null || authorName === undefined) { - throw new Error( - 'Required parameter authorName was null or undefined when calling searchPersonsByName.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByName.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorName, - 'author_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'page_offset', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/searchByName`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for person by name. - * @endpoint get /api/inse-service/persons/searchByName - * @param authorName Authors name (e.g., Arman Arzani) - * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... - * @param limit Limit of search page results - * @param pageOffset Offset of the result page - * @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 searchPersonsByName_4( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsByName_4( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByName_4( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsByName_4( - authorName: string, - include: string, - limit?: number, - pageOffset?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorName === null || authorName === undefined) { - throw new Error( - 'Required parameter authorName was null or undefined when calling searchPersonsByName_4.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByName_4.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorName, - 'author_name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageOffset, - 'page_offset', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/persons/searchByName`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Searches for persons with advanced filters (Topic & Institution) and pagination. - * @endpoint get /api/inse-service/persons/search-list - * @param query Search query (e.g., Arman AND Arzani) - * @param institutionName Filter by institution name - * @param sortBy Value to sort by - * @param sortOrder asc or desc? - * @param topic Filter by topic display names - * @param page Page number (1-indexed) - * @param pageSize Results per page - * @param include Comma-separated include tags - * @param strict Strict institution search by target year - * @param filterMode Filter mode: \'in\' or \'from\' - * @param filterYear Filter year - * @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 searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institutionName', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sortBy', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + /** + * Generates a bio for a person by author ID. + * @endpoint get /api/inse-service/persons/bio + * @param authorId OpenAlex author ID (e.g., A5093075883) + * @param include Comma-separated list to include tags + * @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 generatePersonBio(authorId: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public generatePersonBio(authorId: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public generatePersonBio(authorId: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public generatePersonBio(authorId: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling generatePersonBio.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'author_id'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/bio`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - strict, - 'strict', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterMode, - 'filterMode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterYear, - 'filterYear', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches for person by ID. + * @endpoint get /api/inse-service/person/{id} + * @param id OpenAlex author ID + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @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 getPersonByID(id: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPersonByID(id: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID(id: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID(id: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPersonByID.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + let localVarHeaders = this.defaultHeaders; - let localVarPath = `/api/inse-service/persons/search-list`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - /** - * Searches for persons with advanced filters (Topic & Institution) and pagination. - * @endpoint get /api/inse-service/persons/search-list - * @param query Search query (e.g., Arman AND Arzani) - * @param institutionName Filter by institution name - * @param sortBy Value to sort by - * @param sortOrder asc or desc? - * @param topic Filter by topic display names - * @param page Page number (1-indexed) - * @param pageSize Results per page - * @param include Comma-separated include tags - * @param strict Strict institution search by target year - * @param filterMode Filter mode: \'in\' or \'from\' - * @param filterYear Filter year - * @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 searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institutionName', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sortBy', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({name: "id", value: id, 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - strict, - 'strict', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterMode, - 'filterMode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterYear, - 'filterYear', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches for person by ID. + * @endpoint get /api/inse-service/person/{id} + * @param id OpenAlex author ID + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @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 getPersonByID_1(id: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPersonByID_1(id: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID_1(id: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID_1(id: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPersonByID_1.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({name: "id", value: id, 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons by ID or name. + * @endpoint get /api/inse-service/persons/search + * @param authorId OpenAlex author ID (e.g., A5093075883) + * @param query Search query (e.g., Arman AND Arzani) + * @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost + * @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 searchPersons(authorId?: string, query?: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'author_id'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for person by name. + * @endpoint get /api/inse-service/persons/autocomplete + * @param authorName Authors name (e.g., Arman Arzani) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @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 searchPersonsAutocomplete(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for person by name. + * @endpoint get /api/inse-service/persons/autocomplete + * @param authorName Authors name (e.g., Arman Arzani) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @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 searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete_2.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete_2.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons by institution name. + * @endpoint get /api/inse-service/persons/searchByInstitution + * @param institutionName Institution name (e.g., MIT, Oxford University) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @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 searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (institutionName === null || institutionName === undefined) { + throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByInstitution.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institution_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/searchByInstitution`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons by institution name. + * @endpoint get /api/inse-service/persons/searchByInstitution + * @param institutionName Institution name (e.g., MIT, Oxford University) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @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 searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (institutionName === null || institutionName === undefined) { + throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution_3.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByInstitution_3.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institution_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/searchByInstitution`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for person by name. + * @endpoint get /api/inse-service/persons/searchByName + * @param authorName Authors name (e.g., Arman Arzani) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @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 searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByName.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/searchByName`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for person by name. + * @endpoint get /api/inse-service/persons/searchByName + * @param authorName Authors name (e.g., Arman Arzani) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @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 searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName_4.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByName_4.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/searchByName`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons with advanced filters (Topic & Institution) and pagination. + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param sortBy Value to sort by + * @param sortOrder asc or desc? + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year + * @param filterMode Filter mode: \'in\' or \'from\' + * @param filterYear Filter year + * @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 searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institutionName'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sortBy'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + strict, 'strict'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterMode, 'filterMode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterYear, 'filterYear'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/search-list`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons with advanced filters (Topic & Institution) and pagination. + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param sortBy Value to sort by + * @param sortOrder asc or desc? + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year + * @param filterMode Filter mode: \'in\' or \'from\' + * @param filterYear Filter year + * @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 searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institutionName'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sortBy'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + strict, 'strict'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterMode, 'filterMode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterYear, 'filterYear'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/search-list`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/persons/search-list`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/projects.service.ts b/webapp/src/app/api/api/projects.service.ts index c69e39c9..95efc1f2 100644 --- a/webapp/src/app/api/api/projects.service.ts +++ b/webapp/src/app/api/api/projects.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { BundProjectDetails } from '../model/bundProjectDetails'; @@ -52,1209 +46,650 @@ import { ProjectsSortBy } from '../model/projectsSortBy'; import { SortDirection } from '../model/sortDirection'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class ProjectsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get DFG projects. - * Returns a page of DFG projects based on the provided pagination parameters and optional institution filter. - * @endpoint get /api/projects/person/dfg/search - * @param authorId The author ID to filter by. - * @param topic The topic to filter by. - * @param page The page number. - * @param size The page size. - * @param sortBy The field to sort by. - * @param sortDirection The sort direction (asc or desc). - * @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 getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getDfgProjects.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'author_id', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - topic, - 'topic', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortDirection, - 'sort_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/person/dfg/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get EU projects for an author. - * Returns a list of EU projects associated with the specified author ID. - * @endpoint get /api/projects/author/{raw_oa_author_id}/eu - * @param rawOaAuthorId The author ID to filter by. - * @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 getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaAuthorId === null || rawOaAuthorId === undefined) { - throw new Error( - 'Required parameter rawOaAuthorId was null or undefined when calling getEuProjectsForAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/author/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/eu`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get funding over time for bund projects. - * Returns the funding over time for bund projects associated with the specified institution. - * @endpoint get /api/projects/institution/bund/funding-over-time - * @param rawOaInstitutionId The institution ID to filter by. - * @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 getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { - throw new Error( - 'Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionBundProjectsFundingOverTime.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - rawOaInstitutionId, - 'raw_oa_institution_id', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/institution/bund/funding-over-time`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get funding over time for EU projects. - * Returns the funding over time for EU projects associated with the specified institution. - * @endpoint get /api/projects/institution/eu/funding-over-time - * @param rawOaInstitutionId The institution ID to filter by. - * @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 getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { - throw new Error( - 'Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionCordisEuProjectsFundingOverTime.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - rawOaInstitutionId, - 'raw_oa_institution_id', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/institution/eu/funding-over-time`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get a single BUND project. - * Returns a single BUND project based on its ID. - * @endpoint get /api/projects/bund/{id} - * @param id The ID of the BUND project to retrieve. - * @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 getSingleBundProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleBundProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleBundProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleBundProject( - id: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getSingleBundProject.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/bund/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get a single DFG project. - * Returns a single DFG project based on its ID. - * @endpoint get /api/projects/dfg/{id} - * @param id The ID of the DFG project to retrieve. - * @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 getSingleDfgProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleDfgProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleDfgProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleDfgProject( - id: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getSingleDfgProject.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/dfg/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get a single EU Cordis project. - * Returns a single EU Cordis project based on its ID. - * @endpoint get /api/projects/eu/{id} - * @param id The ID of the EU Cordis project to retrieve. - * @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 getSingleEuCordisProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleEuCordisProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleEuCordisProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleEuCordisProject( - id: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getSingleEuCordisProject.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/eu/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get bund projects. - * Returns a page of bund projects based on the provided pagination parameters and optional institution filter. - * @endpoint post /api/projects/institution/bund/search - * @param projectsFilteringProperties - * @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 searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - projectsFilteringProperties === null || - projectsFilteringProperties === undefined - ) { - throw new Error( - 'Required parameter projectsFilteringProperties was null or undefined when calling searchBundProjects.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/institution/bund/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: projectsFilteringProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get EU projects. - * Returns a page of EU projects based on the provided pagination parameters and optional institution filter. - * @endpoint post /api/projects/institution/eu/search - * @param projectsFilteringProperties - * @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 searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - projectsFilteringProperties === null || - projectsFilteringProperties === undefined - ) { - throw new Error( - 'Required parameter projectsFilteringProperties was null or undefined when calling searchCordisEuProjects.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/institution/eu/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: projectsFilteringProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Search projects across all funders. - * Returns a page of projects across all funders based on the provided pagination parameters and optional institution filter. - * @endpoint get /api/projects/search - * @param page The page number. - * @param size The page size. - * @param selectedProjectTypes The set of project types to filter by (e.g., \'bund\', \'eu\', \'dfg\'). If not provided, projects of all types will be included. - * @param title The title to filter by. - * @param sortBy The field to sort by. - * @param sortDirection The sort direction (asc or desc). - * @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 searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - if (selectedProjectTypes) { - selectedProjectTypes.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'selected_project_types', + /** + * Get DFG projects. + * Returns a page of DFG projects based on the provided pagination parameters and optional institution filter. + * @endpoint get /api/projects/person/dfg/search + * @param authorId The author ID to filter by. + * @param topic The topic to filter by. + * @param page The page number. + * @param size The page size. + * @param sortBy The field to sort by. + * @param sortDirection The sort direction (asc or desc). + * @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 getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getDfgProjects.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'author_id'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + topic, 'topic'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/person/dfg/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - title, - 'title', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortDirection, - 'sort_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get EU projects for an author. + * Returns a list of EU projects associated with the specified author ID. + * @endpoint get /api/projects/author/{raw_oa_author_id}/eu + * @param rawOaAuthorId The author ID to filter by. + * @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 getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaAuthorId === null || rawOaAuthorId === undefined) { + throw new Error('Required parameter rawOaAuthorId was null or undefined when calling getEuProjectsForAuthor.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/author/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/eu`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get funding over time for bund projects. + * Returns the funding over time for bund projects associated with the specified institution. + * @endpoint get /api/projects/institution/bund/funding-over-time + * @param rawOaInstitutionId The institution ID to filter by. + * @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 getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { + throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionBundProjectsFundingOverTime.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + rawOaInstitutionId, 'raw_oa_institution_id'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/institution/bund/funding-over-time`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get funding over time for EU projects. + * Returns the funding over time for EU projects associated with the specified institution. + * @endpoint get /api/projects/institution/eu/funding-over-time + * @param rawOaInstitutionId The institution ID to filter by. + * @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 getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { + throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionCordisEuProjectsFundingOverTime.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + rawOaInstitutionId, 'raw_oa_institution_id'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/institution/eu/funding-over-time`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single BUND project. + * Returns a single BUND project based on its ID. + * @endpoint get /api/projects/bund/{id} + * @param id The ID of the BUND project to retrieve. + * @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 getSingleBundProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleBundProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleBundProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleBundProject(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getSingleBundProject.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/bund/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single DFG project. + * Returns a single DFG project based on its ID. + * @endpoint get /api/projects/dfg/{id} + * @param id The ID of the DFG project to retrieve. + * @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 getSingleDfgProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleDfgProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleDfgProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleDfgProject(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getSingleDfgProject.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/dfg/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single EU Cordis project. + * Returns a single EU Cordis project based on its ID. + * @endpoint get /api/projects/eu/{id} + * @param id The ID of the EU Cordis project to retrieve. + * @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 getSingleEuCordisProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleEuCordisProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleEuCordisProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleEuCordisProject(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getSingleEuCordisProject.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/eu/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get bund projects. + * Returns a page of bund projects based on the provided pagination parameters and optional institution filter. + * @endpoint post /api/projects/institution/bund/search + * @param projectsFilteringProperties + * @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 searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (projectsFilteringProperties === null || projectsFilteringProperties === undefined) { + throw new Error('Required parameter projectsFilteringProperties was null or undefined when calling searchBundProjects.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/institution/bund/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: projectsFilteringProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get EU projects. + * Returns a page of EU projects based on the provided pagination parameters and optional institution filter. + * @endpoint post /api/projects/institution/eu/search + * @param projectsFilteringProperties + * @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 searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (projectsFilteringProperties === null || projectsFilteringProperties === undefined) { + throw new Error('Required parameter projectsFilteringProperties was null or undefined when calling searchCordisEuProjects.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/institution/eu/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: projectsFilteringProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Search projects across all funders. + * Returns a page of projects across all funders based on the provided pagination parameters and optional institution filter. + * @endpoint get /api/projects/search + * @param page The page number. + * @param size The page size. + * @param selectedProjectTypes The set of project types to filter by (e.g., \'bund\', \'eu\', \'dfg\'). If not provided, projects of all types will be included. + * @param title The title to filter by. + * @param sortBy The field to sort by. + * @param sortDirection The sort direction (asc or desc). + * @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 searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + if (selectedProjectTypes) { + selectedProjectTypes.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'selected_project_types'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/projects/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index 82f38cbe..7521c08a 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -36,704 +30,371 @@ import { WorkPage } from '../model/workPage'; import { WorksListResponse } from '../model/worksListResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class WorksService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns all works for an author. - * @endpoint get /api/works/{author_id}/all - * @param authorId The author id, for example A5023888391. - * @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 getAllAuthorWorks( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAllAuthorWorks( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllAuthorWorks( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllAuthorWorks( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getAllAuthorWorks.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns all works for an author. + * @endpoint get /api/works/{author_id}/all + * @param authorId The author id, for example A5023888391. + * @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 getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/all`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - /** - * Returns a page of works for an author. - * @endpoint get /api/works/{author_id} - * @param authorId The author id, for example A5023888391. - * @param page The page number. - * @param size The page size. - * @param publicationYear Filter by publication year. Can be repeated. - * @param type Filter by publication type. Can be repeated. - * @param language Filter by language code. Can be repeated. - * @param institutionId Filter by OpenAlex institution id. Can be repeated. - * @param topicId Filter by OpenAlex topic id. Can be repeated. - * @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 getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getAuthorWorks.', - ); - } + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - if (publicationYear) { - publicationYear.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'publication_year', + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/all`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (type) { - type.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'type', + + /** + * Returns a page of works for an author. + * @endpoint get /api/works/{author_id} + * @param authorId The author id, for example A5023888391. + * @param page The page number. + * @param size The page size. + * @param publicationYear Filter by publication year. Can be repeated. + * @param type Filter by publication type. Can be repeated. + * @param language Filter by language code. Can be repeated. + * @param institutionId Filter by OpenAlex institution id. Can be repeated. + * @param topicId Filter by OpenAlex topic id. Can be repeated. + * @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 getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAuthorWorks.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + if (publicationYear) { + publicationYear.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'publication_year'); + }) + } + if (type) { + type.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'type'); + }) + } + if (language) { + language.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'language'); + }) + } + if (institutionId) { + institutionId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'institution_id'); + }) + } + if (topicId) { + topicId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic_id'); + }) + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (language) { - language.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'language', + + /** + * Returns work counts per primary topic for an author. + * @endpoint get /api/works/{author_id}/primary-topic-counts + * @param authorId The author id, for example A5023888391. + * @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 getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPrimaryTopicCountsByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/primary-topic-counts`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (institutionId) { - institutionId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'institution_id', + + /** + * Returns topics grouped by publication year for an author. + * @endpoint get /api/works/{author_id}/topics-by-time + * @param authorId The author id, for example A5023888391. + * @param maxTopicsPerYear The maximum number of topics per year. + * @param targetPublications Target number of publications used for the timeline. Complete years are always included. + * @param includeAll If true, all publications are used for the timeline. + * @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 getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + maxTopicsPerYear, 'max_topics_per_year'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + targetPublications, 'target_publications'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + includeAll, 'include_all'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/topics-by-time`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (topicId) { - topicId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic_id', + + /** + * 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(identifier: string, title?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getWork(identifier: string, title?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (identifier === null || identifier === undefined) { + throw new Error('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 + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns work counts per primary topic for an author. - * @endpoint get /api/works/{author_id}/primary-topic-counts - * @param authorId The author id, for example A5023888391. - * @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 getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPrimaryTopicCountsByAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/primary-topic-counts`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request>( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns topics grouped by publication year for an author. - * @endpoint get /api/works/{author_id}/topics-by-time - * @param authorId The author id, for example A5023888391. - * @param maxTopicsPerYear The maximum number of topics per year. - * @param targetPublications Target number of publications used for the timeline. Complete years are always included. - * @param includeAll If true, all publications are used for the timeline. - * @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 getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - maxTopicsPerYear, - 'max_topics_per_year', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - targetPublications, - 'target_publications', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - includeAll, - 'include_all', - ); - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/topics-by-time`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * 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( - identifier: string, - title?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getWork( - identifier: string, - title?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (identifier === null || identifier === undefined) { - throw new Error( - '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 - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } } diff --git a/webapp/src/app/api/configuration.ts b/webapp/src/app/api/configuration.ts index 664630b3..c39ce2d6 100644 --- a/webapp/src/app/api/configuration.ts +++ b/webapp/src/app/api/configuration.ts @@ -1,219 +1,193 @@ -import { - HttpHeaders, - HttpParams, - HttpParameterCodec, -} from '@angular/common/http'; +import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Override the default method for encoding path parameters in various + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam?: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials?: {[ key: string ]: string | (() => string | undefined)}; } export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Encoding of various path parameter + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor({ - accessToken, - apiKeys, - basePath, - credentials, - encodeParam, - encoder, - password, - username, - withCredentials, - }: ConfigurationParameters = {}) { - if (apiKeys) { - this.apiKeys = apiKeys; - } - if (username !== undefined) { - this.username = username; - } - if (password !== undefined) { - this.password = password; - } - if (accessToken !== undefined) { - this.accessToken = accessToken; - } - if (basePath !== undefined) { - this.basePath = basePath; - } - if (withCredentials !== undefined) { - this.withCredentials = withCredentials; - } - if (encoder) { - this.encoder = encoder; - } - this.encodeParam = - encodeParam ?? ((param) => this.defaultEncodeParam(param)); - this.credentials = credentials ?? {}; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; + } + if (username !== undefined) { + this.username = username; + } + if (password !== undefined) { + this.password = password; + } + if (accessToken !== undefined) { + this.accessToken = accessToken; + } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; - // init default bearer credential - if (!this.credentials['bearer']) { - this.credentials['bearer'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType(contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; + // init default bearer credential + if (!this.credentials['bearer']) { + this.credentials['bearer'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } } - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; + const type = contentTypes.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; } - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } + + const type = accepts.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; } - return type; - } - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp( - '^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', - 'i', - ); - return ( - mime !== null && - (jsonMime.test(mime) || - mime.toLowerCase() === 'application/json-patch+json') - ); - } + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' ? value() : value; - } + public lookupCredential(key: string): string | undefined { + const value = this.credentials[key]; + return typeof value === 'function' + ? value() + : value; + } - public addCredentialToHeaders( - credentialKey: string, - headerName: string, - headers: HttpHeaders, - prefix?: string, - ): HttpHeaders { - const value = this.lookupCredential(credentialKey); - return value ? headers.set(headerName, (prefix ?? '') + value) : headers; - } + public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders { + const value = this.lookupCredential(credentialKey); + return value + ? headers.set(headerName, (prefix ?? '') + value) + : headers; + } - public addCredentialToQuery( - credentialKey: string, - paramName: string, - query: HttpParams, - ): HttpParams { - const value = this.lookupCredential(credentialKey); - return value ? query.set(paramName, value) : query; - } + public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + const value = this.lookupCredential(credentialKey); + return value + ? query.set(paramName, value) + : query; + } - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! + private defaultEncodeParam(param: Param): string { + // This implementation exists as fallback for missing configuration + // and for backwards compatibility to older typescript-angular generator versions. + // It only works for the 'simple' parameter style. + // Date-handling only works for the 'date-time' format. + // All other styles and Date-formats are probably handled incorrectly. + // + // But: if that's all you need (i.e.: the most common use-case): no need for customization! - const value = - param.dataFormat === 'date-time' && param.value instanceof Date - ? (param.value as Date).toISOString() - : param.value; + const value = param.dataFormat === 'date-time' && param.value instanceof Date + ? (param.value as Date).toISOString() + : param.value; - return encodeURIComponent(String(value)); - } + return encodeURIComponent(String(value)); + } } diff --git a/webapp/src/app/api/encoder.ts b/webapp/src/app/api/encoder.ts index 889ef00d..138c4d5c 100644 --- a/webapp/src/app/api/encoder.ts +++ b/webapp/src/app/api/encoder.ts @@ -5,16 +5,16 @@ import { HttpParameterCodec } from '@angular/common/http'; * Workaround for https://github.com/angular/angular/issues/18261 */ export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } + encodeKey(k: string): string { + return encodeURIComponent(k); + } + encodeValue(v: string): string { + return encodeURIComponent(v); + } + decodeKey(k: string): string { + return decodeURIComponent(k); + } + decodeValue(v: string): string { + return decodeURIComponent(v); + } } diff --git a/webapp/src/app/api/model/accessGrant.ts b/webapp/src/app/api/model/accessGrant.ts index 0aa29f6f..ad1f537a 100644 --- a/webapp/src/app/api/model/accessGrant.ts +++ b/webapp/src/app/api/model/accessGrant.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,10 +9,12 @@ */ import { AuthScope } from './authScope'; -export interface AccessGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; - refresh_token: string; + +export interface AccessGrant { + token_type: string; + access_token: string; + expires_in: number; + scope: AuthScope; + refresh_token: string; } + diff --git a/webapp/src/app/api/model/authAccount.ts b/webapp/src/app/api/model/authAccount.ts index 7a672b04..770a61f5 100644 --- a/webapp/src/app/api/model/authAccount.ts +++ b/webapp/src/app/api/model/authAccount.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface AuthAccount { - i: number; - l: string; - o: number; - e: string; - on: string; + +export interface AuthAccount { + i: number; + l: string; + o: number; + e: string; + on: string; } + diff --git a/webapp/src/app/api/model/authScope.ts b/webapp/src/app/api/model/authScope.ts index 3ccd752e..65ffa9b5 100644 --- a/webapp/src/app/api/model/authScope.ts +++ b/webapp/src/app/api/model/authScope.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { AuthAccount } from './authAccount'; -export interface AuthScope { - t: string; - a: AuthAccount; - d?: number | null; - r?: Array; + +export interface AuthScope { + t: string; + a: AuthAccount; + d?: number | null; + r?: Array; } + diff --git a/webapp/src/app/api/model/author.ts b/webapp/src/app/api/model/author.ts index 0a050590..9ba12273 100644 --- a/webapp/src/app/api/model/author.ts +++ b/webapp/src/app/api/model/author.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -15,25 +15,27 @@ import { AuthorIds } from './authorIds'; import { AuthorSummaryStats } from './authorSummaryStats'; import { WorkTopic } from './workTopic'; + /** * A person who creates scholarly works */ -export interface Author { - id?: string | null; - orcid?: string | null; - display_name?: string | null; - display_name_alternatives?: Array | null; - longest_name?: string | null; - parsed_longest_name?: AuthorParsedLongestName | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - affiliations?: Array | null; - last_known_institutions?: Array | null; - topics?: Array | null; - counts_by_year?: Array | null; - ids?: AuthorIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Author { + id?: string | null; + orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | null; + longest_name?: string | null; + parsed_longest_name?: AuthorParsedLongestName | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + affiliations?: Array | null; + last_known_institutions?: Array | null; + topics?: Array | null; + counts_by_year?: Array | null; + ids?: AuthorIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/authorAffiliationsInner.ts b/webapp/src/app/api/model/authorAffiliationsInner.ts index d1e8f764..270443ff 100644 --- a/webapp/src/app/api/model/authorAffiliationsInner.ts +++ b/webapp/src/app/api/model/authorAffiliationsInner.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,10 +9,12 @@ */ import { DehydratedInstitution } from './dehydratedInstitution'; + /** * AuthorAffiliationsInner */ -export interface AuthorAffiliationsInner { - institution?: DehydratedInstitution | null; - years?: Array | null; +export interface AuthorAffiliationsInner { + institution?: DehydratedInstitution | null; + years?: Array | null; } + diff --git a/webapp/src/app/api/model/authorCountsByYearInner.ts b/webapp/src/app/api/model/authorCountsByYearInner.ts index 1fac5b45..d16c7c21 100644 --- a/webapp/src/app/api/model/authorCountsByYearInner.ts +++ b/webapp/src/app/api/model/authorCountsByYearInner.ts @@ -1,18 +1,20 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * AuthorCountsByYearInner */ -export interface AuthorCountsByYearInner { - year?: number | null; - works_count?: number | null; - cited_by_count?: number | null; +export interface AuthorCountsByYearInner { + year?: number | null; + works_count?: number | null; + cited_by_count?: number | null; } + diff --git a/webapp/src/app/api/model/authorIds.ts b/webapp/src/app/api/model/authorIds.ts index 0b079d33..9235a207 100644 --- a/webapp/src/app/api/model/authorIds.ts +++ b/webapp/src/app/api/model/authorIds.ts @@ -1,18 +1,20 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * External identifiers: */ -export interface AuthorIds { - openalex?: string | null; - orcid?: string | null; - scopus?: string | null; +export interface AuthorIds { + openalex?: string | null; + orcid?: string | null; + scopus?: string | null; } + diff --git a/webapp/src/app/api/model/authorNetworkNode.ts b/webapp/src/app/api/model/authorNetworkNode.ts index f67c7148..aee98d47 100644 --- a/webapp/src/app/api/model/authorNetworkNode.ts +++ b/webapp/src/app/api/model/authorNetworkNode.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,22 @@ */ import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface AuthorNetworkNode { - /** - * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. - */ - raw_id: string; - /** - * The display name of the node. - */ - display_name: string; - /** - * The category of the node, either \'author\', \'institution\', or \'work\'. - */ - category: CollaborationNetworkNodeType; + +export interface AuthorNetworkNode { + /** + * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. + */ + raw_id: string; + /** + * The display name of the node. + */ + display_name: string; + /** + * The category of the node, either \'author\', \'institution\', or \'work\'. + */ + category: CollaborationNetworkNodeType; } -export namespace AuthorNetworkNode {} +export namespace AuthorNetworkNode { +} + + diff --git a/webapp/src/app/api/model/authorParsedLongestName.ts b/webapp/src/app/api/model/authorParsedLongestName.ts index f08df27d..f49e04be 100644 --- a/webapp/src/app/api/model/authorParsedLongestName.ts +++ b/webapp/src/app/api/model/authorParsedLongestName.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The longest name parsed into its component parts. */ -export interface AuthorParsedLongestName { - first?: string | null; - middle?: string | null; - last?: string | null; - suffix?: string | null; - nickname?: string | null; +export interface AuthorParsedLongestName { + first?: string | null; + middle?: string | null; + last?: string | null; + suffix?: string | null; + nickname?: string | null; } + diff --git a/webapp/src/app/api/model/authorPositionCount.ts b/webapp/src/app/api/model/authorPositionCount.ts index 989d2c18..a02e3749 100644 --- a/webapp/src/app/api/model/authorPositionCount.ts +++ b/webapp/src/app/api/model/authorPositionCount.ts @@ -1,16 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface AuthorPositionCount { - first?: number; - middle?: number; - last?: number; - unknown?: number; + +export interface AuthorPositionCount { + first?: number; + middle?: number; + last?: number; + unknown?: number; } + diff --git a/webapp/src/app/api/model/authorSummaryStats.ts b/webapp/src/app/api/model/authorSummaryStats.ts index 63c35c31..1cfc0bdb 100644 --- a/webapp/src/app/api/model/authorSummaryStats.ts +++ b/webapp/src/app/api/model/authorSummaryStats.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,11 +9,13 @@ */ import { Model2YrMeanCitedness } from './model2YrMeanCitedness'; + /** * Citation metrics: */ -export interface AuthorSummaryStats { - '2yr_mean_citedness'?: Model2YrMeanCitedness | null; - h_index?: number | null; - i10_index?: number | null; +export interface AuthorSummaryStats { + '2yr_mean_citedness'?: Model2YrMeanCitedness | null; + h_index?: number | null; + i10_index?: number | null; } + diff --git a/webapp/src/app/api/model/authorsFilterProperties.ts b/webapp/src/app/api/model/authorsFilterProperties.ts index 50795f2a..7312558f 100644 --- a/webapp/src/app/api/model/authorsFilterProperties.ts +++ b/webapp/src/app/api/model/authorsFilterProperties.ts @@ -1,24 +1,26 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface AuthorsFilterProperties { - /** - * The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included. - */ - allowed_institutions?: Array; - /** - * The minimum number of collaborations required for an author to be included in the collaboration network. - */ - min_collaborations?: number; - /** - * The maximum number of collaborations allowed for an author to be included in the collaboration network. - */ - max_collaborations?: number; + +export interface AuthorsFilterProperties { + /** + * The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included. + */ + allowed_institutions?: Array; + /** + * The minimum number of collaborations required for an author to be included in the collaboration network. + */ + min_collaborations?: number; + /** + * The maximum number of collaborations allowed for an author to be included in the collaboration network. + */ + max_collaborations?: number; } + diff --git a/webapp/src/app/api/model/authorsListResponse.ts b/webapp/src/app/api/model/authorsListResponse.ts index bb1a602c..d309ae43 100644 --- a/webapp/src/app/api/model/authorsListResponse.ts +++ b/webapp/src/app/api/model/authorsListResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,11 +11,13 @@ import { Meta } from './meta'; import { Author } from './author'; import { GroupByResult } from './groupByResult'; + /** * AuthorsListResponse */ -export interface AuthorsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface AuthorsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/authorship.ts b/webapp/src/app/api/model/authorship.ts index f1b9d48e..db3a0bf0 100644 --- a/webapp/src/app/api/model/authorship.ts +++ b/webapp/src/app/api/model/authorship.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,15 +10,17 @@ import { DehydratedInstitution } from './dehydratedInstitution'; import { DehydratedAuthor } from './dehydratedAuthor'; + /** * Author and their affiliation for a work */ -export interface Authorship { - author_position?: string | null; - author?: DehydratedAuthor | null; - institutions?: Array | null; - countries?: Array | null; - is_corresponding?: boolean | null; - raw_author_name?: string | null; - raw_affiliation_strings?: Array | null; +export interface Authorship { + author_position?: string | null; + author?: DehydratedAuthor | null; + institutions?: Array | null; + countries?: Array | null; + is_corresponding?: boolean | null; + raw_author_name?: string | null; + raw_affiliation_strings?: Array | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponse.ts b/webapp/src/app/api/model/autocompleteResponse.ts index 8b52b300..e220f57b 100644 --- a/webapp/src/app/api/model/autocompleteResponse.ts +++ b/webapp/src/app/api/model/autocompleteResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,10 +10,12 @@ import { AutocompleteResponseMeta } from './autocompleteResponseMeta'; import { AutocompleteResponseResultsInner } from './autocompleteResponseResultsInner'; + /** * AutocompleteResponse */ -export interface AutocompleteResponse { - meta?: AutocompleteResponseMeta | null; - results?: Array | null; +export interface AutocompleteResponse { + meta?: AutocompleteResponseMeta | null; + results?: Array | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponseMeta.ts b/webapp/src/app/api/model/autocompleteResponseMeta.ts index 5bf94a57..2e080d39 100644 --- a/webapp/src/app/api/model/autocompleteResponseMeta.ts +++ b/webapp/src/app/api/model/autocompleteResponseMeta.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * AutocompleteResponseMeta */ -export interface AutocompleteResponseMeta { - count?: number | null; - db_response_time_ms?: number | null; +export interface AutocompleteResponseMeta { + count?: number | null; + db_response_time_ms?: number | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponseResultsInner.ts b/webapp/src/app/api/model/autocompleteResponseResultsInner.ts index 0fa956b7..99ba71fe 100644 --- a/webapp/src/app/api/model/autocompleteResponseResultsInner.ts +++ b/webapp/src/app/api/model/autocompleteResponseResultsInner.ts @@ -1,22 +1,24 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * AutocompleteResponseResultsInner */ -export interface AutocompleteResponseResultsInner { - id?: string | null; - display_name?: string | null; - hint?: string | null; - cited_by_count?: number | null; - works_count?: number | null; - entity_type?: string | null; - external_id?: string | null; +export interface AutocompleteResponseResultsInner { + id?: string | null; + display_name?: string | null; + hint?: string | null; + cited_by_count?: number | null; + works_count?: number | null; + entity_type?: string | null; + external_id?: string | null; } + diff --git a/webapp/src/app/api/model/award.ts b/webapp/src/app/api/model/award.ts index a461c971..4e3b5cc9 100644 --- a/webapp/src/app/api/model/award.ts +++ b/webapp/src/app/api/model/award.ts @@ -1,21 +1,23 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Award */ -export interface Award { - id?: string | null; - display_name?: string | null; - funder_award_id?: string | null; - funder_id?: string | null; - funder_display_name?: string | null; - doi?: string | null; +export interface Award { + id?: string | null; + display_name?: string | null; + funder_award_id?: string | null; + funder_id?: string | null; + funder_display_name?: string | null; + doi?: string | null; } + diff --git a/webapp/src/app/api/model/bodyCreateUser.ts b/webapp/src/app/api/model/bodyCreateUser.ts index 6a0778be..76caab3b 100644 --- a/webapp/src/app/api/model/bodyCreateUser.ts +++ b/webapp/src/app/api/model/bodyCreateUser.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface BodyCreateUser { - username: string; - password: string; - email: string; - institution: string; - superadmin?: boolean; + +export interface BodyCreateUser { + username: string; + password: string; + email: string; + institution: string; + superadmin?: boolean; } + diff --git a/webapp/src/app/api/model/bundProject.ts b/webapp/src/app/api/model/bundProject.ts index 9f291399..3463aa78 100644 --- a/webapp/src/app/api/model/bundProject.ts +++ b/webapp/src/app/api/model/bundProject.ts @@ -1,40 +1,42 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface BundProject { - funding_code?: string | null; - department?: string | null; - department_fullname?: string | null; - referat?: string | null; - project_sponsor?: string | null; - project_sponsor_fullname?: string | null; - work_unit?: string | null; - recipient?: string | null; - municipal_code?: string | null; - municipality?: string | null; - place?: string | null; - state?: string | null; - country?: string | null; - implementing_agency?: string | null; - topic?: string | null; - performance_plan_system?: string | null; - performance_plan_system_text?: string | null; - funding_start?: string | null; - funding_end?: string | null; - grant_amount?: number | null; - funding_profile?: string | null; - joint_project?: string | null; - funding_type?: string | null; - publication_date?: string | null; - unix_timestamp?: number | null; - date?: string | null; - new?: boolean | null; - duration?: string | null; + +export interface BundProject { + funding_code?: string | null; + department?: string | null; + department_fullname?: string | null; + referat?: string | null; + project_sponsor?: string | null; + project_sponsor_fullname?: string | null; + work_unit?: string | null; + recipient?: string | null; + municipal_code?: string | null; + municipality?: string | null; + place?: string | null; + state?: string | null; + country?: string | null; + implementing_agency?: string | null; + topic?: string | null; + performance_plan_system?: string | null; + performance_plan_system_text?: string | null; + funding_start?: string | null; + funding_end?: string | null; + grant_amount?: number | null; + funding_profile?: string | null; + joint_project?: string | null; + funding_type?: string | null; + publication_date?: string | null; + unix_timestamp?: number | null; + date?: string | null; + 'new'?: boolean | null; + duration?: string | null; } + diff --git a/webapp/src/app/api/model/bundProjectDetails.ts b/webapp/src/app/api/model/bundProjectDetails.ts index b61df06b..2193563c 100644 --- a/webapp/src/app/api/model/bundProjectDetails.ts +++ b/webapp/src/app/api/model/bundProjectDetails.ts @@ -1,55 +1,57 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types. */ -export interface BundProjectDetails { - /** - * The ID of the Bund project - */ - id: string; - funding_reference?: string | null; - title?: string | null; - description?: string | null; - joint_project?: string | null; - funding_type?: string | null; - funding_profile?: string | null; - funding_amount?: number | null; - funding_start_date?: string | null; - funding_end_date?: string | null; - duration?: string | null; - performance_plan_code?: string | null; - performance_plan_fullname?: string | null; - executing_agency?: string | null; - funding_recipient?: string | null; - project_agency?: string | null; - project_agency_fullname?: string | null; - department?: string | null; - department_fullname?: string | null; - division?: string | null; - location?: string | null; - municipality?: string | null; - state?: string | null; - country?: string | null; - municipality_code?: string | null; - publication_date?: string | null; - is_new?: boolean | null; - record_date?: string | null; - unix_timestamp?: number | null; - /** - * All persons associated with the Bund project (from nested Arb object) - */ - associated_persons?: Array; - /** - * All institutions associated with the Bund project - */ - institutions?: Array; +export interface BundProjectDetails { + /** + * The ID of the Bund project + */ + id: string; + funding_reference?: string | null; + title?: string | null; + description?: string | null; + joint_project?: string | null; + funding_type?: string | null; + funding_profile?: string | null; + funding_amount?: number | null; + funding_start_date?: string | null; + funding_end_date?: string | null; + duration?: string | null; + performance_plan_code?: string | null; + performance_plan_fullname?: string | null; + executing_agency?: string | null; + funding_recipient?: string | null; + project_agency?: string | null; + project_agency_fullname?: string | null; + department?: string | null; + department_fullname?: string | null; + division?: string | null; + location?: string | null; + municipality?: string | null; + state?: string | null; + country?: string | null; + municipality_code?: string | null; + publication_date?: string | null; + is_new?: boolean | null; + record_date?: string | null; + unix_timestamp?: number | null; + /** + * All persons associated with the Bund project (from nested Arb object) + */ + associated_persons?: Array; + /** + * All institutions associated with the Bund project + */ + institutions?: Array; } + diff --git a/webapp/src/app/api/model/bundProjectPage.ts b/webapp/src/app/api/model/bundProjectPage.ts index 6c38e7a6..10514bce 100644 --- a/webapp/src/app/api/model/bundProjectPage.ts +++ b/webapp/src/app/api/model/bundProjectPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { BundProject } from './bundProject'; -export interface BundProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The bund projects on this page. - */ - elements?: Array; + +export interface BundProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The bund projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/careerMetrics.ts b/webapp/src/app/api/model/careerMetrics.ts index eb84c19f..abb58689 100644 --- a/webapp/src/app/api/model/careerMetrics.ts +++ b/webapp/src/app/api/model/careerMetrics.ts @@ -1,32 +1,34 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface CareerMetrics { - first_publication_year?: number | null; - last_publication_year?: number | null; - career_age?: number | null; - career_span?: number | null; - career_stage?: string | null; - /** - * Number of distinct years with at least one publication. - */ - active_years?: number; - /** - * Number of publications used for career metrics. - */ - publication_count?: number; - publications_per_active_year?: number | null; - publications_per_career_year?: number | null; - years_since_last_publication?: number | null; - /** - * True if publication years look suspicious. - */ - has_suspicious_publication_years?: boolean; + +export interface CareerMetrics { + first_publication_year?: number | null; + last_publication_year?: number | null; + career_age?: number | null; + career_span?: number | null; + career_stage?: string | null; + /** + * Number of distinct years with at least one publication. + */ + active_years?: number; + /** + * Number of publications used for career metrics. + */ + publication_count?: number; + publications_per_active_year?: number | null; + publications_per_career_year?: number | null; + years_since_last_publication?: number | null; + /** + * True if publication years look suspicious. + */ + has_suspicious_publication_years?: boolean; } + diff --git a/webapp/src/app/api/model/collaborationNetwork.ts b/webapp/src/app/api/model/collaborationNetwork.ts index a2fbdc5b..e439c061 100644 --- a/webapp/src/app/api/model/collaborationNetwork.ts +++ b/webapp/src/app/api/model/collaborationNetwork.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -13,29 +13,31 @@ import { CollaborationNetworkEdge } from './collaborationNetworkEdge'; import { InstitutionNetworkNode } from './institutionNetworkNode'; import { AuthorNetworkNode } from './authorNetworkNode'; -export interface CollaborationNetwork { - /** - * The raw person ID of the person whose collaboration network this is. - */ - raw_person_id: string; - /** - * The work nodes in the collaboration network. - */ - work_nodes: Array; - /** - * The author nodes in the collaboration network. - */ - author_nodes: Array; - /** - * The institution nodes in the collaboration network. - */ - institution_nodes: Array; - /** - * The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I - */ - collaboration_edges: Array; - /** - * The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network. - */ - filter_information: FilterInformation; + +export interface CollaborationNetwork { + /** + * The raw person ID of the person whose collaboration network this is. + */ + raw_person_id: string; + /** + * The work nodes in the collaboration network. + */ + work_nodes: Array; + /** + * The author nodes in the collaboration network. + */ + author_nodes: Array; + /** + * The institution nodes in the collaboration network. + */ + institution_nodes: Array; + /** + * The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I + */ + collaboration_edges: Array; + /** + * The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network. + */ + filter_information: FilterInformation; } + diff --git a/webapp/src/app/api/model/collaborationNetworkEdge.ts b/webapp/src/app/api/model/collaborationNetworkEdge.ts index baffb178..16fb5fc6 100644 --- a/webapp/src/app/api/model/collaborationNetworkEdge.ts +++ b/webapp/src/app/api/model/collaborationNetworkEdge.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface CollaborationNetworkEdge { - /** - * The raw ID of the source node. - */ - raw_source_id: string; - /** - * The raw ID of the target node. - */ - raw_target_id: string; + +export interface CollaborationNetworkEdge { + /** + * The raw ID of the source node. + */ + raw_source_id: string; + /** + * The raw ID of the target node. + */ + raw_target_id: string; } + diff --git a/webapp/src/app/api/model/collaborationNetworkNodeType.ts b/webapp/src/app/api/model/collaborationNetworkNodeType.ts index 3e673f35..752e35b0 100644 --- a/webapp/src/app/api/model/collaborationNetworkNodeType.ts +++ b/webapp/src/app/api/model/collaborationNetworkNodeType.ts @@ -1,17 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + export const CollaborationNetworkNodeType = { - Author: 'author', - Institution: 'institution', - Work: 'work', + Author: 'author', + Institution: 'institution', + Work: 'work' } as const; -export type CollaborationNetworkNodeType = - (typeof CollaborationNetworkNodeType)[keyof typeof CollaborationNetworkNodeType]; +export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType]; + diff --git a/webapp/src/app/api/model/companyConnection.ts b/webapp/src/app/api/model/companyConnection.ts index 2824c543..4ce31814 100644 --- a/webapp/src/app/api/model/companyConnection.ts +++ b/webapp/src/app/api/model/companyConnection.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,17 +9,19 @@ */ import { MatchedOfficer } from './matchedOfficer'; -export interface CompanyConnection { - company_number?: string | null; - company_name?: string | null; - company_status?: string | null; - register_art?: string | null; - register_nummer?: string | null; - native_company_number?: string | null; - registrar?: string | null; - registered_office?: string | null; - registered_address?: string | null; - retrieved_at?: string | null; - matched_officers?: Array; - officers?: Array; + +export interface CompanyConnection { + company_number?: string | null; + company_name?: string | null; + company_status?: string | null; + register_art?: string | null; + register_nummer?: string | null; + native_company_number?: string | null; + registrar?: string | null; + registered_office?: string | null; + registered_address?: string | null; + retrieved_at?: string | null; + matched_officers?: Array; + officers?: Array; } + diff --git a/webapp/src/app/api/model/companyConnectionsResponse.ts b/webapp/src/app/api/model/companyConnectionsResponse.ts index f4f5f42f..9beabd1e 100644 --- a/webapp/src/app/api/model/companyConnectionsResponse.ts +++ b/webapp/src/app/api/model/companyConnectionsResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,15 +9,17 @@ */ import { CompanyConnection } from './companyConnection'; -export interface CompanyConnectionsResponse { - author_id: string; - display_name?: string | null; - is_ude_author: boolean; - institution_scope?: string | null; - matching_institutions?: Array; - matching_method?: string | null; - company_count: number; - has_more_results: boolean; - common_name_warning: boolean; - connections?: Array; + +export interface CompanyConnectionsResponse { + author_id: string; + display_name?: string | null; + is_ude_author: boolean; + institution_scope?: string | null; + matching_institutions?: Array; + matching_method?: string | null; + company_count: number; + has_more_results: boolean; + common_name_warning: boolean; + connections?: Array; } + diff --git a/webapp/src/app/api/model/cordisEuProject.ts b/webapp/src/app/api/model/cordisEuProject.ts index 8d408ad6..f18dd3d4 100644 --- a/webapp/src/app/api/model/cordisEuProject.ts +++ b/webapp/src/app/api/model/cordisEuProject.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,30 +10,32 @@ import { Keywords } from './keywords'; import { Topics } from './topics'; -export interface CordisEuProject { - /** - * Unique identifier for the project, typically the CORDIS ID - */ - id: string; - rcn?: string | null; - acronym?: string | null; - title?: string | null; - objective?: string | null; - frameworkProgramme?: string | null; - fundingScheme?: string | null; - legalBasis?: string | null; - masterCall?: string | null; - subCall?: string | null; - topics?: Topics | null; - nature?: string | null; - status?: string | null; - ecMaxContribution?: number | null; - totalCost?: number | null; - startDate?: string | null; - endDate?: string | null; - ecSignatureDate?: string | null; - contentUpdateDate?: string | null; - grantDoi?: string | null; - humanValidated?: boolean | null; - keywords?: Keywords | null; + +export interface CordisEuProject { + /** + * Unique identifier for the project, typically the CORDIS ID + */ + id: string; + rcn?: string | null; + acronym?: string | null; + title?: string | null; + objective?: string | null; + frameworkProgramme?: string | null; + fundingScheme?: string | null; + legalBasis?: string | null; + masterCall?: string | null; + subCall?: string | null; + topics?: Topics | null; + nature?: string | null; + status?: string | null; + ecMaxContribution?: number | null; + totalCost?: number | null; + startDate?: string | null; + endDate?: string | null; + ecSignatureDate?: string | null; + contentUpdateDate?: string | null; + grantDoi?: string | null; + humanValidated?: boolean | null; + keywords?: Keywords | null; } + diff --git a/webapp/src/app/api/model/cordisEuProjectPage.ts b/webapp/src/app/api/model/cordisEuProjectPage.ts index 8dc900f7..393f6db8 100644 --- a/webapp/src/app/api/model/cordisEuProjectPage.ts +++ b/webapp/src/app/api/model/cordisEuProjectPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { CordisEuProject } from './cordisEuProject'; -export interface CordisEuProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The CORDIS EU projects on this page. - */ - elements?: Array; + +export interface CordisEuProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The CORDIS EU projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/costUsd.ts b/webapp/src/app/api/model/costUsd.ts index 494cb094..c7bcbee8 100644 --- a/webapp/src/app/api/model/costUsd.ts +++ b/webapp/src/app/api/model/costUsd.ts @@ -1,14 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Cost of this request in USD */ -export interface CostUsd {} +export interface CostUsd { +} + diff --git a/webapp/src/app/api/model/customAuthor.ts b/webapp/src/app/api/model/customAuthor.ts index 6fd54c51..0cf7eb21 100644 --- a/webapp/src/app/api/model/customAuthor.ts +++ b/webapp/src/app/api/model/customAuthor.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -16,24 +16,26 @@ import { AuthorIds } from './authorIds'; import { AuthorSummaryStats } from './authorSummaryStats'; import { WorkTopic } from './workTopic'; -export interface CustomAuthor { - id?: string | null; - orcid?: string | null; - display_name?: string | null; - display_name_alternatives?: Array | null; - longest_name?: string | null; - parsed_longest_name?: AuthorParsedLongestName | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - affiliations?: Array | null; - last_known_institutions?: Array | null; - topics?: Array | null; - counts_by_year?: Array | null; - ids?: AuthorIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; - relevance_rating?: string | null; - career_metrics?: CareerMetrics | null; + +export interface CustomAuthor { + id?: string | null; + orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | null; + longest_name?: string | null; + parsed_longest_name?: AuthorParsedLongestName | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + affiliations?: Array | null; + last_known_institutions?: Array | null; + topics?: Array | null; + counts_by_year?: Array | null; + ids?: AuthorIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; + relevance_rating?: string | null; + career_metrics?: CareerMetrics | null; } + diff --git a/webapp/src/app/api/model/customAuthorsListResponse.ts b/webapp/src/app/api/model/customAuthorsListResponse.ts index 71f691a2..3c80ddf5 100644 --- a/webapp/src/app/api/model/customAuthorsListResponse.ts +++ b/webapp/src/app/api/model/customAuthorsListResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,9 +11,11 @@ import { Meta } from './meta'; import { CustomAuthor } from './customAuthor'; import { GroupByResult } from './groupByResult'; -export interface CustomAuthorsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; - placeholder?: CustomAuthor | null; + +export interface CustomAuthorsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; + placeholder?: CustomAuthor | null; } + diff --git a/webapp/src/app/api/model/dehydratedAuthor.ts b/webapp/src/app/api/model/dehydratedAuthor.ts index 350718ef..4d3817f1 100644 --- a/webapp/src/app/api/model/dehydratedAuthor.ts +++ b/webapp/src/app/api/model/dehydratedAuthor.ts @@ -1,18 +1,20 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * [Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts */ -export interface DehydratedAuthor { - id?: string | null; - display_name?: string | null; - orcid?: string | null; +export interface DehydratedAuthor { + id?: string | null; + display_name?: string | null; + orcid?: string | null; } + diff --git a/webapp/src/app/api/model/dehydratedFunder.ts b/webapp/src/app/api/model/dehydratedFunder.ts index c4231c13..b134bbb1 100644 --- a/webapp/src/app/api/model/dehydratedFunder.ts +++ b/webapp/src/app/api/model/dehydratedFunder.ts @@ -1,18 +1,20 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * [Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts */ -export interface DehydratedFunder { - id?: string | null; - display_name?: string | null; - ror?: string | null; +export interface DehydratedFunder { + id?: string | null; + display_name?: string | null; + ror?: string | null; } + diff --git a/webapp/src/app/api/model/dehydratedInstitution.ts b/webapp/src/app/api/model/dehydratedInstitution.ts index 956fc03e..7b6c9824 100644 --- a/webapp/src/app/api/model/dehydratedInstitution.ts +++ b/webapp/src/app/api/model/dehydratedInstitution.ts @@ -1,21 +1,23 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * [Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts */ -export interface DehydratedInstitution { - id?: string | null; - display_name?: string | null; - ror?: string | null; - country_code?: string | null; - type?: string | null; - lineage?: Array | null; +export interface DehydratedInstitution { + id?: string | null; + display_name?: string | null; + ror?: string | null; + country_code?: string | null; + type?: string | null; + lineage?: Array | null; } + diff --git a/webapp/src/app/api/model/dehydratedSource.ts b/webapp/src/app/api/model/dehydratedSource.ts index b672b5dd..ae714846 100644 --- a/webapp/src/app/api/model/dehydratedSource.ts +++ b/webapp/src/app/api/model/dehydratedSource.ts @@ -1,26 +1,28 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * [Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts */ -export interface DehydratedSource { - id?: string | null; - display_name?: string | null; - issn_l?: string | null; - issn?: Array | null; - is_oa?: boolean | null; - is_in_doaj?: boolean | null; - is_core?: boolean | null; - host_organization?: string | null; - host_organization_name?: string | null; - host_organization_lineage?: Array | null; - type?: string | null; +export interface DehydratedSource { + id?: string | null; + display_name?: string | null; + issn_l?: string | null; + issn?: Array | null; + is_oa?: boolean | null; + is_in_doaj?: boolean | null; + is_core?: boolean | null; + host_organization?: string | null; + host_organization_name?: string | null; + host_organization_lineage?: Array | null; + type?: string | null; } + diff --git a/webapp/src/app/api/model/dfgProjectDetails.ts b/webapp/src/app/api/model/dfgProjectDetails.ts index 58ece5f7..5fe29ff9 100644 --- a/webapp/src/app/api/model/dfgProjectDetails.ts +++ b/webapp/src/app/api/model/dfgProjectDetails.ts @@ -1,39 +1,41 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Clean summary model for a DFG project, consolidating all person roles and institution references into unified lists. */ -export interface DfgProjectDetails { - /** - * The ID of the DFG project - */ - id: string; - link?: string | null; - title?: string | null; - description?: string | null; - project_identifier?: string | null; - funding_start_date?: string | null; - funding_end_date?: string | null; - dfg_procedure?: string | null; - subject_area?: string | null; - funding_type?: string | null; - international_reference?: string | null; - website?: string | null; - /** - * All persons associated with the DFG project (any role) - */ - associated_persons?: Array; - /** - * All institutions associated with the DFG project - */ - institutions?: Array; - subproject_of?: string | null; +export interface DfgProjectDetails { + /** + * The ID of the DFG project + */ + id: string; + link?: string | null; + title?: string | null; + description?: string | null; + project_identifier?: string | null; + funding_start_date?: string | null; + funding_end_date?: string | null; + dfg_procedure?: string | null; + subject_area?: string | null; + funding_type?: string | null; + international_reference?: string | null; + website?: string | null; + /** + * All persons associated with the DFG project (any role) + */ + associated_persons?: Array; + /** + * All institutions associated with the DFG project + */ + institutions?: Array; + subproject_of?: string | null; } + diff --git a/webapp/src/app/api/model/dfgProjectPage.ts b/webapp/src/app/api/model/dfgProjectPage.ts index a05d81d2..8f67e170 100644 --- a/webapp/src/app/api/model/dfgProjectPage.ts +++ b/webapp/src/app/api/model/dfgProjectPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { DfgProjectSummary } from './dfgProjectSummary'; -export interface DfgProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The DFG projects on this page. - */ - elements?: Array; + +export interface DfgProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The DFG projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/dfgProjectSummary.ts b/webapp/src/app/api/model/dfgProjectSummary.ts index 10c05a08..145dba4a 100644 --- a/webapp/src/app/api/model/dfgProjectSummary.ts +++ b/webapp/src/app/api/model/dfgProjectSummary.ts @@ -1,25 +1,27 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface DfgProjectSummary { - /** - * The unique identifier of the DFG project. - */ - id: string; - link?: string | null; - title?: string | null; - professional_classification?: string | null; - funding_start?: string | null; - funding_end?: string | null; - /** - * The names of the researchers involved in the DFG project. - */ - names?: Array; + +export interface DfgProjectSummary { + /** + * The unique identifier of the DFG project. + */ + id: string; + link?: string | null; + title?: string | null; + professional_classification?: string | null; + funding_start?: string | null; + funding_end?: string | null; + /** + * The names of the researchers involved in the DFG project. + */ + names?: Array; } + diff --git a/webapp/src/app/api/model/euOrganizationProjectSummary.ts b/webapp/src/app/api/model/euOrganizationProjectSummary.ts index af085ff3..3cc10f0a 100644 --- a/webapp/src/app/api/model/euOrganizationProjectSummary.ts +++ b/webapp/src/app/api/model/euOrganizationProjectSummary.ts @@ -1,25 +1,27 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface EuOrganizationProjectSummary { - /** - * The unique identifier of the organization. - */ - organization_id: string; - /** - * The unique identifier of the project. - */ - project_id: string; - title?: string | null; - start_date?: string | null; - end_date?: string | null; - acronym?: string | null; - ec_contribution?: number | null; + +export interface EuOrganizationProjectSummary { + /** + * The unique identifier of the organization. + */ + organization_id: string; + /** + * The unique identifier of the project. + */ + project_id: string; + title?: string | null; + start_date?: string | null; + end_date?: string | null; + acronym?: string | null; + ec_contribution?: number | null; } + diff --git a/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts b/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts index 90166a7e..9d57d5b4 100644 --- a/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts +++ b/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { EuOrganizationProjectSummary } from './euOrganizationProjectSummary'; -export interface EuOrganizationProjectSummaryPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The organization project summaries on this page. - */ - elements?: Array; + +export interface EuOrganizationProjectSummaryPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The organization project summaries on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/filterInformation.ts b/webapp/src/app/api/model/filterInformation.ts index 1c4af66d..b2078376 100644 --- a/webapp/src/app/api/model/filterInformation.ts +++ b/webapp/src/app/api/model/filterInformation.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,21 +10,23 @@ import { InstitutionInformation } from './institutionInformation'; import { WorkTopicInformation } from './workTopicInformation'; -export interface FilterInformation { - /** - * The minimum publication year of the works in the collaboration network. - */ - min_possible_year: number; - /** - * The maximum publication year of the works in the collaboration network. - */ - max_possible_year: number; - /** - * The list of institutions associated with the works in the collaboration network. - */ - institutions: Array; - /** - * The list of topics associated with the works in the collaboration network. - */ - topics: Array; + +export interface FilterInformation { + /** + * The minimum publication year of the works in the collaboration network. + */ + min_possible_year: number; + /** + * The maximum publication year of the works in the collaboration network. + */ + max_possible_year: number; + /** + * The list of institutions associated with the works in the collaboration network. + */ + institutions: Array; + /** + * The list of topics associated with the works in the collaboration network. + */ + topics: Array; } + diff --git a/webapp/src/app/api/model/filterProperties.ts b/webapp/src/app/api/model/filterProperties.ts index 7caac0b6..608acab4 100644 --- a/webapp/src/app/api/model/filterProperties.ts +++ b/webapp/src/app/api/model/filterProperties.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,11 +10,13 @@ import { WorksFilterProperties } from './worksFilterProperties'; import { AuthorsFilterProperties } from './authorsFilterProperties'; -export interface FilterProperties { - /** - * The type of filter to apply when generating the collaboration network. Can be either \'works\' or \'authors\'. If \'works\', the filter properties in the \'works_filter_properties\' field will be used. If \'authors\', the filter properties in the \'authors_filter_properties\' field will be used. - */ - filter_by?: string; - works_filter_properties: WorksFilterProperties | null; - authors_filter_properties: AuthorsFilterProperties | null; + +export interface FilterProperties { + /** + * The type of filter to apply when generating the collaboration network. Can be either \'works\' or \'authors\'. If \'works\', the filter properties in the \'works_filter_properties\' field will be used. If \'authors\', the filter properties in the \'authors_filter_properties\' field will be used. + */ + filter_by?: string; + works_filter_properties: WorksFilterProperties | null; + authors_filter_properties: AuthorsFilterProperties | null; } + diff --git a/webapp/src/app/api/model/fundersByAuthorResponse.ts b/webapp/src/app/api/model/fundersByAuthorResponse.ts index d6e0e02f..1286429e 100644 --- a/webapp/src/app/api/model/fundersByAuthorResponse.ts +++ b/webapp/src/app/api/model/fundersByAuthorResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { FunderByAuthor } from './funderByAuthor'; -export interface FundersByAuthorResponse { - author_id: string; - author_name?: string | null; - funder_count: number; - funders: Array; + +export interface FundersByAuthorResponse { + author_id: string; + author_name?: string | null; + funder_count: number; + funders: Array; } + diff --git a/webapp/src/app/api/model/fundingProject.ts b/webapp/src/app/api/model/fundingProject.ts index fb8204e3..a53c64f1 100644 --- a/webapp/src/app/api/model/fundingProject.ts +++ b/webapp/src/app/api/model/fundingProject.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,19 +9,23 @@ */ import { ProjectType } from './projectType'; -export interface FundingProject { - /** - * The type of the project. - */ - type: ProjectType; - /** - * The unique identifier of the project. - */ - id: string; - title?: string | null; - acronym?: string | null; - start_date?: string | null; - end_date?: string | null; - funding_amount?: number | null; + +export interface FundingProject { + /** + * The type of the project. + */ + type: ProjectType; + /** + * The unique identifier of the project. + */ + id: string; + title?: string | null; + acronym?: string | null; + start_date?: string | null; + end_date?: string | null; + funding_amount?: number | null; } -export namespace FundingProject {} +export namespace FundingProject { +} + + diff --git a/webapp/src/app/api/model/fundingProjectPage.ts b/webapp/src/app/api/model/fundingProjectPage.ts index e0996525..db43c9c4 100644 --- a/webapp/src/app/api/model/fundingProjectPage.ts +++ b/webapp/src/app/api/model/fundingProjectPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { FundingProject } from './fundingProject'; -export interface FundingProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The funding projects on this page. - */ - elements?: Array; + +export interface FundingProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The funding projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/fwci.ts b/webapp/src/app/api/model/fwci.ts index bd7eea69..0c0cf8de 100644 --- a/webapp/src/app/api/model/fwci.ts +++ b/webapp/src/app/api/model/fwci.ts @@ -1,14 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Field-weighted Citation Impact, calculated as citations received / citations expected. */ -export interface Fwci {} +export interface Fwci { +} + diff --git a/webapp/src/app/api/model/groupByResult.ts b/webapp/src/app/api/model/groupByResult.ts index 98580663..68c51855 100644 --- a/webapp/src/app/api/model/groupByResult.ts +++ b/webapp/src/app/api/model/groupByResult.ts @@ -1,18 +1,20 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * GroupByResult */ -export interface GroupByResult { - key?: string | null; - key_display_name?: string | null; - count?: number | null; +export interface GroupByResult { + key?: string | null; + key_display_name?: string | null; + count?: number | null; } + diff --git a/webapp/src/app/api/model/hTTPValidationError.ts b/webapp/src/app/api/model/hTTPValidationError.ts index c8e65c3e..f624be37 100644 --- a/webapp/src/app/api/model/hTTPValidationError.ts +++ b/webapp/src/app/api/model/hTTPValidationError.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,6 +9,8 @@ */ import { ValidationError } from './validationError'; -export interface HTTPValidationError { - detail?: Array; + +export interface HTTPValidationError { + detail?: Array; } + diff --git a/webapp/src/app/api/model/identityGrant.ts b/webapp/src/app/api/model/identityGrant.ts index 4bf172b8..9ec3fe50 100644 --- a/webapp/src/app/api/model/identityGrant.ts +++ b/webapp/src/app/api/model/identityGrant.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { AuthScope } from './authScope'; -export interface IdentityGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; + +export interface IdentityGrant { + token_type: string; + access_token: string; + expires_in: number; + scope: AuthScope; } + diff --git a/webapp/src/app/api/model/institution.ts b/webapp/src/app/api/model/institution.ts index c099fc57..6b1a5778 100644 --- a/webapp/src/app/api/model/institution.ts +++ b/webapp/src/app/api/model/institution.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,28 +12,30 @@ import { AuthorCountsByYearInner } from './authorCountsByYearInner'; import { AuthorSummaryStats } from './authorSummaryStats'; import { InstitutionGeo } from './institutionGeo'; + /** * A university, research organization, or other affiliation */ -export interface Institution { - id?: string | null; - ror?: string | null; - display_name?: string | null; - country_code?: string | null; - type?: string | null; - homepage_url?: string | null; - image_url?: string | null; - image_thumbnail_url?: string | null; - display_name_acronyms?: Array | null; - display_name_alternatives?: Array | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - geo?: InstitutionGeo | null; - lineage?: Array | null; - ids?: InstitutionIds | null; - counts_by_year?: Array | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Institution { + id?: string | null; + ror?: string | null; + display_name?: string | null; + country_code?: string | null; + type?: string | null; + homepage_url?: string | null; + image_url?: string | null; + image_thumbnail_url?: string | null; + display_name_acronyms?: Array | null; + display_name_alternatives?: Array | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + geo?: InstitutionGeo | null; + lineage?: Array | null; + ids?: InstitutionIds | null; + counts_by_year?: Array | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/institutionFunderSummary.ts b/webapp/src/app/api/model/institutionFunderSummary.ts index cf15754a..48d147b2 100644 --- a/webapp/src/app/api/model/institutionFunderSummary.ts +++ b/webapp/src/app/api/model/institutionFunderSummary.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,22 @@ */ import { ProjectType } from './projectType'; -export interface InstitutionFunderSummary { - /** - * The type of funding data (e.g., \'bund\', \'eu\', \'dfg\'). - */ - type: ProjectType; - /** - * A dictionary mapping years to total funding amounts for that year. - */ - funding_per_year?: object; - /** - * The average annual funding over the continuous period covered by the data. - */ - annual_average_over_period?: number; + +export interface InstitutionFunderSummary { + /** + * The type of funding data (e.g., \'bund\', \'eu\', \'dfg\'). + */ + type: ProjectType; + /** + * A dictionary mapping years to total funding amounts for that year. + */ + funding_per_year?: object; + /** + * The average annual funding over the continuous period covered by the data. + */ + annual_average_over_period?: number; } -export namespace InstitutionFunderSummary {} +export namespace InstitutionFunderSummary { +} + + diff --git a/webapp/src/app/api/model/institutionGeo.ts b/webapp/src/app/api/model/institutionGeo.ts index b438d37c..949b73f4 100644 --- a/webapp/src/app/api/model/institutionGeo.ts +++ b/webapp/src/app/api/model/institutionGeo.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,15 +10,17 @@ import { Latitude } from './latitude'; import { Longitude } from './longitude'; + /** * Location information: */ -export interface InstitutionGeo { - city?: string | null; - geonames_city_id?: string | null; - region?: string | null; - country_code?: string | null; - country?: string | null; - latitude?: Latitude | null; - longitude?: Longitude | null; +export interface InstitutionGeo { + city?: string | null; + geonames_city_id?: string | null; + region?: string | null; + country_code?: string | null; + country?: string | null; + latitude?: Latitude | null; + longitude?: Longitude | null; } + diff --git a/webapp/src/app/api/model/institutionIds.ts b/webapp/src/app/api/model/institutionIds.ts index fd952098..93d801e1 100644 --- a/webapp/src/app/api/model/institutionIds.ts +++ b/webapp/src/app/api/model/institutionIds.ts @@ -1,21 +1,23 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * External identifiers: */ -export interface InstitutionIds { - openalex?: string | null; - ror?: string | null; - mag?: number | null; - grid?: string | null; - wikipedia?: string | null; - wikidata?: string | null; +export interface InstitutionIds { + openalex?: string | null; + ror?: string | null; + mag?: number | null; + grid?: string | null; + wikipedia?: string | null; + wikidata?: string | null; } + diff --git a/webapp/src/app/api/model/institutionInformation.ts b/webapp/src/app/api/model/institutionInformation.ts index 9e12986d..e287b0fa 100644 --- a/webapp/src/app/api/model/institutionInformation.ts +++ b/webapp/src/app/api/model/institutionInformation.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface InstitutionInformation { - /** - * The raw institution ID of the institution. - */ - raw_id: string; - /** - * The display name of the institution. - */ - display_name: string; + +export interface InstitutionInformation { + /** + * The raw institution ID of the institution. + */ + raw_id: string; + /** + * The display name of the institution. + */ + display_name: string; } + diff --git a/webapp/src/app/api/model/institutionNetworkNode.ts b/webapp/src/app/api/model/institutionNetworkNode.ts index 791645b7..a558a8cf 100644 --- a/webapp/src/app/api/model/institutionNetworkNode.ts +++ b/webapp/src/app/api/model/institutionNetworkNode.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,22 @@ */ import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface InstitutionNetworkNode { - /** - * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. - */ - raw_id: string; - /** - * The display name of the node. - */ - display_name: string; - /** - * The category of the node, either \'author\', \'institution\', or \'work\'. - */ - category: CollaborationNetworkNodeType; + +export interface InstitutionNetworkNode { + /** + * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. + */ + raw_id: string; + /** + * The display name of the node. + */ + display_name: string; + /** + * The category of the node, either \'author\', \'institution\', or \'work\'. + */ + category: CollaborationNetworkNodeType; } -export namespace InstitutionNetworkNode {} +export namespace InstitutionNetworkNode { +} + + diff --git a/webapp/src/app/api/model/institutionPage.ts b/webapp/src/app/api/model/institutionPage.ts index b7640651..01267ee3 100644 --- a/webapp/src/app/api/model/institutionPage.ts +++ b/webapp/src/app/api/model/institutionPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { Institution } from './institution'; -export interface InstitutionPage { - /** - * List of institutions in the current page. - */ - elements?: Array; - /** - * Current page number. (0-indexed) - */ - page?: number; - /** - * Number of institutions per page. - */ - size?: number; - /** - * Total number of institutions matching the search criteria. - */ - total?: number; + +export interface InstitutionPage { + /** + * List of institutions in the current page. + */ + elements?: Array; + /** + * Current page number. (0-indexed) + */ + page?: number; + /** + * Number of institutions per page. + */ + size?: number; + /** + * Total number of institutions matching the search criteria. + */ + total?: number; } + diff --git a/webapp/src/app/api/model/institutionsListResponse.ts b/webapp/src/app/api/model/institutionsListResponse.ts index 0ac2c185..908d72fe 100644 --- a/webapp/src/app/api/model/institutionsListResponse.ts +++ b/webapp/src/app/api/model/institutionsListResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,11 +11,13 @@ import { Meta } from './meta'; import { Institution } from './institution'; import { GroupByResult } from './groupByResult'; + /** * InstitutionsListResponse */ -export interface InstitutionsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface InstitutionsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/item.ts b/webapp/src/app/api/model/item.ts index 377f3a81..cc33194a 100644 --- a/webapp/src/app/api/model/item.ts +++ b/webapp/src/app/api/model/item.ts @@ -1,24 +1,26 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Item { - /** - * The id of the entity. - */ - id: number; - /** - * The name of the item. - */ - name: string; - /** - * The description of the item. - */ - description: string; + +export interface Item { + /** + * The id of the entity. + */ + id: number; + /** + * The name of the item. + */ + name: string; + /** + * The description of the item. + */ + description: string; } + diff --git a/webapp/src/app/api/model/itemCreate.ts b/webapp/src/app/api/model/itemCreate.ts index 36920a12..608d6910 100644 --- a/webapp/src/app/api/model/itemCreate.ts +++ b/webapp/src/app/api/model/itemCreate.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface ItemCreate { - /** - * The name of the item. - */ - name: string; - /** - * The description of the item. - */ - description: string; + +export interface ItemCreate { + /** + * The name of the item. + */ + name: string; + /** + * The description of the item. + */ + description: string; } + diff --git a/webapp/src/app/api/model/itemPage.ts b/webapp/src/app/api/model/itemPage.ts index 53a7140a..56595b8a 100644 --- a/webapp/src/app/api/model/itemPage.ts +++ b/webapp/src/app/api/model/itemPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { Item } from './item'; -export interface ItemPage { - /** - * The elements of the page. - */ - elements?: Array; - /** - * The page offset in elements. - */ - offset?: number; - /** - * The total number of elements. - */ - total?: number; - /** - * The page size in elements. - */ - size?: number; + +export interface ItemPage { + /** + * The elements of the page. + */ + elements?: Array; + /** + * The page offset in elements. + */ + offset?: number; + /** + * The total number of elements. + */ + total?: number; + /** + * The page size in elements. + */ + size?: number; } + diff --git a/webapp/src/app/api/model/keywords.ts b/webapp/src/app/api/model/keywords.ts index d93b5fe0..c65c7600 100644 --- a/webapp/src/app/api/model/keywords.ts +++ b/webapp/src/app/api/model/keywords.ts @@ -1,14 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Keywords associated with the project */ -export interface Keywords {} +export interface Keywords { +} + diff --git a/webapp/src/app/api/model/latitude.ts b/webapp/src/app/api/model/latitude.ts index 8fb58a9b..fe6b49aa 100644 --- a/webapp/src/app/api/model/latitude.ts +++ b/webapp/src/app/api/model/latitude.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Latitude {} + +export interface Latitude { +} + diff --git a/webapp/src/app/api/model/location.ts b/webapp/src/app/api/model/location.ts index f92e2ffb..f207d751 100644 --- a/webapp/src/app/api/model/location.ts +++ b/webapp/src/app/api/model/location.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,17 +9,19 @@ */ import { DehydratedSource } from './dehydratedSource'; + /** * Where a work is hosted */ -export interface Location { - is_oa?: boolean | null; - landing_page_url?: string | null; - pdf_url?: string | null; - source?: DehydratedSource | null; - license?: string | null; - license_id?: string | null; - version?: string | null; - is_accepted?: boolean | null; - is_published?: boolean | null; +export interface Location { + is_oa?: boolean | null; + landing_page_url?: string | null; + pdf_url?: string | null; + source?: DehydratedSource | null; + license?: string | null; + license_id?: string | null; + version?: string | null; + is_accepted?: boolean | null; + is_published?: boolean | null; } + diff --git a/webapp/src/app/api/model/longitude.ts b/webapp/src/app/api/model/longitude.ts index d222a6ff..b0d39fce 100644 --- a/webapp/src/app/api/model/longitude.ts +++ b/webapp/src/app/api/model/longitude.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Longitude {} + +export interface Longitude { +} + diff --git a/webapp/src/app/api/model/matchedAuthor.ts b/webapp/src/app/api/model/matchedAuthor.ts index 058da26a..6194df94 100644 --- a/webapp/src/app/api/model/matchedAuthor.ts +++ b/webapp/src/app/api/model/matchedAuthor.ts @@ -1,4 +1,16 @@ -export interface MatchedAuthor { - openalex_author_id: string; - author_name: string; +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface MatchedAuthor { + openalex_author_id: string; + author_name: string; } + diff --git a/webapp/src/app/api/model/matchedOfficer.ts b/webapp/src/app/api/model/matchedOfficer.ts index a9f00939..4ad5c354 100644 --- a/webapp/src/app/api/model/matchedOfficer.ts +++ b/webapp/src/app/api/model/matchedOfficer.ts @@ -1,21 +1,23 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface MatchedOfficer { - name?: string | null; - firstname?: string | null; - lastname?: string | null; - city?: string | null; - position?: string | null; - start_date?: string | null; - type?: string | null; - flag?: string | null; - is_matched_person?: boolean; + +export interface MatchedOfficer { + name?: string | null; + firstname?: string | null; + lastname?: string | null; + city?: string | null; + position?: string | null; + start_date?: string | null; + type?: string | null; + flag?: string | null; + is_matched_person?: boolean; } + diff --git a/webapp/src/app/api/model/mentionedPerson.ts b/webapp/src/app/api/model/mentionedPerson.ts index dad21357..6141b12a 100644 --- a/webapp/src/app/api/model/mentionedPerson.ts +++ b/webapp/src/app/api/model/mentionedPerson.ts @@ -1,15 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface MentionedPerson { - name: string; - is_ude?: boolean; - person_id?: string | null; + +export interface MentionedPerson { + name: string; + is_ude?: boolean; + person_id?: string | null; } + diff --git a/webapp/src/app/api/model/meta.ts b/webapp/src/app/api/model/meta.ts index f9f56443..8481062a 100644 --- a/webapp/src/app/api/model/meta.ts +++ b/webapp/src/app/api/model/meta.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,15 +9,17 @@ */ import { CostUsd } from './costUsd'; + /** * Metadata about the query results */ -export interface Meta { - count?: number | null; - db_response_time_ms?: number | null; - page?: number | null; - per_page?: number | null; - next_cursor?: string | null; - groups_count?: number | null; - cost_usd?: CostUsd | null; +export interface Meta { + count?: number | null; + db_response_time_ms?: number | null; + page?: number | null; + per_page?: number | null; + next_cursor?: string | null; + groups_count?: number | null; + cost_usd?: CostUsd | null; } + diff --git a/webapp/src/app/api/model/model2YrMeanCitedness.ts b/webapp/src/app/api/model/model2YrMeanCitedness.ts index d9c3d9df..67ec623c 100644 --- a/webapp/src/app/api/model/model2YrMeanCitedness.ts +++ b/webapp/src/app/api/model/model2YrMeanCitedness.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Model2YrMeanCitedness {} + +export interface Model2YrMeanCitedness { +} + diff --git a/webapp/src/app/api/model/newsPage.ts b/webapp/src/app/api/model/newsPage.ts index bbb74122..da7f26ab 100644 --- a/webapp/src/app/api/model/newsPage.ts +++ b/webapp/src/app/api/model/newsPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { NewsArticle } from './newsArticle'; -export interface NewsPage { - total: number; - page: number; - page_size: number; - results: Array; + +export interface NewsPage { + total: number; + page: number; + page_size: number; + results: Array; } + diff --git a/webapp/src/app/api/model/openAccess.ts b/webapp/src/app/api/model/openAccess.ts index 40d7b1d0..32a4ddd9 100644 --- a/webapp/src/app/api/model/openAccess.ts +++ b/webapp/src/app/api/model/openAccess.ts @@ -1,19 +1,21 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Open access information */ -export interface OpenAccess { - is_oa?: boolean | null; - oa_status?: string | null; - oa_url?: string | null; - any_repository_has_fulltext?: boolean | null; +export interface OpenAccess { + is_oa?: boolean | null; + oa_status?: string | null; + oa_url?: string | null; + any_repository_has_fulltext?: boolean | null; } + diff --git a/webapp/src/app/api/model/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts index 7c4d0ce0..e34f9cfc 100644 --- a/webapp/src/app/api/model/orgPatentEntry.ts +++ b/webapp/src/app/api/model/orgPatentEntry.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,37 +10,39 @@ import { MatchedAuthor } from './matchedAuthor'; import { IpcClassification } from './ipcClassification'; -export interface OrgPatentEntry { - patent_id: string; - source: string; - title?: string | null; - abstract?: string | null; - publication_date?: string | null; - publication_year?: string | null; - application_number?: string | null; - application_date?: string | null; - kind?: string | null; - application_type?: string | null; - number_of_claims?: number | null; - status?: string | null; - inventors?: Array; - assignees?: Array; - ipc?: Array; - ipc_descriptions?: Array; - cpc?: Array; - cpc_descriptions?: Array; - country?: string | null; - institution_id: string; - institution_name?: string | null; - match_type: OrgPatentEntry.MatchTypeEnum; - matched_authors?: Array; + +export interface OrgPatentEntry { + patent_id: string; + source: string; + title?: string | null; + 'abstract'?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; + institution_id: string; + institution_name?: string | null; + match_type: OrgPatentEntry.MatchTypeEnum; + matched_authors?: Array; } export namespace OrgPatentEntry { - export const MatchTypeEnum = { - Institution: 'institution', - Name: 'name', - Both: 'both', - } as const; - export type MatchTypeEnum = - (typeof MatchTypeEnum)[keyof typeof MatchTypeEnum]; + export const MatchTypeEnum = { + Institution: 'institution', + Name: 'name', + Both: 'both' + } as const; + export type MatchTypeEnum = typeof MatchTypeEnum[keyof typeof MatchTypeEnum]; } + + diff --git a/webapp/src/app/api/model/orgPatentsResponse.ts b/webapp/src/app/api/model/orgPatentsResponse.ts index 68b2be7a..96697088 100644 --- a/webapp/src/app/api/model/orgPatentsResponse.ts +++ b/webapp/src/app/api/model/orgPatentsResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,11 +9,13 @@ */ import { OrgPatentEntry } from './orgPatentEntry'; -export interface OrgPatentsResponse { - institution_id: string; - institution_name?: string | null; - patent_count: number; - page?: number; - size?: number; - patents: Array; + +export interface OrgPatentsResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + page?: number; + size?: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/patentsByAuthorResponse.ts b/webapp/src/app/api/model/patentsByAuthorResponse.ts index ed970c7a..eca819ed 100644 --- a/webapp/src/app/api/model/patentsByAuthorResponse.ts +++ b/webapp/src/app/api/model/patentsByAuthorResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { PatentEntry } from './patentEntry'; -export interface PatentsByAuthorResponse { - author_id: string; - author_name?: string | null; - patent_count: number; - patents: Array; + +export interface PatentsByAuthorResponse { + author_id: string; + author_name?: string | null; + patent_count: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/patentsByInstitutionResponse.ts b/webapp/src/app/api/model/patentsByInstitutionResponse.ts index 9ecec0b8..b167c48b 100644 --- a/webapp/src/app/api/model/patentsByInstitutionResponse.ts +++ b/webapp/src/app/api/model/patentsByInstitutionResponse.ts @@ -1,8 +1,19 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { PatentEntry } from './patentEntry'; -export interface PatentsByInstitutionResponse { - institution_id: string; - institution_name?: string | null; - patent_count: number; - patents: Array; + +export interface PatentsByInstitutionResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/personBio.ts b/webapp/src/app/api/model/personBio.ts index b060c9a9..f7291e6f 100644 --- a/webapp/src/app/api/model/personBio.ts +++ b/webapp/src/app/api/model/personBio.ts @@ -1,16 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface PersonBio { - /** - * The generated biography. - */ - bio: string; + +export interface PersonBio { + /** + * The generated biography. + */ + bio: string; } + diff --git a/webapp/src/app/api/model/projectType.ts b/webapp/src/app/api/model/projectType.ts index 08df30c4..a01a743c 100644 --- a/webapp/src/app/api/model/projectType.ts +++ b/webapp/src/app/api/model/projectType.ts @@ -1,16 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + export const ProjectType = { - Bund: 'bund', - Eu: 'eu', - Dfg: 'dfg', + Bund: 'bund', + Eu: 'eu', + Dfg: 'dfg' } as const; -export type ProjectType = (typeof ProjectType)[keyof typeof ProjectType]; +export type ProjectType = typeof ProjectType[keyof typeof ProjectType]; + diff --git a/webapp/src/app/api/model/projectsFilteringProperties.ts b/webapp/src/app/api/model/projectsFilteringProperties.ts index c0cebe63..7ce7cfc2 100644 --- a/webapp/src/app/api/model/projectsFilteringProperties.ts +++ b/webapp/src/app/api/model/projectsFilteringProperties.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,28 +11,32 @@ import { SortDirection } from './sortDirection'; import { ProjectsSortBy } from './projectsSortBy'; import { ProjectType } from './projectType'; -export interface ProjectsFilteringProperties { - /** - * The type of projects to filter by. - */ - project_type: ProjectType; - /** - * The page number for pagination. - */ - page: number; - /** - * The page size for pagination. - */ - size: number; - raw_oa_institution_id?: string | null; - query?: string | null; - /** - * The field to sort by. - */ - sort_by?: ProjectsSortBy; - /** - * The sort direction (asc or desc). - */ - sort_direction?: SortDirection; + +export interface ProjectsFilteringProperties { + /** + * The type of projects to filter by. + */ + project_type: ProjectType; + /** + * The page number for pagination. + */ + page: number; + /** + * The page size for pagination. + */ + size: number; + raw_oa_institution_id?: string | null; + query?: string | null; + /** + * The field to sort by. + */ + sort_by?: ProjectsSortBy; + /** + * The sort direction (asc or desc). + */ + sort_direction?: SortDirection; } -export namespace ProjectsFilteringProperties {} +export namespace ProjectsFilteringProperties { +} + + diff --git a/webapp/src/app/api/model/projectsSortBy.ts b/webapp/src/app/api/model/projectsSortBy.ts index 26400b22..79824096 100644 --- a/webapp/src/app/api/model/projectsSortBy.ts +++ b/webapp/src/app/api/model/projectsSortBy.ts @@ -1,18 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + export const ProjectsSortBy = { - Title: 'title', - FundingStart: 'funding_start', - FundingEnd: 'funding_end', - FundingAmount: 'funding_amount', + Title: 'title', + FundingStart: 'funding_start', + FundingEnd: 'funding_end', + FundingAmount: 'funding_amount' } as const; -export type ProjectsSortBy = - (typeof ProjectsSortBy)[keyof typeof ProjectsSortBy]; +export type ProjectsSortBy = typeof ProjectsSortBy[keyof typeof ProjectsSortBy]; + diff --git a/webapp/src/app/api/model/publicationDetailByFunder.ts b/webapp/src/app/api/model/publicationDetailByFunder.ts index 0fd6b7c5..123ded7e 100644 --- a/webapp/src/app/api/model/publicationDetailByFunder.ts +++ b/webapp/src/app/api/model/publicationDetailByFunder.ts @@ -1,43 +1,45 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface PublicationDetailByFunder { - id: string; - title: string; - abstract?: string | null; - doi?: string | null; - publication_year?: number | null; - publication_date?: string | null; - publication_type?: string | null; - language?: string | null; - publication_url?: string | null; - pdf_url?: string | null; - source_name?: string | null; - source_type?: string | null; - is_open_access?: boolean | null; - open_access_status?: string | null; - has_fulltext?: boolean | null; - license?: string | null; - cited_by_count?: number | null; - is_retracted?: boolean | null; - primary_topic?: string | null; - topic_field?: string | null; - topic_subfield?: string | null; - topic_domain?: string | null; - author_position?: string | null; - authors?: Array; - funder_names?: Array; - institutions?: Array; - countries?: Array; - topics?: Array; - keywords?: Array; - grant_labels?: Array; - counts_by_year?: Array; + +export interface PublicationDetailByFunder { + id: string; + title: string; + 'abstract'?: string | null; + doi?: string | null; + publication_year?: number | null; + publication_date?: string | null; + publication_type?: string | null; + language?: string | null; + publication_url?: string | null; + pdf_url?: string | null; + source_name?: string | null; + source_type?: string | null; + is_open_access?: boolean | null; + open_access_status?: string | null; + has_fulltext?: boolean | null; + license?: string | null; + cited_by_count?: number | null; + is_retracted?: boolean | null; + primary_topic?: string | null; + topic_field?: string | null; + topic_subfield?: string | null; + topic_domain?: string | null; + author_position?: string | null; + authors?: Array; + funder_names?: Array; + institutions?: Array; + countries?: Array; + topics?: Array; + keywords?: Array; + grant_labels?: Array; + counts_by_year?: Array; } + diff --git a/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts b/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts index d549f8ed..c35050ef 100644 --- a/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts +++ b/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts @@ -1,16 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface PublicationIdsByAuthorPosition { - first?: Array; - middle?: Array; - last?: Array; - unknown?: Array; + +export interface PublicationIdsByAuthorPosition { + first?: Array; + middle?: Array; + last?: Array; + unknown?: Array; } + diff --git a/webapp/src/app/api/model/publicationsByAuthorResponse.ts b/webapp/src/app/api/model/publicationsByAuthorResponse.ts index 35333880..5176fe39 100644 --- a/webapp/src/app/api/model/publicationsByAuthorResponse.ts +++ b/webapp/src/app/api/model/publicationsByAuthorResponse.ts @@ -1,19 +1,21 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface PublicationsByAuthorResponse { - author_id: string; - page: number; - page_size: number; - total_works: number; - total: number; - results_count: number; - results: Array; + +export interface PublicationsByAuthorResponse { + author_id: string; + page: number; + page_size: number; + total_works: number; + total: number; + results_count: number; + results: Array; } + diff --git a/webapp/src/app/api/model/rankingResponse.ts b/webapp/src/app/api/model/rankingResponse.ts index 5be090a2..099ec660 100644 --- a/webapp/src/app/api/model/rankingResponse.ts +++ b/webapp/src/app/api/model/rankingResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,7 +10,9 @@ import { UniversityRanking } from './universityRanking'; import { UniversityTopicData } from './universityTopicData'; -export interface RankingResponse { - timeseries: Array; - rankings: Array; + +export interface RankingResponse { + timeseries: Array; + rankings: Array; } + diff --git a/webapp/src/app/api/model/score.ts b/webapp/src/app/api/model/score.ts index 5b0b5935..fac39735 100644 --- a/webapp/src/app/api/model/score.ts +++ b/webapp/src/app/api/model/score.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Score {} + +export interface Score { +} + diff --git a/webapp/src/app/api/model/sortDirection.ts b/webapp/src/app/api/model/sortDirection.ts index 49933995..4f9362f2 100644 --- a/webapp/src/app/api/model/sortDirection.ts +++ b/webapp/src/app/api/model/sortDirection.ts @@ -1,15 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + export const SortDirection = { - Asc: 'asc', - Desc: 'desc', + Asc: 'asc', + Desc: 'desc' } as const; -export type SortDirection = (typeof SortDirection)[keyof typeof SortDirection]; +export type SortDirection = typeof SortDirection[keyof typeof SortDirection]; + diff --git a/webapp/src/app/api/model/topic.ts b/webapp/src/app/api/model/topic.ts index eaac16f6..9fc0ee63 100644 --- a/webapp/src/app/api/model/topic.ts +++ b/webapp/src/app/api/model/topic.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,21 +12,23 @@ import { TopicIds } from './topicIds'; import { TopicSubfield } from './topicSubfield'; import { TopicField } from './topicField'; + /** * A research topic automatically assigned to works */ -export interface Topic { - id?: string | null; - display_name?: string | null; - description?: string | null; - keywords?: Array | null; - subfield?: TopicSubfield | null; - field?: TopicField | null; - domain?: TopicDomain | null; - works_count?: number | null; - cited_by_count?: number | null; - ids?: TopicIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Topic { + id?: string | null; + display_name?: string | null; + description?: string | null; + keywords?: Array | null; + subfield?: TopicSubfield | null; + field?: TopicField | null; + domain?: TopicDomain | null; + works_count?: number | null; + cited_by_count?: number | null; + ids?: TopicIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/topicCount.ts b/webapp/src/app/api/model/topicCount.ts index 1d2abe90..b929a51d 100644 --- a/webapp/src/app/api/model/topicCount.ts +++ b/webapp/src/app/api/model/topicCount.ts @@ -1,31 +1,33 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface TopicCount { - id?: string | null; - /** - * The topic display name. - */ - name: string; - /** - * The number of occurrences. - */ - count?: number; - description?: string | null; - subfield_id?: string | null; - subfield_name?: string | null; - subfield_description?: string | null; - field_id?: string | null; - field_name?: string | null; - field_description?: string | null; - domain_id?: string | null; - domain_name?: string | null; - domain_description?: string | null; + +export interface TopicCount { + id?: string | null; + /** + * The topic display name. + */ + name: string; + /** + * The number of occurrences. + */ + count?: number; + description?: string | null; + subfield_id?: string | null; + subfield_name?: string | null; + subfield_description?: string | null; + field_id?: string | null; + field_name?: string | null; + field_description?: string | null; + domain_id?: string | null; + domain_name?: string | null; + domain_description?: string | null; } + diff --git a/webapp/src/app/api/model/topicDomain.ts b/webapp/src/app/api/model/topicDomain.ts index 573bef0d..652b1bca 100644 --- a/webapp/src/app/api/model/topicDomain.ts +++ b/webapp/src/app/api/model/topicDomain.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The domain (highest level) containing this topic: */ -export interface TopicDomain { - id?: string | null; - display_name?: string | null; +export interface TopicDomain { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topicField.ts b/webapp/src/app/api/model/topicField.ts index cd7d08c8..c7351675 100644 --- a/webapp/src/app/api/model/topicField.ts +++ b/webapp/src/app/api/model/topicField.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The field (second level) containing this topic: */ -export interface TopicField { - id?: string | null; - display_name?: string | null; +export interface TopicField { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topicIds.ts b/webapp/src/app/api/model/topicIds.ts index 22ca3343..4aa6738f 100644 --- a/webapp/src/app/api/model/topicIds.ts +++ b/webapp/src/app/api/model/topicIds.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * External identifiers: */ -export interface TopicIds { - openalex?: string | null; - wikipedia?: string | null; +export interface TopicIds { + openalex?: string | null; + wikipedia?: string | null; } + diff --git a/webapp/src/app/api/model/topicSubfield.ts b/webapp/src/app/api/model/topicSubfield.ts index 79f3c9c7..53d37842 100644 --- a/webapp/src/app/api/model/topicSubfield.ts +++ b/webapp/src/app/api/model/topicSubfield.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The subfield (third level) containing this topic: */ -export interface TopicSubfield { - id?: string | null; - display_name?: string | null; +export interface TopicSubfield { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topics.ts b/webapp/src/app/api/model/topics.ts index cf40ff1d..44f0eb98 100644 --- a/webapp/src/app/api/model/topics.ts +++ b/webapp/src/app/api/model/topics.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Topics {} + +export interface Topics { +} + diff --git a/webapp/src/app/api/model/topicsByTime.ts b/webapp/src/app/api/model/topicsByTime.ts index 007dc43d..8af7c9bb 100644 --- a/webapp/src/app/api/model/topicsByTime.ts +++ b/webapp/src/app/api/model/topicsByTime.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,25 +9,27 @@ */ import { TopicsByYear } from './topicsByYear'; -export interface TopicsByTime { - /** - * Topics grouped by year. - */ - elements?: Array; - /** - * The number of years. - */ - total?: number; - /** - * True if the timeline contains only a limited subset of the author\'s publications. - */ - is_limited?: boolean; - /** - * The number of publications used to build the timeline. - */ - used_publications?: number; - /** - * The total number of publications found for this author. - */ - total_publications?: number; + +export interface TopicsByTime { + /** + * Topics grouped by year. + */ + elements?: Array; + /** + * The number of years. + */ + total?: number; + /** + * True if the timeline contains only a limited subset of the author\'s publications. + */ + is_limited?: boolean; + /** + * The number of publications used to build the timeline. + */ + used_publications?: number; + /** + * The total number of publications found for this author. + */ + total_publications?: number; } + diff --git a/webapp/src/app/api/model/topicsByYear.ts b/webapp/src/app/api/model/topicsByYear.ts index bb2f1820..fded8da0 100644 --- a/webapp/src/app/api/model/topicsByYear.ts +++ b/webapp/src/app/api/model/topicsByYear.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,21 +9,23 @@ */ import { TopicCount } from './topicCount'; -export interface TopicsByYear { - /** - * The publication year. - */ - year: number; - /** - * The number of works in this year. - */ - publication_count?: number; - /** - * The topics in this year. - */ - topics?: Array; - /** - * The primary topics in this year. - */ - primary_topics?: Array; + +export interface TopicsByYear { + /** + * The publication year. + */ + year: number; + /** + * The number of works in this year. + */ + publication_count?: number; + /** + * The topics in this year. + */ + topics?: Array; + /** + * The primary topics in this year. + */ + primary_topics?: Array; } + diff --git a/webapp/src/app/api/model/topicsListResponse.ts b/webapp/src/app/api/model/topicsListResponse.ts index 058b45fd..43f21226 100644 --- a/webapp/src/app/api/model/topicsListResponse.ts +++ b/webapp/src/app/api/model/topicsListResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,11 +11,13 @@ import { Meta } from './meta'; import { GroupByResult } from './groupByResult'; import { Topic } from './topic'; + /** * TopicsListResponse */ -export interface TopicsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface TopicsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/universityRanking.ts b/webapp/src/app/api/model/universityRanking.ts index 5c9d0d05..3099e73e 100644 --- a/webapp/src/app/api/model/universityRanking.ts +++ b/webapp/src/app/api/model/universityRanking.ts @@ -1,27 +1,30 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface UniversityRanking { - rank: number; - university: string; - publications: number; - citations: number; - growth_rate: number; - trend: UniversityRanking.TrendEnum; - is_top_mover: boolean; + +export interface UniversityRanking { + rank: number; + university: string; + publications: number; + citations: number; + growth_rate: number; + trend: UniversityRanking.TrendEnum; + is_top_mover: boolean; } export namespace UniversityRanking { - export const TrendEnum = { - Up: 'up', - Down: 'down', - Stable: 'stable', - } as const; - export type TrendEnum = (typeof TrendEnum)[keyof typeof TrendEnum]; + export const TrendEnum = { + Up: 'up', + Down: 'down', + Stable: 'stable' + } as const; + export type TrendEnum = typeof TrendEnum[keyof typeof TrendEnum]; } + + diff --git a/webapp/src/app/api/model/universityTopicData.ts b/webapp/src/app/api/model/universityTopicData.ts index f5436445..fc517b7c 100644 --- a/webapp/src/app/api/model/universityTopicData.ts +++ b/webapp/src/app/api/model/universityTopicData.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,17 +9,20 @@ */ import { YearlyData } from './yearlyData'; -export interface UniversityTopicData { - university: string; - topic: UniversityTopicData.TopicEnum; - yearly_data: Array; + +export interface UniversityTopicData { + university: string; + topic: UniversityTopicData.TopicEnum; + yearly_data: Array; } export namespace UniversityTopicData { - export const TopicEnum = { - ArtificialIntelligence: 'Artificial Intelligence', - QuantumComputing: 'Quantum Computing', - RenewableEnergy: 'Renewable Energy', - Biotechnology: 'Biotechnology', - } as const; - export type TopicEnum = (typeof TopicEnum)[keyof typeof TopicEnum]; + export const TopicEnum = { + ArtificialIntelligence: 'Artificial Intelligence', + QuantumComputing: 'Quantum Computing', + RenewableEnergy: 'Renewable Energy', + Biotechnology: 'Biotechnology' + } as const; + export type TopicEnum = typeof TopicEnum[keyof typeof TopicEnum]; } + + diff --git a/webapp/src/app/api/model/user.ts b/webapp/src/app/api/model/user.ts index 7e82821c..def604e1 100644 --- a/webapp/src/app/api/model/user.ts +++ b/webapp/src/app/api/model/user.ts @@ -1,43 +1,45 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** - * An entry in the user configuration file. + * An entry in the user configuration file. */ -export interface User { - /** - * The username of the user. - */ - username: string; - /** - * The password of the user. - */ - password: string; - /** - * The email of the user. - */ - email: string; - /** - * The account id of the user. - */ - account: number; - /** - * The organization id of the user. - */ - organization: number; - /** - * The organization name of the user. - */ - organization_name: string; - /** - * Indicates whether the user is a superadmin. - */ - superadmin?: boolean; +export interface User { + /** + * The username of the user. + */ + username: string; + /** + * The password of the user. + */ + password: string; + /** + * The email of the user. + */ + email: string; + /** + * The account id of the user. + */ + account: number; + /** + * The organization id of the user. + */ + organization: number; + /** + * The organization name of the user. + */ + organization_name: string; + /** + * Indicates whether the user is a superadmin. + */ + superadmin?: boolean; } + diff --git a/webapp/src/app/api/model/validationError.ts b/webapp/src/app/api/model/validationError.ts index 18cd1b61..bdbd57ad 100644 --- a/webapp/src/app/api/model/validationError.ts +++ b/webapp/src/app/api/model/validationError.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,8 +9,10 @@ */ import { ValidationErrorLocInner } from './validationErrorLocInner'; -export interface ValidationError { - loc: Array; - msg: string; - type: string; + +export interface ValidationError { + loc: Array; + msg: string; + type: string; } + diff --git a/webapp/src/app/api/model/validationErrorLocInner.ts b/webapp/src/app/api/model/validationErrorLocInner.ts index 3c1ffa29..d248a9b7 100644 --- a/webapp/src/app/api/model/validationErrorLocInner.ts +++ b/webapp/src/app/api/model/validationErrorLocInner.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface ValidationErrorLocInner {} + +export interface ValidationErrorLocInner { +} + diff --git a/webapp/src/app/api/model/value.ts b/webapp/src/app/api/model/value.ts index 016b21cb..a9fc79ba 100644 --- a/webapp/src/app/api/model/value.ts +++ b/webapp/src/app/api/model/value.ts @@ -1,11 +1,14 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface Value {} + +export interface Value { +} + diff --git a/webapp/src/app/api/model/work.ts b/webapp/src/app/api/model/work.ts index 6c6ae99b..07d94a1c 100644 --- a/webapp/src/app/api/model/work.ts +++ b/webapp/src/app/api/model/work.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -24,46 +24,48 @@ import { WorkHasContent } from './workHasContent'; import { Location } from './location'; import { WorkBiblio } from './workBiblio'; + /** * A scholarly document (article, book, dataset, thesis, etc.) */ -export interface Work { - id?: string | null; - doi?: string | null; - title?: string | null; - display_name?: string | null; - publication_year?: number | null; - publication_date?: string | null; - type?: string | null; - language?: string | null; - cited_by_count?: number | null; - is_retracted?: boolean | null; - is_paratext?: boolean | null; - primary_location?: Location | null; - locations?: Array | null; - best_oa_location?: Location | null; - open_access?: OpenAccess | null; - authorships?: Array | null; - ids?: WorkIds | null; - biblio?: WorkBiblio | null; - abstract_inverted_index?: object | null; - referenced_works?: Array | null; - referenced_works_count?: number | null; - related_works?: Array | null; - topics?: Array | null; - primary_topic?: WorkTopic | null; - keywords?: Array | null; - funders?: Array | null; - awards?: Array | null; - fwci?: Fwci | null; - citation_normalized_percentile?: WorkCitationNormalizedPercentile | null; - cited_by_percentile_year?: WorkCitedByPercentileYear | null; - counts_by_year?: Array | null; - sustainable_development_goals?: Array | null; - mesh?: Array | null; - indexed_in?: Array | null; - has_content?: WorkHasContent | null; - content_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Work { + id?: string | null; + doi?: string | null; + title?: string | null; + display_name?: string | null; + publication_year?: number | null; + publication_date?: string | null; + type?: string | null; + language?: string | null; + cited_by_count?: number | null; + is_retracted?: boolean | null; + is_paratext?: boolean | null; + primary_location?: Location | null; + locations?: Array | null; + best_oa_location?: Location | null; + open_access?: OpenAccess | null; + authorships?: Array | null; + ids?: WorkIds | null; + biblio?: WorkBiblio | null; + abstract_inverted_index?: object | null; + referenced_works?: Array | null; + referenced_works_count?: number | null; + related_works?: Array | null; + topics?: Array | null; + primary_topic?: WorkTopic | null; + keywords?: Array | null; + funders?: Array | null; + awards?: Array | null; + fwci?: Fwci | null; + citation_normalized_percentile?: WorkCitationNormalizedPercentile | null; + cited_by_percentile_year?: WorkCitedByPercentileYear | null; + counts_by_year?: Array | null; + sustainable_development_goals?: Array | null; + mesh?: Array | null; + indexed_in?: Array | null; + has_content?: WorkHasContent | null; + content_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/workBiblio.ts b/webapp/src/app/api/model/workBiblio.ts index 65c0a34b..f6d7079b 100644 --- a/webapp/src/app/api/model/workBiblio.ts +++ b/webapp/src/app/api/model/workBiblio.ts @@ -1,19 +1,21 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Bibliographic info: `volume`, `issue`, `first_page`, `last_page`. */ -export interface WorkBiblio { - volume?: string | null; - issue?: string | null; - first_page?: string | null; - last_page?: string | null; +export interface WorkBiblio { + volume?: string | null; + issue?: string | null; + first_page?: string | null; + last_page?: string | null; } + diff --git a/webapp/src/app/api/model/workCitationNormalizedPercentile.ts b/webapp/src/app/api/model/workCitationNormalizedPercentile.ts index 4a2bc6d4..a587ddf6 100644 --- a/webapp/src/app/api/model/workCitationNormalizedPercentile.ts +++ b/webapp/src/app/api/model/workCitationNormalizedPercentile.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,11 +9,13 @@ */ import { Value } from './value'; + /** * Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`. */ -export interface WorkCitationNormalizedPercentile { - value?: Value | null; - is_in_top_1_percent?: boolean | null; - is_in_top_10_percent?: boolean | null; +export interface WorkCitationNormalizedPercentile { + value?: Value | null; + is_in_top_1_percent?: boolean | null; + is_in_top_10_percent?: boolean | null; } + diff --git a/webapp/src/app/api/model/workCitedByPercentileYear.ts b/webapp/src/app/api/model/workCitedByPercentileYear.ts index 7bcd3c85..5257eb3b 100644 --- a/webapp/src/app/api/model/workCitedByPercentileYear.ts +++ b/webapp/src/app/api/model/workCitedByPercentileYear.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Percentile rank compared to other works published in the same year. Contains `min` and `max`. */ -export interface WorkCitedByPercentileYear { - min?: number | null; - max?: number | null; +export interface WorkCitedByPercentileYear { + min?: number | null; + max?: number | null; } + diff --git a/webapp/src/app/api/model/workCountsByYearInner.ts b/webapp/src/app/api/model/workCountsByYearInner.ts index 496a11db..76d97d77 100644 --- a/webapp/src/app/api/model/workCountsByYearInner.ts +++ b/webapp/src/app/api/model/workCountsByYearInner.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * WorkCountsByYearInner */ -export interface WorkCountsByYearInner { - year?: number | null; - cited_by_count?: number | null; +export interface WorkCountsByYearInner { + year?: number | null; + cited_by_count?: number | null; } + diff --git a/webapp/src/app/api/model/workHasContent.ts b/webapp/src/app/api/model/workHasContent.ts index 76871238..44fbe446 100644 --- a/webapp/src/app/api/model/workHasContent.ts +++ b/webapp/src/app/api/model/workHasContent.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Information about downloadable full-text content: */ -export interface WorkHasContent { - pdf?: boolean | null; - grobid_xml?: boolean | null; +export interface WorkHasContent { + pdf?: boolean | null; + grobid_xml?: boolean | null; } + diff --git a/webapp/src/app/api/model/workIds.ts b/webapp/src/app/api/model/workIds.ts index fe562e40..e8315250 100644 --- a/webapp/src/app/api/model/workIds.ts +++ b/webapp/src/app/api/model/workIds.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * External identifiers: `openalex`, `doi`, `mag`, `pmid`, `pmcid`. */ -export interface WorkIds { - openalex?: string | null; - doi?: string | null; - mag?: number | null; - pmid?: string | null; - pmcid?: string | null; +export interface WorkIds { + openalex?: string | null; + doi?: string | null; + mag?: number | null; + pmid?: string | null; + pmcid?: string | null; } + diff --git a/webapp/src/app/api/model/workKeyword.ts b/webapp/src/app/api/model/workKeyword.ts index 7270db25..c9c99afb 100644 --- a/webapp/src/app/api/model/workKeyword.ts +++ b/webapp/src/app/api/model/workKeyword.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,11 +9,13 @@ */ import { Score } from './score'; + /** * WorkKeyword */ -export interface WorkKeyword { - id?: string | null; - display_name?: string | null; - score?: Score | null; +export interface WorkKeyword { + id?: string | null; + display_name?: string | null; + score?: Score | null; } + diff --git a/webapp/src/app/api/model/workMeshInner.ts b/webapp/src/app/api/model/workMeshInner.ts index 36a0c569..40633524 100644 --- a/webapp/src/app/api/model/workMeshInner.ts +++ b/webapp/src/app/api/model/workMeshInner.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * WorkMeshInner */ -export interface WorkMeshInner { - descriptor_ui?: string | null; - descriptor_name?: string | null; - qualifier_ui?: string | null; - qualifier_name?: string | null; - is_major_topic?: boolean | null; +export interface WorkMeshInner { + descriptor_ui?: string | null; + descriptor_name?: string | null; + qualifier_ui?: string | null; + qualifier_name?: string | null; + is_major_topic?: boolean | null; } + diff --git a/webapp/src/app/api/model/workNetworkNode.ts b/webapp/src/app/api/model/workNetworkNode.ts index 445cd8ad..abc04a69 100644 --- a/webapp/src/app/api/model/workNetworkNode.ts +++ b/webapp/src/app/api/model/workNetworkNode.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,20 +10,24 @@ import { WorkTopicInformation } from './workTopicInformation'; import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface WorkNetworkNode { - /** - * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. - */ - raw_id: string; - /** - * The display name of the node. - */ - display_name: string; - /** - * The category of the node, either \'author\', \'institution\', or \'work\'. - */ - category: CollaborationNetworkNodeType; - publication_year: number | null; - work_topics_information: Set | null; + +export interface WorkNetworkNode { + /** + * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. + */ + raw_id: string; + /** + * The display name of the node. + */ + display_name: string; + /** + * The category of the node, either \'author\', \'institution\', or \'work\'. + */ + category: CollaborationNetworkNodeType; + publication_year: number | null; + work_topics_information: Set | null; } -export namespace WorkNetworkNode {} +export namespace WorkNetworkNode { +} + + diff --git a/webapp/src/app/api/model/workPage.ts b/webapp/src/app/api/model/workPage.ts index 285d2065..8490c3ab 100644 --- a/webapp/src/app/api/model/workPage.ts +++ b/webapp/src/app/api/model/workPage.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,25 +9,27 @@ */ import { Work } from './work'; -export interface WorkPage { - /** - * Total number of works matching the query - */ - total: number; - /** - * List of works on the current page - */ - elements: Array; - /** - * Offset of the current page - */ - offset: number; - /** - * Size of the current page - */ - size: number; - /** - * Indicates if the current page is the last page - */ - last_page: boolean; + +export interface WorkPage { + /** + * Total number of works matching the query + */ + total: number; + /** + * List of works on the current page + */ + elements: Array; + /** + * Offset of the current page + */ + offset: number; + /** + * Size of the current page + */ + size: number; + /** + * Indicates if the current page is the last page + */ + last_page: boolean; } + diff --git a/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts b/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts index 8bc67292..c9ecd00f 100644 --- a/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts +++ b/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,11 +9,13 @@ */ import { Score } from './score'; + /** * WorkSustainableDevelopmentGoalsInner */ -export interface WorkSustainableDevelopmentGoalsInner { - id?: string | null; - display_name?: string | null; - score?: Score | null; +export interface WorkSustainableDevelopmentGoalsInner { + id?: string | null; + display_name?: string | null; + score?: Score | null; } + diff --git a/webapp/src/app/api/model/workTopic.ts b/webapp/src/app/api/model/workTopic.ts index 4b326824..925ead4f 100644 --- a/webapp/src/app/api/model/workTopic.ts +++ b/webapp/src/app/api/model/workTopic.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,14 +12,16 @@ import { WorkTopicDomain } from './workTopicDomain'; import { WorkTopicSubfield } from './workTopicSubfield'; import { WorkTopicField } from './workTopicField'; + /** * WorkTopic */ -export interface WorkTopic { - id?: string | null; - display_name?: string | null; - score?: Score | null; - subfield?: WorkTopicSubfield | null; - field?: WorkTopicField | null; - domain?: WorkTopicDomain | null; +export interface WorkTopic { + id?: string | null; + display_name?: string | null; + score?: Score | null; + subfield?: WorkTopicSubfield | null; + field?: WorkTopicField | null; + domain?: WorkTopicDomain | null; } + diff --git a/webapp/src/app/api/model/workTopicDomain.ts b/webapp/src/app/api/model/workTopicDomain.ts index 13b227df..1a9879d4 100644 --- a/webapp/src/app/api/model/workTopicDomain.ts +++ b/webapp/src/app/api/model/workTopicDomain.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The parent [domain](/api-reference/domains) */ -export interface WorkTopicDomain { - id?: string | null; - display_name?: string | null; +export interface WorkTopicDomain { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/workTopicField.ts b/webapp/src/app/api/model/workTopicField.ts index 432b993e..1807cfc1 100644 --- a/webapp/src/app/api/model/workTopicField.ts +++ b/webapp/src/app/api/model/workTopicField.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The parent [field](/api-reference/fields) */ -export interface WorkTopicField { - id?: string | null; - display_name?: string | null; +export interface WorkTopicField { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/workTopicInformation.ts b/webapp/src/app/api/model/workTopicInformation.ts index 5dbbfc78..ca3b9454 100644 --- a/webapp/src/app/api/model/workTopicInformation.ts +++ b/webapp/src/app/api/model/workTopicInformation.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface WorkTopicInformation { - /** - * The ID of the topic. - */ - raw_topic_id: string; - /** - * The name of the topic. - */ - display_name: string; + +export interface WorkTopicInformation { + /** + * The ID of the topic. + */ + raw_topic_id: string; + /** + * The name of the topic. + */ + display_name: string; } + diff --git a/webapp/src/app/api/model/workTopicSubfield.ts b/webapp/src/app/api/model/workTopicSubfield.ts index 49c1155b..b6e7278a 100644 --- a/webapp/src/app/api/model/workTopicSubfield.ts +++ b/webapp/src/app/api/model/workTopicSubfield.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * The parent [subfield](/api-reference/subfields) */ -export interface WorkTopicSubfield { - id?: string | null; - display_name?: string | null; +export interface WorkTopicSubfield { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/worksFilterProperties.ts b/webapp/src/app/api/model/worksFilterProperties.ts index fd25fd26..bd6cc9a4 100644 --- a/webapp/src/app/api/model/worksFilterProperties.ts +++ b/webapp/src/app/api/model/worksFilterProperties.ts @@ -1,32 +1,34 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface WorksFilterProperties { - /** - * The start publication year for the works to include in the collaboration network. - */ - start_year?: number; - /** - * The end publication year for the works to include in the collaboration network. - */ - end_year?: number; - /** - * The list of raw topic IDs to include in the collaboration network. If empty, all topics will be included. - */ - allowed_topics?: Array; - /** - * The minimum number of contributors required for a work to be included in the collaboration network. - */ - min_contributors?: number; - /** - * The maximum number of contributors allowed for a work to be included in the collaboration network. - */ - max_contributors?: number; + +export interface WorksFilterProperties { + /** + * The start publication year for the works to include in the collaboration network. + */ + start_year?: number; + /** + * The end publication year for the works to include in the collaboration network. + */ + end_year?: number; + /** + * The list of raw topic IDs to include in the collaboration network. If empty, all topics will be included. + */ + allowed_topics?: Array; + /** + * The minimum number of contributors required for a work to be included in the collaboration network. + */ + min_contributors?: number; + /** + * The maximum number of contributors allowed for a work to be included in the collaboration network. + */ + max_contributors?: number; } + diff --git a/webapp/src/app/api/model/worksListResponse.ts b/webapp/src/app/api/model/worksListResponse.ts index bc21a41b..a65d3849 100644 --- a/webapp/src/app/api/model/worksListResponse.ts +++ b/webapp/src/app/api/model/worksListResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,11 +11,13 @@ import { Meta } from './meta'; import { Work } from './work'; import { GroupByResult } from './groupByResult'; + /** * WorksListResponse */ -export interface WorksListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface WorksListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/yearlyData.ts b/webapp/src/app/api/model/yearlyData.ts index d473f13e..3272805e 100644 --- a/webapp/src/app/api/model/yearlyData.ts +++ b/webapp/src/app/api/model/yearlyData.ts @@ -1,15 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface YearlyData { - year: number; - publications: number; - citations: number; + +export interface YearlyData { + year: number; + publications: number; + citations: number; } + diff --git a/webapp/src/app/api/param.ts b/webapp/src/app/api/param.ts index 486c804e..78a2d20a 100644 --- a/webapp/src/app/api/param.ts +++ b/webapp/src/app/api/param.ts @@ -8,7 +8,8 @@ export type StandardParamStyle = | 'simple' | 'spaceDelimited' | 'pipeDelimited' - | 'deepObject'; + | 'deepObject' + ; /** * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. @@ -24,12 +25,13 @@ export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; * Standard types as defined in OpenAPI Specification: Data Types */ export type StandardDataType = - | 'integer' - | 'number' - | 'boolean' - | 'string' - | 'object' - | 'array'; + | "integer" + | "number" + | "boolean" + | "string" + | "object" + | "array" + ; /** * Standard {@link DataType}s plus your own types/classes. @@ -40,15 +42,16 @@ export type DataType = StandardDataType | string; * Standard formats as defined in OpenAPI Specification: Data Types */ export type StandardDataFormat = - | 'int32' - | 'int64' - | 'float' - | 'double' - | 'byte' - | 'binary' - | 'date' - | 'date-time' - | 'password'; + | "int32" + | "int64" + | "float" + | "double" + | "byte" + | "binary" + | "date" + | "date-time" + | "password" + ; export type DataFormat = StandardDataFormat | string; @@ -59,7 +62,7 @@ export interface Param { name: string; value: unknown; in: ParamLocation; - style: ParamStyle; + style: ParamStyle, explode: boolean; dataType: DataType; dataFormat: DataFormat | undefined; diff --git a/webapp/src/app/api/provide-api.ts b/webapp/src/app/api/provide-api.ts index 960132f8..19c762ac 100644 --- a/webapp/src/app/api/provide-api.ts +++ b/webapp/src/app/api/provide-api.ts @@ -1,17 +1,15 @@ -import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'; +import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core"; import { Configuration, ConfigurationParameters } from './configuration'; import { BASE_PATH } from './variables'; // Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig). -export function provideApi( - configOrBasePath: string | ConfigurationParameters, -): EnvironmentProviders { - return makeEnvironmentProviders([ - typeof configOrBasePath === 'string' - ? { provide: BASE_PATH, useValue: configOrBasePath } - : { - provide: Configuration, - useValue: new Configuration({ ...configOrBasePath }), - }, - ]); -} +export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders { + return makeEnvironmentProviders([ + typeof configOrBasePath === "string" + ? { provide: BASE_PATH, useValue: configOrBasePath } + : { + provide: Configuration, + useValue: new Configuration({ ...configOrBasePath }), + }, + ]); +} \ No newline at end of file diff --git a/webapp/src/app/api/variables.ts b/webapp/src/app/api/variables.ts index 2277a9cc..6fe58549 100644 --- a/webapp/src/app/api/variables.ts +++ b/webapp/src/app/api/variables.ts @@ -2,8 +2,8 @@ import { InjectionToken } from '@angular/core'; export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { - csv: ',', - tsv: ' ', - ssv: ' ', - pipes: '|', -}; + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +} From 7e8a7966233b01752cd906b9a26e0cd368ab291c Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:06:48 +0200 Subject: [PATCH 32/92] moved getPatentById logic from allPatentsSearchClient to PatentSearchClient --- service/src/main/inse/patents/all/logic.py | 69 ------------- service/src/main/inse/patents/all/service.py | 10 -- .../inse/patents/elastic_search_client.py | 97 ++++++++++++++----- service/src/main/inse/patents/logic.py | 12 ++- service/src/main/inse/patents/service.py | 5 +- 5 files changed, 87 insertions(+), 106 deletions(-) diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index c3e54ed4..f18b6a8d 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -18,11 +18,6 @@ from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClien from inse.patents.ipc_search_client import IpcSearchClient from inse.patents.search_client import PatentSearchClient - - -def normalize_patent_date(date_str: str) -> str: - return datetime.strptime(date_str.strip(), "%Y-%m-%d").strftime("%Y%m%d") - async def get_all_patents( page: int = 0, size: int = 10, @@ -88,67 +83,3 @@ async def get_all_patents( size=size, patents=patents, ) - -async def _search_by_id( - client: AllPatentsSearchClient, - patent_id: str, - prefix: str | None = None, - filling_date: str | None = None -) -> list[model.PatentEntry]: - - if prefix == "US": - data = await client.search_uspto(client.uspto_detail_query(patent_id, filling_date=filling_date)) - return parse_uspto_hits(data) - data = await client.search_epo(client.epo_detail_query(patent_id, filling_date=filling_date)) - return parse_epo_hits(data) - - -async def _search_by_title( - client: AllPatentsSearchClient, - title: str, - prefix: str | None = None, - filling_date: str | None = None -) -> list[model.PatentEntry]: - epo_data, uspto_data = await asyncio.gather( - client.search_epo(client.epo_title_query(title, filling_date=filling_date)), - client.search_uspto(client.uspto_title_query(title,filling_date=filling_date)), - ) - return parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) - - -async def get_patent_by_id( - patent_id: str, - title: str | None = None, - prefix: str | None = None, - filling_date: str | None = None, - ipc_client: IpcSearchClient | None = None, -) -> model.PatentEntry: - all_patents_client = AllPatentsSearchClient() - ipc_search_client = ipc_client or IpcSearchClient() - if filling_date: - filling_date = normalize_patent_date(filling_date) - try: - patents = await _search_by_id(all_patents_client, patent_id,prefix=prefix, filling_date=filling_date) - - if not patents: - patents = await _search_by_title(all_patents_client, title,prefix=prefix,filling_date=filling_date) if title else [] - - if not patents: - raise HTTPException( - status_code=HTTP_404_NOT_FOUND, - detail="Patent not found.", - ) - - except MissingApiKeyError as exc: - raise HTTPException( - status_code=HTTP_503_SERVICE_UNAVAILABLE, - detail="Patent search is not configured.", - ) from exc - except httpx.HTTPError as exc: - raise HTTPException( - status_code=HTTP_502_BAD_GATEWAY, - detail="Patent search request failed.", - ) from exc - - await enrich_patents_classifications(patents[:1], ipc_search_client) - return patents[0] \ No newline at end of file diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py index 4716251c..a620c93c 100644 --- a/service/src/main/inse/patents/all/service.py +++ b/service/src/main/inse/patents/all/service.py @@ -33,13 +33,3 @@ async def get_all_patents( year_from=year_from, year_to=year_to, ) - - -@router.get( - "/patents/{patent_id}", - operation_id="getPatentById", - response_model=model.PatentEntry, - summary="Get a single patent by its identifier.", -) -async def get_patent_by_id(patent_id: str, title: str | None = None, prefix: str | None = None, filling_date: str | None = None): - return await logic.get_patent_by_id(patent_id, title=title, prefix=prefix, filling_date=filling_date) \ No newline at end of file diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 20221efb..4b6d8b02 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -6,21 +6,27 @@ from typing import Any from inse.integrations import elasticsearch from inse.model import ESCluster, ESIndex +import httpx import asyncio from .. import config from .name_matching import search_name_variants DEFAULT_SEARCH_SIZE = 100 +def remove_year(patent_number: str) -> str: + """Remove a 4-digit year from the end of a patent number, if present.""" + if len(patent_number) > 4 and patent_number[-4:].isdigit(): + return patent_number[:-4] + return patent_number def _match_name_field(field: str, name: str) -> dict[str, Any]: """Match a name field, including transliterated variants (Müller/Mueller).""" variants = search_name_variants(name) if len(variants) <= 1: - return {"match": {field: variants[0] if variants else name}} + return {"match_phrase": {field: variants[0] if variants else name}} return { "bool": { - "should": [{"match": {field: variant}} for variant in variants], + "should": [{"match_phrase": {field: variant}} for variant in variants], "minimum_should_match": 1, } } @@ -32,9 +38,15 @@ from inse.exceptions import MissingApiKeyError class PatentSearchClient: def __init__( self, + base_url: str | None = None, api_key: str | None = None, + timeout: float = 30.0, + transport: httpx.AsyncBaseTransport | None = None, ): + self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key + self.timeout = timeout + self.transport = transport def _headers(self) -> dict[str, str]: if not self.api_key: @@ -158,9 +170,11 @@ class PatentSearchClient: } async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: + print("Searching EPO with payload:", payload) return await self._search(ESIndex.EPO_INDEX, payload) async def search_uspto(self, payload: dict[str, Any]) -> dict[str, Any]: + print("Searching USPTO with payload:", payload) return await self._search(ESIndex.USPTO_INDEX, payload) async def _search(self, index: str, payload: dict[str, Any]) -> dict[str, Any]: @@ -172,9 +186,10 @@ class PatentSearchClient: patent_id: str, prefix: str, title: str, + filling_date: str | None = None, size: int = 1, ) -> dict[str, Any]: - """Search EPO and USPTO by ID; fall back to match_phrase on title if no hits. + """Search EPO and USPTO by ID; fall back to match on title if no hits. Args: patent_id: The raw document/publication number (e.g. "1234567", "US1234567A"). @@ -202,16 +217,28 @@ class PatentSearchClient: return epo_result if epo_hits > 0 else uspto_result if prefix.upper() == "US": - payload = self._uspto_query_by_title(title, size) + payload = self._uspto_query_by_title(title, filling_date, size) return await self.search_uspto(payload) - payload = self._epo_query_by_title(title, size) + payload = self._epo_query_by_title(title,filling_date, size) return await self.search_epo(payload) + #query builders def _epo_query_by_id(self, patent_id: str, size: int) -> dict[str, Any]: """Term query against doc_number; strips a leading 'EP' prefix if present.""" raw_id = patent_id.upper().removeprefix("EP") + query: dict[str, Any] = { + "bool": { + "should": [ + {"term": {"doc_number": raw_id}}, + {"term": {"doc_number": remove_year(raw_id)}}, + {"term": {"application_number": remove_year(raw_id)}}, + {"term": {"application_number": raw_id}}, + ], + "minimum_should_match": 1, + } + } return { "size": size, "_source": [ @@ -220,11 +247,23 @@ class PatentSearchClient: "application_filing_date", "title_en", "title_de", "abstract", "inventors_name", "applicants_name", "ipc", "cpc", ], - "query": {"term": {"doc_number": raw_id}}, + "query": query, } def _uspto_query_by_id(self, patent_id: str, size: int) -> dict[str, Any]: """Term query against publication_number; tries the ID as-is.""" + raw_id = patent_id.upper().removeprefix("US") + query: dict[str, Any] = { + "bool": { + "should": [ + {"term": {"publication_number": raw_id}}, + {"term": {"publication_number": remove_year(raw_id)}}, + {"term": {"application_number": raw_id}}, + {"term": {"application_number": remove_year(raw_id)}}, + ], + "minimum_should_match": 1, + } + } return { "size": size, "track_total_hits": True, @@ -235,11 +274,24 @@ class PatentSearchClient: "application_type", "title", "abstract", "inventors_names", "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], - "query": {"term": {"publication_number": patent_id}}, + "query": query, } - def _epo_query_by_title(self, title: str, size: int) -> dict[str, Any]: - """match_phrase fallback on title_en (and title_de as a should clause).""" + def _epo_query_by_title(self, title: str, filling_date: str | None, size: int) -> dict[str, Any]: + """match fallback on title_en (and title_de as a should clause).""" + query: dict[str, Any] = { + "bool": { + "should": [ + {"match_phrase": {"title_en": title}}, + {"match_phrase": {"title_de": title}}, + {"match_phrase": {"title_fr": title}}, + ], + "minimum_should_match": 1, + } + } + if filling_date: + query["bool"]["must"] = [{"term": {"application_filing_date": filling_date}}] + return { "size": size, "_source": [ @@ -248,20 +300,19 @@ class PatentSearchClient: "application_filing_date", "title_en", "title_de", "abstract", "inventors_name", "applicants_name", "ipc", "cpc", ], - "query": { - "bool": { - "should": [ - {"match_phrase": {"title_en": title}}, - {"match_phrase": {"title_de": title}}, - {"match_phrase": {"title_fr": title}}, - ], - "minimum_should_match": 1, - } - }, + "query": query } - def _uspto_query_by_title(self, title: str, size: int) -> dict[str, Any]: - """match_phrase fallback on title.""" + def _uspto_query_by_title(self, title: str, filling_date: str | None, size: int) -> dict[str, Any]: + """match fallback on title.""" + query: dict[str, Any] = { + "bool": { + "should": [{"match_phrase": {"title": title}}], + "minimum_should_match": 1, + } + } + if filling_date: + query["bool"]["must"] = [{"term": {"application_date": filling_date}}] return { "size": size, "_source": [ @@ -270,5 +321,5 @@ class PatentSearchClient: "application_type", "title", "abstract", "inventors_names", "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], - "query": {"match_phrase": {"title": title}}, - } \ No newline at end of file + "query": query, + } diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index 434e473f..6d2522c4 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -1,5 +1,5 @@ """Backward-compatible re-exports.""" -from inse.patents.all.logic import get_all_patents, get_patent_by_id +from inse.patents.all.logic import get_all_patents from inse.patents.authors.logic import get_patents_by_author_id from inse.patents.common.parsing import deduplicate_patents as _deduplicate_patents from inse.patents.institutions.logic import ( @@ -20,22 +20,28 @@ from .elastic_search_all_patents_client import AllPatentsSearchClient from .ipc_search_client import IpcSearchClient from .ipc_lookup import extract_ipc_symbol from .name_matching import name_matches - +from datetime import datetime logger = logging.getLogger(__name__) - +def normalize_patent_date(date_str: str) -> str: + return datetime.strptime(date_str.strip(), "%Y-%m-%d").strftime("%Y%m%d") + async def get_patent( patent_id: str, title: str, prefix: str, + filling_date: str | None = None, client: PatentSearchClient | None = None, ) -> model.PatentEntry: search_client = client or PatentSearchClient() + if filling_date: + filling_date = normalize_patent_date(filling_date) data = await search_client.get_by_id_or_title( patent_id=patent_id, prefix=prefix, title=title, + filling_date=filling_date, ) parse = _parse_uspto_hits if prefix.upper() == "US" else _parse_epo_hits diff --git a/service/src/main/inse/patents/service.py b/service/src/main/inse/patents/service.py index 5c0f2948..39b30968 100644 --- a/service/src/main/inse/patents/service.py +++ b/service/src/main/inse/patents/service.py @@ -40,8 +40,11 @@ async def get_patent_by_identifier( description="Do we want to fallback to title search if ID and DOI dont work?" ), ] = "", + filling_date: Annotated[ + Optional[str], Query(description="Filling date in YYYY-MM-DD format") + ] = "", ) -> model.PatentEntry | None: - return await logic.get_patent(patent_id=identifier, prefix=prefix, title=title) + return await logic.get_patent(patent_id=identifier, prefix=prefix, title=title,filling_date=filling_date) @patents_router.get( From 074e237c84735cbcc6cff7b9ca98fc51db51f3de Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:07:37 +0200 Subject: [PATCH 33/92] updated endpoint for patent fetching --- webapp/src/app/modules/patent-detail/patent-detail.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.ts b/webapp/src/app/modules/patent-detail/patent-detail.component.ts index 891b2965..5052d8db 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.ts +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.ts @@ -125,7 +125,7 @@ export class PatentDetailComponent implements OnInit { this.expandedClassificationKeys.clear(); this.patentsService - .getPatentById(patentId, title, prefix, fillingDate) + .getPatentByIdOrTitle(patentId, prefix, title, fillingDate) .pipe(finalize(() => (this.loading = false))) .subscribe({ next: (patent) => { From 7bd8659638b6570966628c7f660146ee42ea4fdc Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:08:27 +0200 Subject: [PATCH 34/92] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 7 + webapp/src/app/api/api/api.ts | 2 + webapp/src/app/api/api/patents.service.ts | 257 ++++ webapp/src/app/api/api/topics.service.ts | 1280 ++++++++++++----- webapp/src/app/api/model/keywordTopicMatch.ts | 15 + .../app/api/model/keywordsTopicsRequest.ts | 16 + .../app/api/model/keywordsTopicsResponse.ts | 17 + webapp/src/app/api/model/models.ts | 8 + 8 files changed, 1225 insertions(+), 377 deletions(-) create mode 100644 webapp/src/app/api/model/keywordTopicMatch.ts create mode 100644 webapp/src/app/api/model/keywordsTopicsRequest.ts create mode 100644 webapp/src/app/api/model/keywordsTopicsResponse.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index c5db7482..baf4dbd8 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -9,6 +9,7 @@ api/companyConnections.service.ts api/funding.service.ts api/iNSEService.service.ts api/institutions.service.ts +api/keywords.service.ts api/news.service.ts api/organization.service.ts api/patents.service.ts @@ -123,8 +124,12 @@ model/institutionNetworkNode.ts model/institutionPage.ts model/institutionsListResponse.ts model/ipcClassification.ts +model/keywordEntry.ts +model/keywordTopicMatch.ts model/keywords.ts model/keywordsRequest.ts +model/keywordsTopicsRequest.ts +model/keywordsTopicsResponse.ts model/latitude.ts model/location.ts model/loginResponse.ts @@ -139,6 +144,8 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts +model/orgPatentEntry.ts +model/orgPatentsResponse.ts model/organizationPage.ts model/patentEntry.ts model/patentsByAuthorResponse.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 562911e2..8ea55e0b 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -27,12 +27,14 @@ import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; export const APIS = [ + AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, + OrganizationService, PatentsService, PersonNetworkService, PersonsService, diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 3eb47897..904279c3 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -206,12 +206,158 @@ export class PatentsService extends BaseService { ); } + /** + * Get pre-indexed org patents for an institution. + * @endpoint get /api/inse-service/institutions/{id}/org-patents + * @param id + * @param matchType Filter patents by match type. + * @param page + * @param size + * @param source + * @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 getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (id === null || id === undefined) { + throw new Error( + 'Required parameter id was null or undefined when calling getOrgPatentsByInstitution.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + matchType, + 'match_type', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + size, + 'size', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + source, + 'source', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/org-patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + /** * Returns one publication by OpenAlex ID or DOI. * @endpoint get /api/inse-service/patents/{identifier} * @param identifier * @param prefix Application Prefix (EP or US) * @param title Do we want to fallback to title search if ID and DOI dont work? + * @param fillingDate Filling date in YYYY-MM-DD format * @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. */ @@ -219,6 +365,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: { @@ -231,6 +378,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: { @@ -243,6 +391,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: { @@ -255,6 +404,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: { @@ -280,6 +430,11 @@ export class PatentsService extends BaseService { title, 'title', ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + fillingDate, + 'filling_date', + ); let localVarHeaders = this.defaultHeaders; @@ -432,4 +587,106 @@ export class PatentsService extends BaseService { }, ); } + + /** + * Get patents matched to an institution by assignee name. + * @endpoint get /api/inse-service/institutions/{id}/patents + * @param id + * @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 getPatentsByInstitution( + id: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getPatentsByInstitution( + id: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getPatentsByInstitution( + id: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getPatentsByInstitution( + id: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (id === null || id === undefined) { + throw new Error( + 'Required parameter id was null or undefined when calling getPatentsByInstitution.', + ); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } } diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 6f17a01e..5a51e233 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,428 +9,954 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent, + HttpParameterCodec, + HttpContext, +} from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AutocompleteResponse } from '../model/autocompleteResponse'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore +import { KeywordsTopicsRequest } from '../model/keywordsTopicsRequest'; +// @ts-ignore +import { KeywordsTopicsResponse } from '../model/keywordsTopicsResponse'; +// @ts-ignore import { TopicsListResponse } from '../model/topicsListResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; - - @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class TopicsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { - super(basePath, configuration); + /** + * Returns topic options for autocomplete inputs. + * @endpoint get /api/topics/autocomplete + * @param query Topic search text, for example \'machine learning\'. + * @param domainId Optional OpenAlex domain id filter. + * @param fieldId Optional OpenAlex field id filter. + * @param subfieldId Optional OpenAlex subfield id filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling autocompleteTopics.', + ); } - /** - * Returns topic options for autocomplete inputs. - * @endpoint get /api/topics/autocomplete - * @param query Topic search text, for example \'machine learning\'. - * @param domainId Optional OpenAlex domain id filter. - * @param fieldId Optional OpenAlex field id filter. - * @param subfieldId Optional OpenAlex subfield id filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (query === null || query === undefined) { - throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.'); - } + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + domainId, + 'domainId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + fieldId, + 'fieldId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + subfieldId, + 'subfieldId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - query, 'query'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - domainId, 'domainId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - fieldId, 'fieldId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - subfieldId, 'subfieldId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - limit, 'limit'); + let localVarHeaders = this.defaultHeaders; - let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; - const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + let localVarPath = `/api/topics/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + /** + * Builds the topic hierarchy cache. + * @endpoint get /api/inse-service/topics/cache + * @param pageSize Page size for each search page. + * @param saveJson Persist cache JSON to data folder. + * @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 buildTopicCache( + pageSize?: number, + saveJson?: boolean, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public buildTopicCache( + pageSize?: number, + saveJson?: boolean, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public buildTopicCache( + pageSize?: number, + saveJson?: boolean, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public buildTopicCache( + pageSize?: number, + saveJson?: boolean, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + pageSize, + 'page_size', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + saveJson, + 'save_json', + ); - let localVarPath = `/api/topics/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy( + topic: Array, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public countTopicHierarchy( + topic: Array, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public countTopicHierarchy( + topic: Array, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public countTopicHierarchy( + topic: Array, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (topic === null || topic === undefined) { + throw new Error( + 'Required parameter topic was null or undefined when calling countTopicHierarchy.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + element, + 'topic', ); + }); } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + let localVarHeaders = this.defaultHeaders; - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - pageSize, 'page_size'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - saveJson, 'save_json'); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (topic === null || topic === undefined) { - throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); - } + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'topic'); - }) - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } } - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } - let localVarHeaders = this.defaultHeaders; + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy( + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getTopicHierarchy( + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTopicHierarchy( + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTopicHierarchy( + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/hierarchy`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * Returns a list of OpenAlex topics. - * @endpoint get /api/topics - * @param search Full-text search, for example \'machine learning\'. - * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'domain.id\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - search, 'search'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - filter, 'filter'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sort, 'sort'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - groupBy, 'group_by'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - perPage, 'per_page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - cursor, 'cursor'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sample, 'sample'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - select, 'select'); + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } } - /** - * Semantic / vector search for topics using a keyword/sentence. - * @endpoint get /api/topics/vector-search - * @param query Word or sentence to search by similarity. - * @param limit Maximum number of topics to return. - * @param searchType Search approach: \'hybrid\' or \'semantic\'. - * @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 vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (query === null || query === undefined) { - throw new Error('Required parameter query was null or undefined when calling vectorSearchTopics.'); - } + let localVarPath = `/api/inse-service/topics/hierarchy`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - query, 'query'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - limit, 'limit'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - searchType, 'searchType'); + /** + * Returns a list of OpenAlex topics. + * @endpoint get /api/topics + * @param search Full-text search, for example \'machine learning\'. + * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'domain.id\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + search, + 'search', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + filter, + 'filter', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sort, + 'sort', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + groupBy, + 'group_by', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + perPage, + 'per_page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + cursor, + 'cursor', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sample, + 'sample', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + select, + 'select', + ); - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics/vector-search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Semantic / vector search for topics using a keyword/sentence. + * @endpoint get /api/topics/vector-search + * @param query Word or sentence to search by similarity. + * @param limit Maximum number of topics to return. + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling vectorSearchTopics.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + searchType, + 'searchType', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics/vector-search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Batch semantic / vector search for multiple keywords. + * @endpoint post /api/topics/vector-search/batch + * @param keywordsTopicsRequest + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (keywordsTopicsRequest === null || keywordsTopicsRequest === undefined) { + throw new Error( + 'Required parameter keywordsTopicsRequest was null or undefined when calling vectorSearchTopicsBatch.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + searchType, + 'searchType', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = + this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Content-Type', + httpContentTypeSelected, + ); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics/vector-search/batch`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'post', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsTopicsRequest, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } } diff --git a/webapp/src/app/api/model/keywordTopicMatch.ts b/webapp/src/app/api/model/keywordTopicMatch.ts new file mode 100644 index 00000000..ee4c8326 --- /dev/null +++ b/webapp/src/app/api/model/keywordTopicMatch.ts @@ -0,0 +1,15 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Topic } from './topic'; + +export interface KeywordTopicMatch { + keyword: string; + topic?: Topic | null; +} diff --git a/webapp/src/app/api/model/keywordsTopicsRequest.ts b/webapp/src/app/api/model/keywordsTopicsRequest.ts new file mode 100644 index 00000000..883ed079 --- /dev/null +++ b/webapp/src/app/api/model/keywordsTopicsRequest.ts @@ -0,0 +1,16 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export interface KeywordsTopicsRequest { + /** + * List of keywords/sentences to query by similarity. + */ + keywords: Array; +} diff --git a/webapp/src/app/api/model/keywordsTopicsResponse.ts b/webapp/src/app/api/model/keywordsTopicsResponse.ts new file mode 100644 index 00000000..78a2f9d2 --- /dev/null +++ b/webapp/src/app/api/model/keywordsTopicsResponse.ts @@ -0,0 +1,17 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordTopicMatch } from './keywordTopicMatch'; + +export interface KeywordsTopicsResponse { + /** + * Top matching topics for each keyword in the requested list. + */ + results: Array; +} diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index c0b5826d..282cf11e 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -49,6 +49,8 @@ export * from './euCordisProjectResponse'; export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; export * from './euProjectData'; +export * from './extractedKeywords'; +export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; export * from './fp7EurosciVoc'; @@ -98,8 +100,12 @@ export * from './institutionNetworkNode'; export * from './institutionPage'; export * from './institutionsListResponse'; export * from './ipcClassification'; +export * from './keywordEntry'; +export * from './keywordTopicMatch'; export * from './keywords'; export * from './keywordsRequest'; +export * from './keywordsTopicsRequest'; +export * from './keywordsTopicsResponse'; export * from './latitude'; export * from './location'; export * from './loginResponse'; @@ -113,6 +119,8 @@ export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; +export * from './orgPatentEntry'; +export * from './orgPatentsResponse'; export * from './organizationPage'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; From f0173cbf8a4ab1c219764e07b0988354a6b9a713 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:25:16 +0200 Subject: [PATCH 35/92] increased llm response timeout up to 120s --- service/src/main/inse/integrations/llm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index 3d2dc536..39924953 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -9,7 +9,7 @@ def call( model: str = None, json_schema = None, schema_name = None, - timeout: int = 60, + timeout: int = 120, temperature: float = 1.0, top_p: float = 0.95, ) -> str: @@ -66,7 +66,7 @@ async def call_stream( model: str = None, json_schema=None, schema_name=None, - timeout: int = 60, + timeout: int = 120, temperature: float = 1.0, top_p: float = 0.95, ) -> str: From 6db4c80258622354528e50c6e6518dacf96c592b Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:07 +0200 Subject: [PATCH 36/92] adden dynamic keywords enriching with openalex topics --- service/src/main/inse/keywords/logic.py | 259 ++++++++++++++++++++-- service/src/main/inse/keywords/model.py | 24 +- service/src/main/inse/keywords/service.py | 59 ++++- 3 files changed, 306 insertions(+), 36 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index 81286797..b2017297 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -5,6 +5,7 @@ Business logic for persons / authors. """ import asyncio from typing import Any, Dict, List + import partial_json_parser import json import logging @@ -15,49 +16,88 @@ from pydantic import ValidationError from typing import Awaitable, Callable from inse.keywords.prompts import KeywordsPrompt from inse.integrations import llm -from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse, KeywordEntry, KeywordsWsEvent +from inse.keywords.model import ( + ExtractedKeywords, + ExtractedKeywordsLLM, + ExtractedKeywordsResponse, + KeywordEntry, + KeywordEntryWithTopic, + KeywordsWsEvent, +) +from inse.topics.logic import vector_search_topics_batch logger = logging.getLogger(__name__) EventCallback = Callable[[dict], Awaitable[None]] +LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") -def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: + +def _build_enriched_snapshot( + confirmed: Dict[str, List[KeywordEntryWithTopic]], +) -> ExtractedKeywords: + return ExtractedKeywords.model_validate( + {level: [item.model_dump() for item in confirmed.get(level, [])] for level in LEVELS} + ) + + +async def _enrich_llm_keywords(results: ExtractedKeywordsLLM) -> ExtractedKeywords: + confirmed: Dict[str, List[KeywordEntryWithTopic]] = { + level: [KeywordEntryWithTopic(llm_keyword=item) for item in getattr(results, level)] + for level in LEVELS + } + + keywords: List[str] = [] + positions: List[tuple[str, int]] = [] + for level in LEVELS: + for idx, entry in enumerate(getattr(results, level)): + keywords.append(entry.keyword) + positions.append((level, idx)) + + if keywords: + matches = await vector_search_topics_batch(keywords=keywords, search_type="hybrid") + for (level, idx), match in zip(positions, matches.results): + confirmed[level][idx].topic_mapping = match + + return _build_enriched_snapshot(confirmed) + +async def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: """ Extracts keywords from the given text or URL using a language model. """ start_time = time.time() if mode == "url": - text = _get_text_content(query) + text = await _get_text_content(query) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT text = query - - system_prompt + user_prompt = f""" Now analyze the following text and return ONLY the JSON object.\n""" if limit: - user_prompt +="Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" + user_prompt +=f"Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" user_prompt += f"""Input:{text}""" keywords = llm.call( system_prompt=system_prompt, user_prompt=user_prompt, - json_schema = ExtractedKeywords.model_json_schema(), + json_schema = ExtractedKeywordsLLM.model_json_schema(), schema_name = "extracted_keywords", temperature=0.8, top_p=0.95, ) keywords_json = json.loads(keywords) + validated = ExtractedKeywordsLLM.model_validate(keywords_json) + enriched = await _enrich_llm_keywords(validated) elapsed_time = time.time() - start_time logger.info(f"Keyword extraction took {elapsed_time:.2f} seconds") - return ExtractedKeywordsResponse(results=keywords_json, source=mode, source_url=query if mode == "url" else None, source_content=text) + return ExtractedKeywordsResponse(results=enriched, source=mode, source_url=query if mode == "url" else None, source_content=text, duration=elapsed_time) -def _get_text_content(url: str) -> str: +async def _get_text_content(url: str) -> str: """ Fetches the HTML content from the given URL using httpx and extracts visible text. """ @@ -69,8 +109,8 @@ def _get_text_content(url: str) -> str: "Chrome/91.0.4472.124 Safari/537.36" ) } - with httpx.Client(timeout=30.0) as client: - response = client.get(url, headers=headers) + async with httpx.AsyncClient(timeout=30.0) as client: + response = await client.get(url, headers=headers) response.raise_for_status() soup = BeautifulSoup(response.text, "html.parser") @@ -78,7 +118,6 @@ def _get_text_content(url: str) -> str: element.decompose() text = soup.get_text(separator=" ", strip=True) text = " ".join(text.split()) - print(f"Extracted text from {url}: {text[:200]}...") # Print the first 200 characters of the extracted text return text except httpx.HTTPError as e: @@ -99,14 +138,13 @@ async def extract_keywords_stream( if mode == "url": await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) - text = _get_text_content(query) + text = await _get_text_content(query) await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT - user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" if limit: user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" @@ -120,11 +158,11 @@ async def extract_keywords_stream( confirmed: Dict[str, List[Dict[str, Any]]] = {level: [] for level in LEVELS} async def emit_full_results() -> None: - """Attempt to build and validate the full ExtractedKeywords model and emit it.""" + """Attempt to build and validate the full ExtractedKeywordsLLM model and emit it.""" # Build a dict with all three fields, using empty lists for missing ones data = {level: confirmed.get(level, []) for level in LEVELS} try: - validated = ExtractedKeywords.model_validate(data) + validated = ExtractedKeywordsLLM.model_validate(data) except ValidationError: # Should not happen if all items are valid, but guard against it return @@ -156,7 +194,6 @@ async def extract_keywords_stream( validated_item = KeywordEntry.model_validate(raw_item) except ValidationError: break # item not complete yet - confirmed[level].append(validated_item.model_dump()) idx += 1 grew = True @@ -178,7 +215,7 @@ async def extract_keywords_stream( llm.call_stream( system_prompt=system_prompt, user_prompt=user_prompt, - json_schema=ExtractedKeywords.model_json_schema(), + json_schema=ExtractedKeywordsLLM.model_json_schema(), schema_name="extracted_keywords", temperature=0.8, top_p=0.95, @@ -208,10 +245,10 @@ async def extract_keywords_stream( # Final emission of the full results (in case the last chunk didn't trigger it) final_data = {level: confirmed.get(level, []) for level in LEVELS} try: - final_validated = ExtractedKeywords.model_validate(keywords_json) + final_validated = ExtractedKeywordsLLM.model_validate(keywords_json) except ValidationError: # Fallback: use our confirmed data - final_validated = ExtractedKeywords.model_validate(final_data) + final_validated = ExtractedKeywordsLLM.model_validate(final_data) elapsed_time = time.time() - start_time result = ExtractedKeywordsResponse( @@ -222,4 +259,186 @@ async def extract_keywords_stream( duration=elapsed_time, ) + return result + + +async def extract_keywords_stream_enriched( + query: str, + mode: str, + limit: int, + emit: EventCallback, +) -> ExtractedKeywordsResponse: + start_time = time.time() + timeout_seconds = 120 + await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + + if mode == "url": + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + text = await _get_text_content(query) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + else: + text = query + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + + user_prompt = "\nNow analyze the following text.\n" + if limit: + user_prompt += f"\nExtract exactly {limit} keywords for each level.\n" + user_prompt += f"\nInput:\n{text}" + + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + + LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") + + # Holds enriched keyword wrappers for each level + confirmed: Dict[str, List[KeywordEntryWithTopic]] = {level: [] for level in LEVELS} + + # Track background enrichment tasks + enrichment_tasks: List[asyncio.Task] = [] + + async def emit_full_results() -> None: + """Attempt to build and emit the full enriched keyword model.""" + try: + validated = _build_enriched_snapshot(confirmed) + except ValidationError: + return + await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump()) + + async def get_openalex_topic(level: str, idx: int, item: KeywordEntry) -> None: + """ + Fetch/enrich metadata for a single keyword. + Runs concurrently without blocking the LLM stream. + """ + try: + topic = await vector_search_topics_batch( + keywords=[item.keyword], + search_type="hybrid", + ) + # Update the shared confirmed list in-place (safe in asyncio) + confirmed[level][idx].topic_mapping = topic.results[0] if topic.results else None + + # Emit the full updated set after each enrichment so the frontend sees progress. + await emit_full_results() + + except asyncio.CancelledError: + # If the whole request is cancelled, we can just re-raise + raise + except Exception as e: + logger.error(f"Error fetching OpenAlex topic for keyword '{item.keyword}': {e}") + await emit_full_results() + + # ---------- on_chunk: parses LLM stream and appends new keywords ---------- + async def on_chunk(event: Dict[str, Any]) -> None: + if event["type"] != "llm_chunk": + await emit(event) + return + + try: + partial = partial_json_parser.loads(event.get("_full_content", "")) + except Exception: + return + + if not isinstance(partial, dict): + return + + grew = False + + for level in LEVELS: + current = partial.get(level) or [] + start_idx = len(confirmed[level]) # Where we start appending + + while len(confirmed[level]) < len(current): + raw_item = current[len(confirmed[level])] + try: + validated_item = KeywordEntry.model_validate(raw_item) + except ValidationError: + break # item not complete yet + + confirmed[level].append(KeywordEntryWithTopic(llm_keyword=validated_item)) + grew = True + + # Launch openalex topic mapping + for idx in range(start_idx, len(confirmed[level])): + keyword_text = confirmed[level][idx].llm_keyword.keyword + await emit( + KeywordsWsEvent( + type="status", + step="enriching", + message=f"Enriching keyword '{keyword_text}' at level '{level}'", + ).model_dump() + ) + task = asyncio.create_task(get_openalex_topic(level, idx, confirmed[level][idx].llm_keyword)) + enrichment_tasks.append(task) + + if grew: + await emit_full_results() + + # ---------- Accumulate full_content for incremental parsing ---------- + full_content_holder = {"value": ""} + + async def emit_wrapper(event: Dict[str, Any]) -> None: + if event["type"] == "llm_chunk": + full_content_holder["value"] += event["content"] + event = {**event, "_full_content": full_content_holder["value"]} + await on_chunk(event) + + # ---------- Call the LLM ---------- + try: + keywords = await asyncio.wait_for( + llm.call_stream( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema=ExtractedKeywordsLLM.model_json_schema(), + schema_name="extracted_keywords", + temperature=0.0, + top_p=0.95, + emit=emit_wrapper, + ), + timeout=timeout_seconds, + ) + except asyncio.TimeoutError: + await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump()) + raise RuntimeError("LLM streaming call timed out") + except asyncio.CancelledError: + # Cancel all pending enrichment tasks to avoid dangling background work + for task in enrichment_tasks: + task.cancel() + if enrichment_tasks: + await asyncio.gather(*enrichment_tasks, return_exceptions=True) + await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump()) + raise + + # ---------- Finalize ---------- + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + + try: + keywords_json = json.loads(keywords) + except json.JSONDecodeError as e: + await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump()) + raise RuntimeError("LLM response is not valid JSON") + + # ---------- Wait for ALL pending enrichments to complete ---------- + if enrichment_tasks: + await asyncio.gather(*enrichment_tasks, return_exceptions=True) + + await emit_full_results() + + # Build final response + try: + final_validated = _build_enriched_snapshot(confirmed) + except ValidationError: + final_validated = ExtractedKeywords.model_validate( + {level: [item.model_dump() for item in confirmed.get(level, [])] for level in LEVELS} + ) + + elapsed_time = time.time() - start_time + result = ExtractedKeywordsResponse( + results=final_validated, + source=mode, + source_url=query if mode == "url" else None, + source_content=text, + duration=elapsed_time, + ) + return result \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py index 3e86a01d..d2c9239e 100644 --- a/service/src/main/inse/keywords/model.py +++ b/service/src/main/inse/keywords/model.py @@ -3,10 +3,11 @@ """ Data models for persons / authors. """ -from pydantic import BaseModel -from pydantic import Field -from typing import List +from typing import List, Literal +from pydantic import BaseModel, Field + +from inse.topics.model import KeywordTopicMatch class KeywordsRequest(BaseModel): query: str = Field(description="The input text from which to extract keywords.") mode: str = Field(description="The mode of keyword extraction, e.g., 'url', 'text', or 'keywords'.") @@ -15,14 +16,27 @@ class KeywordsRequest(BaseModel): class KeywordEntry(BaseModel): keyword: str = Field(description="The extracted keyword.") relevance_score: float = Field(description="The relevance score of the keyword.") + +class KeywordEntryWithTopic(BaseModel): + llm_keyword: KeywordEntry = Field(description="The keyword extracted by the LLM.") + topic_mapping: KeywordTopicMatch | None = Field( + default=None, + description="The corresponding OpenAlex topic match for the keyword, if any.", + ) class ExtractedKeywords(BaseModel): + broad_keywords: List[KeywordEntryWithTopic] = Field(description="The extracted broad keywords from text.") + coarse_grained: List[KeywordEntryWithTopic] = Field(description="The extracted coarse-grained keywords from text.") + fine_grained: List[KeywordEntryWithTopic] = Field(description="The extracted fine-grained keywords from text.") + +class ExtractedKeywordsLLM(BaseModel): broad_keywords: List[KeywordEntry] = Field(description="The extracted broad keywords from text.") coarse_grained: List[KeywordEntry] = Field(description="The extracted coarse-grained keywords from text.") fine_grained: List[KeywordEntry] = Field(description="The extracted fine-grained keywords from text.") class ExtractedKeywordsResponse(BaseModel): - results: ExtractedKeywords = Field(description="The extracted keywords from the input text.") + results_llm: ExtractedKeywordsLLM | None = None + results: ExtractedKeywords | None = None source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") source_content: str = Field(description="The actual content from which keywords were extracted.") @@ -33,7 +47,7 @@ class KeywordsWsEvent(BaseModel): step: str | None = None message: str | None = None result: ExtractedKeywordsResponse | None = None - keywords: ExtractedKeywords | None = None + keywords: ExtractedKeywords | ExtractedKeywordsLLM | None = None duration: float | None = None completed: str | None = None \ No newline at end of file diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py index bac0eaba..ae207f1c 100644 --- a/service/src/main/inse/keywords/service.py +++ b/service/src/main/inse/keywords/service.py @@ -4,9 +4,11 @@ REST API for persons / authors. """ +import asyncio from typing import Annotated -from fastapi import Body, WebSocket, WebSocketDisconnect -from fastapi import APIRouter + +from fastapi import APIRouter, Body, WebSocket, WebSocketDisconnect + from . import logic from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest @@ -24,26 +26,61 @@ async def extract_keywords_ws(websocket: WebSocket): try: raw = await websocket.receive_json() request = KeywordsRequest(**raw) + disconnected = asyncio.Event() async def emit(event: dict): + if disconnected.is_set(): + return await websocket.send_json(event) - result = await logic.extract_keywords_stream( - query=request.query, - mode=request.mode, - limit=request.limit, - emit=emit, + async def watch_disconnect() -> None: + while True: + message = await websocket.receive() + if message["type"] == "websocket.disconnect": + disconnected.set() + return + + extraction_task = asyncio.create_task( + logic.extract_keywords_stream_enriched( + query=request.query, + mode=request.mode, + limit=request.limit, + emit=emit, + ) ) + disconnect_task = asyncio.create_task(watch_disconnect()) + + done, pending = await asyncio.wait( + {extraction_task, disconnect_task}, + return_when=asyncio.FIRST_COMPLETED, + ) + + if disconnect_task in done: + disconnected.set() + extraction_task.cancel() + try: + await extraction_task + except asyncio.CancelledError: + pass + return + + disconnect_task.cancel() + try: + await disconnect_task + except asyncio.CancelledError: + pass + result = extraction_task.result() await websocket.send_json({"type": "completed", "result": result.model_dump()}) except WebSocketDisconnect: - print("WebSocket disconnected.?") + print("WebSocket disconnected.") pass except Exception as e: await websocket.send_json({"type": "error", "message": str(e)}) finally: - await websocket.close() + if websocket.application_state.name != "DISCONNECTED": + await websocket.close() # @router.post( # "/keywords/extract", @@ -73,11 +110,11 @@ async def extract_keywords_ws(websocket: WebSocket): summary="Extracts keywords from text.", response_model_exclude_none=True, ) -def extract_keywords( +async def extract_keywords( request: Annotated[ KeywordsRequest, Body(description="Input text for keyword extraction") ], ): - return logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) + return await logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) From f38395254797fbe07bb7c08610c9d3f771329c26 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:19 +0200 Subject: [PATCH 37/92] simple prompts for testing added --- service/src/main/inse/keywords/prompts.py | 257 ++++++++++------------ 1 file changed, 118 insertions(+), 139 deletions(-) diff --git a/service/src/main/inse/keywords/prompts.py b/service/src/main/inse/keywords/prompts.py index 292630c2..f60c8fc3 100644 --- a/service/src/main/inse/keywords/prompts.py +++ b/service/src/main/inse/keywords/prompts.py @@ -104,7 +104,7 @@ class KeywordsPrompt(StrEnum): Guidelines: * Scores must be between 0.0 and 1.0. - * Use decimal precision up to 2 digits. + * Use decimal precision up to 3 digits. * Rank keywords by importance. * The most important keywords should appear first. * Broad keywords generally receive higher scores than secondary topics. @@ -128,26 +128,6 @@ class KeywordsPrompt(StrEnum): Return ONLY valid JSON. - { - "broad_keywords": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ], - "coarse_grained": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ], - "fine_grained": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ] - } --- @@ -159,66 +139,7 @@ class KeywordsPrompt(StrEnum): Output: - { - "broad_keywords": [ - { - "keyword": "Artificial Intelligence", - "relevance_score": 0.98 - }, - { - "keyword": "Manufacturing", - "relevance_score": 0.94 - }, - { - "keyword": "Industrial Automation", - "relevance_score": 0.90 - } - ], - "coarse_grained": [ - { - "keyword": "Machine Learning", - "relevance_score": 0.96 - }, - { - "keyword": "Predictive Maintenance", - "relevance_score": 0.95 - }, - { - "keyword": "Smart Factories", - "relevance_score": 0.88 - }, - { - "keyword": "Sensor Fusion", - "relevance_score": 0.86 - }, - { - "keyword": "Anomaly Detection", - "relevance_score": 0.85 - }, - { - "keyword": "Time-Series Forecasting", - "relevance_score": 0.83 - } - ], - "fine_grained": [ - { - "keyword": "Transformer Architecture", - "relevance_score": 0.95 - }, - { - "keyword": "Industrial Sensors", - "relevance_score": 0.84 - }, - { - "keyword": "Multimodal Data Fusion", - "relevance_score": 0.82 - }, - { - "keyword": "Predictive Analytics", - "relevance_score": 0.80 - } - ] - } + {"broad_keywords":[{"keyword":"ArtificialIntelligence","relevance_score":0.98},{"keyword":"Manufacturing","relevance_score":0.94},{"keyword":"IndustrialAutomation","relevance_score":0.90}],"coarse_grained":[{"keyword":"MachineLearning","relevance_score":0.96},{"keyword":"PredictiveMaintenance","relevance_score":0.95},{"keyword":"SmartFactories","relevance_score":0.88},{"keyword":"SensorFusion","relevance_score":0.86},{"keyword":"AnomalyDetection","relevance_score":0.85},{"keyword":"Time-SeriesForecasting","relevance_score":0.83}],"fine_grained":[{"keyword":"TransformerArchitecture","relevance_score":0.95},{"keyword":"IndustrialSensors","relevance_score":0.84},{"keyword":"MultimodalDataFusion","relevance_score":0.82},{"keyword":"PredictiveAnalytics","relevance_score":0.80}]} --- @@ -230,60 +151,8 @@ class KeywordsPrompt(StrEnum): Output: - { - "broad_keywords": [ - { - "keyword": "Healthcare", - "relevance_score": 0.97 - }, - { - "keyword": "Artificial Intelligence", - "relevance_score": 0.95 - }, - { - "keyword": "Digital Health", - "relevance_score": 0.89 - } - ], - "coarse_grained": [ - { - "keyword": "Large Language Models", - "relevance_score": 0.96 - }, - { - "keyword": "Clinical Decision Support", - "relevance_score": 0.92 - }, - { - "keyword": "Medical Record Analysis", - "relevance_score": 0.90 - }, - { - "keyword": "Natural Language Processing", - "relevance_score": 0.88 - } - ], - "fine_grained": [ - { - "keyword": "Retrieval-Augmented Generation", - "relevance_score": 0.95 - }, - { - "keyword": "Patient Record Summarization", - "relevance_score": 0.91 - }, - { - "keyword": "Clinical Documentation", - "relevance_score": 0.86 - }, - { - "keyword": "Medical Text Processing", - "relevance_score": 0.84 - } - ] - } - - --- + {"broad_keywords":[{"keyword":"Healthcare","relevance_score":0.97},{"keyword":"ArtificialIntelligence","relevance_score":0.95},{"keyword":"DigitalHealth","relevance_score":0.89}],"coarse_grained":[{"keyword":"LargeLanguageModels","relevance_score":0.96},{"keyword":"ClinicalDecisionSupport","relevance_score":0.92},{"keyword":"MedicalRecordAnalysis","relevance_score":0.90},{"keyword":"NaturalLanguageProcessing","relevance_score":0.88}],"fine_grained":[{"keyword":"Retrieval-AugmentedGeneration","relevance_score":0.95},{"keyword":"PatientRecordSummarization","relevance_score":0.91},{"keyword":"ClinicalDocumentation","relevance_score":0.86},{"keyword":"MedicalTextProcessing","relevance_score":0.84}]} + Return ONLY valid JSON matching the schema provided by the API. """ @@ -480,11 +349,121 @@ class KeywordsPrompt(StrEnum): * Remove duplicates across hierarchy levels whenever possible. * Rank keywords by importance. + --- + # Example 3 — News Article + + ## Input + + Apple announced a new generation of custom AI chips designed for on-device inference. The chips will power future iPhone and Mac devices, improving privacy, latency, and energy efficiency for generative AI applications. + + ## Output + + ```json{"broad_keywords":[{"keyword":"Technology","relevance_score":0.98},{"keyword":"ArtificialIntelligence","relevance_score":0.97},{"keyword":"ConsumerElectronics","relevance_score":0.92}],"coarse_grained":[{"keyword":"AIHardware","relevance_score":0.96},{"keyword":"SemiconductorDesign","relevance_score":0.93},{"keyword":"EdgeComputing","relevance_score":0.90},{"keyword":"GenerativeAI","relevance_score":0.88}],"fine_grained":[{"keyword":"On-DeviceInference","relevance_score":0.95},{"keyword":"CustomAIChips","relevance_score":0.94},{"keyword":"InferenceAcceleration","relevance_score":0.89},{"keyword":"Low-LatencyProcessing","relevance_score":0.86}]}``` + + --- + + # Example 4 — Product Page + + ## Input + + The Sony WH-1000XM6 wireless headphones feature adaptive noise cancellation, Bluetooth 5.4 connectivity, 40-hour battery life, multipoint device pairing, and spatial audio support. + + ## Output + + ```json{"broad_keywords":[{"keyword":"ConsumerElectronics","relevance_score":0.98},{"keyword":"AudioTechnology","relevance_score":0.95}],"coarse_grained":[{"keyword":"WirelessHeadphones","relevance_score":0.97},{"keyword":"NoiseCancellation","relevance_score":0.95},{"keyword":"BluetoothAudio","relevance_score":0.92}],"fine_grained":[{"keyword":"AdaptiveNoiseCancellation","relevance_score":0.96},{"keyword":"Bluetooth5.4","relevance_score":0.94},{"keyword":"MultipointPairing","relevance_score":0.89},{"keyword":"SpatialAudio","relevance_score":0.87}]}``` + + --- + + # Example 5 — Technical Documentation + + ## Input + + FastAPI is a modern Python web framework for building APIs. It provides automatic OpenAPI schema generation, dependency injection, asynchronous request handling, and data validation through Pydantic models. + + ## Output + + ```json{"broad_keywords":[{"keyword":"SoftwareDevelopment","relevance_score":0.98},{"keyword":"WebDevelopment","relevance_score":0.95}],"coarse_grained":[{"keyword":"PythonFrameworks","relevance_score":0.97},{"keyword":"APIDevelopment","relevance_score":0.95},{"keyword":"BackendEngineering","relevance_score":0.91}],"fine_grained":[{"keyword":"FastAPI","relevance_score":0.99},{"keyword":"OpenAPI","relevance_score":0.95},{"keyword":"DependencyInjection","relevance_score":0.90},{"keyword":"Pydantic","relevance_score":0.89},{"keyword":"AsynchronousRequestHandling","relevance_score":0.87}]}``` + + --- + + # Example 6 — Company Website + + ## Input + + Stripe provides online payment infrastructure for businesses. Its platform supports payment processing, subscription billing, fraud prevention, financial reporting, and global commerce operations. + + ## Output + + ```json{"broad_keywords":[{"keyword":"FinancialTechnology","relevance_score":0.98},{"keyword":"BusinessServices","relevance_score":0.91}],"coarse_grained":[{"keyword":"PaymentProcessing","relevance_score":0.97},{"keyword":"DigitalPayments","relevance_score":0.95},{"keyword":"SubscriptionManagement","relevance_score":0.90}],"fine_grained":[{"keyword":"StripePlatform","relevance_score":0.99},{"keyword":"FraudPrevention","relevance_score":0.91},{"keyword":"RecurringBilling","relevance_score":0.89},{"keyword":"GlobalPaymentInfrastructure","relevance_score":0.87}]}``` + --- Return ONLY valid JSON matching the schema provided by the API. - - The following text was extracted from a webpage: - - {{PAGE_CONTENT}} """ + + SIMPLE_TEXT_PROMPT = """ +You are a scientific and technology intelligence expert. Extract keywords from the given text into three hierarchical levels. Each keyword must include a relevance_score (0.0–1.0) indicating centrality. + +**Levels:** +- **broad_keywords** – high‑level domains/industries (e.g., Artificial Intelligence, Healthcare, Renewable Energy). +- **coarse_grained** – mid‑level technologies/methods/applications (e.g., Machine Learning, Drug Discovery, Smart Manufacturing). +- **fine_grained** – specific technical concepts, algorithms, materials, protocols (e.g., Transformer Architecture, CRISPR‑Cas9, Retrieval‑Augmented Generation). + +**Guidelines:** +- Prioritize scientific, technical, and research‑oriented terminology. +- Avoid generic business fluff: "solution", "platform", "improvement", "service", "performance" – unless they are explicit searchable concepts. +- Prefer noun phrases; avoid complete sentences. +- Extract 5–15 keywords per level when possible. +- Rank by importance (higher scores first). + +**Relevance scores:** +- 1.0 = central topic +- 0.9 = extremely important +- 0.8 = highly relevant +- 0.7 = supporting concept +- 0.6 = secondary +- Below 0.6 – use sparingly. + +**Output schema (JSON only):** +{ + "broad_keywords": [{"keyword": "string", "relevance_score": 0.0}, ...], + "coarse_grained": [...], + "fine_grained": [...] +} + +**Example:** +Input: Researchers developed a transformer-based ML framework for predictive maintenance in smart factories using sensor fusion and anomaly detection. +Output: +{ + "broad_keywords": [{"keyword": "Artificial Intelligence", "relevance_score": 0.98}, {"keyword": "Manufacturing", "relevance_score": 0.94}], + "coarse_grained": [{"keyword": "Predictive Maintenance", "relevance_score": 0.95}, {"keyword": "Anomaly Detection", "relevance_score": 0.85}], + "fine_grained": [{"keyword": "Transformer Architecture", "relevance_score": 0.95}, {"keyword": "Sensor Fusion", "relevance_score": 0.82}] +} + +Return ONLY the JSON object, nothing else. +""" + SIMPLE_WEBSITE_PROMPT = """ +You are a technology scout and scientific analyst. The input is text scraped from a webpage (using BeautifulSoup or similar). Your goal: extract keywords into three hierarchical levels, just like the text prompt, but with extra care to ignore website boilerplate. + +**Ignore:** +- Navigation menus, headers/footers, cookie banners, legal disclaimers, copyright notices. +- Generic marketing language, calls-to-action, contact details, login/signup content. +- Repeated site templates or boilerplate. + +**Focus only on:** +- Technologies, research areas, scientific methods, products, applications, industrial sectors, materials, standards, diseases, engineering disciplines, innovation domains. +- Prefer canonical scientific terms over marketing buzzwords (e.g., "Large Language Models" instead of "AI Assistant"). + +**Hierarchy and relevance scores** are the same as in the text prompt (broad → coarse → fine, scores 0.0–1.0). + +**Output schema (JSON only):** +'''{"broad_keywords": [{"keyword": "string", "relevance_score": 0.0}, ...],"coarse_grained": [...],"fine_grained": [...]}''' + +**Example (company website):** +Input: Stripe provides payment infrastructure for businesses, supporting processing, billing, fraud prevention, and global commerce. +Output: +{"broad_keywords": [{"keyword": "Financial Technology", "relevance_score": 0.98}, {"keyword": "Business Services", "relevance_score": 0.91}],"coarse_grained": [{"keyword": "Payment Processing", "relevance_score": 0.97}, {"keyword": "Digital Payments", "relevance_score": 0.95}],"fine_grained": [{"keyword": "Stripe Platform", "relevance_score": 0.99}, {"keyword": "Fraud Prevention", "relevance_score": 0.91}]} + +**Return ONLY the JSON object, nothing else.** +- Nno leading/trailing spaces, newlines, or any text before or after. NO IDENTATION, justa stringified JSON +""" \ No newline at end of file From 42ecebb27f96568c9b6b6088c024759cb8d4caa8 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:51 +0200 Subject: [PATCH 38/92] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 2 ++ webapp/src/app/api/model/extractedKeywords.ts | 8 ++--- .../src/app/api/model/extractedKeywordsLLM.ts | 27 +++++++++++++++ .../api/model/extractedKeywordsResponse.ts | 33 +++++++++---------- .../app/api/model/keywordEntryWithTopic.ts | 21 ++++++++++++ webapp/src/app/api/model/models.ts | 2 ++ 6 files changed, 71 insertions(+), 22 deletions(-) create mode 100644 webapp/src/app/api/model/extractedKeywordsLLM.ts create mode 100644 webapp/src/app/api/model/keywordEntryWithTopic.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index baf4dbd8..99b72add 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -74,6 +74,7 @@ model/euOrganizationProjectSummary.ts model/euOrganizationProjectSummaryPage.ts model/euProjectData.ts model/extractedKeywords.ts +model/extractedKeywordsLLM.ts model/extractedKeywordsResponse.ts model/filterInformation.ts model/filterProperties.ts @@ -125,6 +126,7 @@ model/institutionPage.ts model/institutionsListResponse.ts model/ipcClassification.ts model/keywordEntry.ts +model/keywordEntryWithTopic.ts model/keywordTopicMatch.ts model/keywords.ts model/keywordsRequest.ts diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts index 81a2bc3c..8e74c6e0 100644 --- a/webapp/src/app/api/model/extractedKeywords.ts +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -7,21 +7,21 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { KeywordEntry } from './keywordEntry'; +import { KeywordEntryWithTopic } from './keywordEntryWithTopic'; export interface ExtractedKeywords { /** * The extracted broad keywords from text. */ - broad_keywords: Array; + broad_keywords: Array; /** * The extracted coarse-grained keywords from text. */ - coarse_grained: Array; + coarse_grained: Array; /** * The extracted fine-grained keywords from text. */ - fine_grained: Array; + fine_grained: Array; } diff --git a/webapp/src/app/api/model/extractedKeywordsLLM.ts b/webapp/src/app/api/model/extractedKeywordsLLM.ts new file mode 100644 index 00000000..b12957f6 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywordsLLM.ts @@ -0,0 +1,27 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordEntry } from './keywordEntry'; + + +export interface ExtractedKeywordsLLM { + /** + * The extracted broad keywords from text. + */ + broad_keywords: Array; + /** + * The extracted coarse-grained keywords from text. + */ + coarse_grained: Array; + /** + * The extracted fine-grained keywords from text. + */ + fine_grained: Array; +} + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts index 65a4087b..8fe10a5f 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -1,29 +1,26 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ +import { ExtractedKeywordsLLM } from './extractedKeywordsLLM'; import { ExtractedKeywords } from './extractedKeywords'; - -export interface ExtractedKeywordsResponse { - /** - * The extracted keywords from the input text. - */ - results: ExtractedKeywords; - /** - * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. - */ - source: string; - source_url?: string | null; - /** - * The actual content from which keywords were extracted. - */ - source_content: string; - duration?: number | null; +export interface ExtractedKeywordsResponse { + results_llm?: ExtractedKeywordsLLM | null; + results?: ExtractedKeywords | null; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; + duration?: number | null; } - diff --git a/webapp/src/app/api/model/keywordEntryWithTopic.ts b/webapp/src/app/api/model/keywordEntryWithTopic.ts new file mode 100644 index 00000000..6680e773 --- /dev/null +++ b/webapp/src/app/api/model/keywordEntryWithTopic.ts @@ -0,0 +1,21 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordEntry } from './keywordEntry'; +import { KeywordTopicMatch } from './keywordTopicMatch'; + + +export interface KeywordEntryWithTopic { + /** + * The keyword extracted by the LLM. + */ + llm_keyword: KeywordEntry; + topic_mapping?: KeywordTopicMatch | null; +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 282cf11e..8e381ef2 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -50,6 +50,7 @@ export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; export * from './euProjectData'; export * from './extractedKeywords'; +export * from './extractedKeywordsLLM'; export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; @@ -101,6 +102,7 @@ export * from './institutionPage'; export * from './institutionsListResponse'; export * from './ipcClassification'; export * from './keywordEntry'; +export * from './keywordEntryWithTopic'; export * from './keywordTopicMatch'; export * from './keywords'; export * from './keywordsRequest'; From 2603580587084b0b7a38e984f26e6886d90f5a68 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:27:13 +0200 Subject: [PATCH 39/92] ui adjusted --- .../keywords-search.component.html | 354 ++++++++------- .../keywords-search.component.scss | 413 +++++++++++++----- .../keywords-search.component.ts | 86 +++- 3 files changed, 553 insertions(+), 300 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 02aab57c..958783a6 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -1,117 +1,75 @@
- - - -
- - Füge eine URL ein, um Keywords zu extrahieren - - -
-
- - -
- - Schreibe einen Text, um Keywords zu extrahieren - - -
-
- - -
- - Definieren Sie Ihre eigene Keywords - - - -
-
-
- -
- @if (form.controls.selectedInputType.value !== 'keywords') { - - } -
- - -
- - - - -
- Eigene Keywords - @if (manualKeywords().length > 0) { - - @for (keyword of manualKeywords(); track keyword) { - {{ keyword }} - } - - } @else { -

Keine manuell hinzugefügten Keywords.

- } + +
+ + +
+ + Füge eine URL ein, um Keywords zu extrahieren + + +
+ +
- - @if (sourceContent().length > 0) { - - - - Quellentext: {{ sourceUrl() }} - -
{{ sourceContent() }}
-
- } - - -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

+ + + +
+ + Schreibe einen Text, um Keywords zu extrahieren + + +
+ +
+
+
+ + + +
+ + + +
+ +
+
Breite Keywords
+
Coarse Keywords
+
Fine Keywords
+
Eigene Keywords
+
+ + +
+
+ @if (broadKeywords().length > 0) { {{ keyword }} + class="compact-chip broad-chip"> + {{ keyword }} + } -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

+ } @else { +

–

+ } +
+ +
+ @if (coarseKeywords().length > 0) { @for (keyword of coarseKeywords(); track keyword) { {{ keyword }} + class="compact-chip coarse-chip"> + {{ keyword }} + } -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

+ } @else { +

–

+ } +
+ +
+ @if (fineKeywords().length > 0) { @for (keyword of fineKeywords(); track keyword) { {{ keyword }} + class="compact-chip fine-chip"> + {{ keyword }} + } -
- } -
+ } @else { +

–

+ } +
- +
+ +
+ + z. B. Knowledge Graphs + + + +
+ @if (manualKeywords().length > 0) { + @for (keyword of manualKeywords(); track keyword) { + + {{ keyword }} + cancel + + } + } +
+
+
+
+ + + @if (extractedKeywordsExist()) {
- @if (areAllExtractedSelected()) {
- } @else { + } + + @if (isExtracting()) { +
+ + +
{{ statusMessage() }}
+
+ } @else if ( + !extractedKeywordsExist() && manualKeywords().length === 0 + ) {

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie - hier zu sehen oder füge sie manuell hinzu. + Keine Keywords vorhanden. Extrahiere Keywords oder füge eigene + hinzu.

} -
+ + @if (sourceContent().length > 0) { + + + + Quellentext: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ } + + +
- @if (isExtracting()) { -
- - -
{{ statusMessage() }}
-
- } - - -
- - -
- + +
+ +
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index daf9bb39..c0e8d744 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -7,21 +7,18 @@ .tab-content { padding: 0.5rem 0; + display: grid; + grid-template-columns: 5fr 1fr; + gap: 0.5rem; } .full-width { width: 100%; } -.keyword-input-row { - display: flex; - align-items: flex-start; - gap: 0.75rem; -} - .actions { display: flex; - justify-content: flex-end; + justify-content: center; } .extraction-grid { @@ -43,32 +40,231 @@ } } -.category-grid { - display: grid; - grid-template-columns: 1fr; - gap: 0.75rem 1.5rem; +/* === Table-like keyword grid === */ +.keyword-table { + display: flex; + flex-direction: column; + gap: 0.5rem; + margin: 0.5rem 0; } -.category-section { - h4 { - margin: 0 0 0.25rem 0; - font-weight: 500; - color: var(--sg-text-secondary); - font-size: 0.75rem; - text-transform: uppercase; - letter-spacing: 0.05em; +.table-head { + display: grid; + grid-template-columns: repeat(3, 1fr) 1.3fr; + grid-template-rows: auto; + column-gap: 1rem; + border-bottom: 2px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); + padding-bottom: 0.5rem; +} + +.head-cell { + min-width: 0; + text-align: center; /* Center header text */ +} + +.extracted-header { + grid-column: 1 / span 3; + grid-row: 0; + font-size: 0.95rem; + font-weight: 600; + color: var(--sg-text-primary); + align-self: end; +} + +.own-header { + grid-column: 4; + grid-row: 1 / span 2; + display: flex; + flex-direction: column; + gap: 0.35rem; +} + +.own-header-title { + font-size: 0.95rem; + font-weight: 600; + color: var(--sg-text-primary); + text-align: center; /* Center own header title */ +} + +.sub-cell { + font-weight: 500; + color: var(--sg-text-secondary); + font-size: 1rem; + text-transform: uppercase; + letter-spacing: 0.05em; + align-self: end; + grid-row: 2; + text-align: center; /* Center sub-cell text */ +} + +.broad-sub { + grid-column: 1; +} +.coarse-sub { + grid-column: 2; +} +.fine-sub { + grid-column: 3; +} +.manual-sub { + grid-column: 4; +} +.keyword-input-row { + margin-left: 0.5rem; + width: 100%; + display: grid; + grid-column: 1 / span 4; + display: flex; + align-items: center; + gap: 0.35rem; + + &.compact { + .small-field { + flex: 10; + // collapse the outline field to a compact, chip-like height + ::ng-deep .mat-mdc-text-field-wrapper { + padding: 0 0.6rem; + } + + ::ng-deep .mat-mdc-form-field-flex { + min-height: 8px; + align-items: center; + } + + ::ng-deep .mat-mdc-form-field-infix { + min-height: 8px; + padding: 1rem 0; + } + + // hide the hint/error subscript strip to remove extra height + ::ng-deep .mat-mdc-form-field-subscript-wrapper { + display: none; + } + + ::ng-deep input.mat-mdc-input-element { + font-size: 0.8rem; + } + + ::ng-deep .mat-mdc-form-field-label, + ::ng-deep mat-label { + font-size: 1rem; + } + } + + button.mat-mdc-icon-button { + width: 28px; + height: 28px; + padding: 0; + line-height: 28px; + flex: 1; + + .mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + line-height: 18px; + } + + ::ng-deep .mat-mdc-button-touch-target { + width: 28px; + height: 28px; + } + } + } +} + +.table-body { + display: grid; + grid-template-columns: repeat(3, 1fr) 1.3fr; + column-gap: 1rem; + row-gap: 0.4rem; + align-items: start; + border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Left border for columns */ +} + +/* Add vertical separators between columns */ +.table-col { + display: flex; + min-width: 0; + padding: 0.5rem; + height: 100%; + border-right: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Right border for columns */ + + &:last-child { + border-right: none; /* Remove border from last column */ + } + &:nth-child(3) { + border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Right border for third column */ } mat-chip-listbox { width: 100%; } + + /* force chips into a single vertical column so rows line up across columns */ + ::ng-deep .mdc-evolution-chip-set__chips { + flex-direction: column; + align-items: flex-start; + gap: 0.35rem; + } } +/* Make chips removable and add hover effect */ .compact-chip { - font-size: 0.8rem; + font-size: 1rem; padding: 0.2rem 0.6rem; min-height: 28px; line-height: 1.2; + width: 80%; + box-sizing: border-box; + animation: popIn 0.2s ease-in-out; + cursor: default; + + // Add removable indicator and hover effect + &.mat-mdc-chip-option { + .mat-mdc-chip-action { + padding: 0 4px; + + .mat-mdc-chip-action-label { + padding: 0 4px; + display: flex; + align-items: center; + gap: 4px; + } + } + + // Show remove button on hover for removable chips + &:hover { + ::ng-deep .mat-mdc-chip-remove { + opacity: 1; + } + } + } + + // Style for removable chips + ::ng-deep .mat-mdc-chip-remove { + opacity: 0; + transition: opacity 0.2s ease; + cursor: pointer; + + .mat-icon { + font-size: 16px; + width: 16px; + height: 16px; + line-height: 16px; + } + } +} + +@keyframes popIn { + from { + opacity: 0; + transform: scale(0.9); + } + to { + opacity: 1; + transform: scale(1); + } } ::ng-deep .mat-mdc-chip-option.compact-chip { @@ -80,115 +276,90 @@ } } -/* Selected keywords buttons */ -.selected-keywords { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; -} - -.selected-keyword { - display: inline-flex; - align-items: center; - gap: 0.15rem; - font-size: 0.8rem; - padding: 0.2rem 0.6rem; - min-height: 28px; - - .mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - line-height: 18px; - } -} -.section-title { - margin: 0.5rem 0 0.25rem 0; - font-size: 1rem; - font-weight: 500; - color: var(--sg-text-primary); -} - -.extracted-section, -.manual-section { - margin-bottom: 0.5rem; -} -.manual-section { - margin-top: 0.5rem; -} -.mat-divider { - margin: 0.5rem 0; -} -.select-all-container { - display: flex; - justify-content: flex-end; - margin-top: 0.5rem; - - button { - font-size: 0.75rem; - padding: 0 12px; - line-height: 30px; - mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - } - } -} -.select-all-container { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - justify-content: flex-end; - margin-top: 0.5rem; - - button { - font-size: 0.75rem; - padding: 0 12px; - line-height: 30px; - mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - } - } -} .empty-state { + text-align: center; color: var(--sg-text-secondary); margin: 0; - font-size: 0.9rem; - padding: 0.5rem 0; + font-size: 0.85rem; + padding: 0.35rem 0; + + &.small { + opacity: 0.6; + } +} + +.select-all-container { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } } -/* NEW: Search button container */ .search-container { display: flex; justify-content: flex-end; margin-top: 0.5rem; } -/* Responsive: stack on small screens */ +/* Responsive: stack columns on small screens */ @media (max-width: 768px) { - .extraction-grid { + .table-head, + .table-body { grid-template-columns: 1fr; } - .category-grid { - grid-template-columns: 1fr; - gap: 0.75rem; + .extracted-header { + grid-column: 1; + grid-row: 1; } - .keyword-input-row { - flex-direction: column; + .own-header { + grid-column: 1; + grid-row: 2; + } + + .broad-sub { + grid-column: 1; + grid-row: 3; + } + .coarse-sub { + grid-column: 1; + grid-row: 4; + } + .fine-sub { + grid-column: 1; + grid-row: 5; } .actions { + align-self: center; justify-content: flex-start; } .search-container { justify-content: flex-start; } + + .table-col { + border-right: none; /* Remove column borders on mobile */ + border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + + &:last-child { + border-bottom: none; + } + } } /* Source expansion panel */ .source-expansion { @@ -225,23 +396,22 @@ ::ng-deep .mat-expansion-panel-body { padding: 0 0.75rem 0.75rem 0.75rem; - max-height: 350px; // scrollable if content is long + max-height: 350px; overflow-y: auto; - white-space: pre-wrap; // preserve line breaks + white-space: pre-wrap; word-break: break-word; } - // Remove the default Material box-shadow for a cleaner outline look ::ng-deep .mat-expansion-panel { box-shadow: none !important; background: transparent; } - // Ripple effect on header – keep it subtle ::ng-deep .mat-expansion-panel-header:hover { background: rgba(0, 0, 0, 0.03); } } + .progress-container { margin-top: 1rem; padding: 0.5rem 0; @@ -249,6 +419,8 @@ mat-progress-bar { height: 8px; border-radius: 4px; + overflow: hidden; + animation: progressPulse 1.8s ease-in-out infinite; } .status-message { @@ -257,5 +429,32 @@ color: var(--sg-text-secondary); text-align: center; font-weight: 500; + + animation: fadeSlideIn 0.4s ease-out; + } +} + +@keyframes fadeSlideIn { + from { + opacity: 0; + transform: translateY(6px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes progressPulse { + 0%, + 100% { + transform: scaleY(1); + opacity: 1; + } + + 50% { + transform: scaleY(1.08); + opacity: 0.9; } } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 1b7d6979..ec7b5f34 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -18,6 +18,7 @@ import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResp import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; +import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -92,7 +93,7 @@ export class KeywordsSearchComponent { private readonly websocketService: KeywordWebSocketService, ) { this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { - console.log('Component received event:', event); + //console.log('Component received event:', event); this.restoreStateFromQueryParams(); }); @@ -127,13 +128,6 @@ export class KeywordsSearchComponent { if (event.keywords) this.addExtractedKeyword(event.keywords); break; - // case 'result': - // console.log('RESULT:', event.result); - // this.processExtractedKeywords( - // event.result as ExtractedKeywordsResponse, - // ); - // this.isExtracting.set(false); - // break; case 'completed': console.log('COMPLETED:', event.result); this.processExtractedKeywords( @@ -167,13 +161,14 @@ export class KeywordsSearchComponent { default: console.warn('Unknown event type:', event); } - this.destroyRef.onDestroy(() => { - this.websocketService.close(); - }); + // this.destroyRef.onDestroy(() => { + // this.websocketService.close(); + // }); }); // Clear session storage on component destroy this.destroyRef.onDestroy(() => { + this.websocketService.close(); const nav = this.router.lastSuccessfulNavigation; const isReload = nav === null; if (!isReload) { @@ -306,6 +301,14 @@ export class KeywordsSearchComponent { isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + onExtractKeywordsClick(): void { + if (this.isExtracting()) { + this.cancelKeywordExtraction(); + return; + } + + void this.extractKeywords(); + } addExtractedKeyword(keywords: ExtractedKeywords): void { const broad = this.extractKeywordStrings(keywords.broad_keywords); const coarse = this.extractKeywordStrings(keywords.coarse_grained); @@ -315,11 +318,42 @@ export class KeywordsSearchComponent { this.coarseKeywords.set(coarse); this.fineKeywords.set(fine); } + onKeywordRemoved( + category: 'broad' | 'coarse' | 'fine' | 'manual', + keyword: string, + ): void { + // Remove from the category list + const categoryKeywords = this.getCategoryKeywords(category); + const updatedCategoryKeywords = categoryKeywords.filter( + (k) => k !== keyword, + ); + switch (category) { + case 'broad': + this.broadKeywords.set(updatedCategoryKeywords); + break; + case 'coarse': + this.coarseKeywords.set(updatedCategoryKeywords); + break; + case 'fine': + this.fineKeywords.set(updatedCategoryKeywords); + break; + case 'manual': + this.manualKeywords.set(updatedCategoryKeywords); + break; + } + + // Remove from selected keywords if it was selected + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => k !== keyword), + ); + + this.updateQueryParams(); + } + processExtractedKeywords(result: ExtractedKeywordsResponse): void { - if (result === undefined) { + if (result === undefined || !result.results) { return; } - console.log('Processing extracted keywords:', result); const { results, source, source_content, source_url } = result; const broad = this.extractKeywordStrings(results.broad_keywords); @@ -333,13 +367,6 @@ export class KeywordsSearchComponent { this.extractionSource.set(source as InputMode); this.sourceUrl.set(source_url ?? ''); this.saveSourceToSession(); - - console.log('Extracted keywords:', { - broad, - coarse, - fine, - manual: this.manualKeywords(), - }); // Keep only selected keywords that still exist in any category (including manual) const allExtracted = [ ...broad, @@ -381,15 +408,29 @@ export class KeywordsSearchComponent { } } + cancelKeywordExtraction(): void { + this.websocketService.close(); + this.isExtracting.set(false); + this.progress.set(0); + this.statusMessage.set('Extraktion abgebrochen'); + } + search(): void { console.log('searching for keywords:', this.selectedKeywords()); // e.g. navigate to search results page // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); } - private extractKeywordStrings(items: any[] | undefined): string[] { + private extractKeywordStrings(items: KeywordEntryWithTopic[]): string[] { return this.uniqueKeywords( - (items ?? []).map((kw) => kw.keyword?.trim() ?? '').filter((kw) => !!kw), + (items ?? []) + .map((item) => { + const openalexKeyword = (item as any).topic_mapping?.keyword?.trim(); + const llmKeyword = (item as any).llm_keyword?.keyword?.trim(); + // return openalexKeyword || llmKeyword || ''; + return openalexKeyword || ''; + }) + .filter((kw) => !!kw), ); } @@ -454,7 +495,6 @@ export class KeywordsSearchComponent { sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), }; - console.log(data); sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); } From 647eb55a8875b08c73764231a8fbb0a9c1c6c1f2 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:27:56 +0200 Subject: [PATCH 40/92] hardcoded basePath (temporary) --- .../app/modules/keywords-search/keywords-websocket.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts index b1989c5c..86622360 100644 --- a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts +++ b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts @@ -34,7 +34,7 @@ export class KeywordWebSocketService extends BaseService { ) { super(basePath, configuration); this.url = - `${this.configuration?.basePath ?? 'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( + `${'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( /^http/, 'ws', ); From 6c4688185f9aac2dafefdec2ae4b8a3fc3fb05af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Thu, 2 Jul 2026 12:17:34 +0200 Subject: [PATCH 41/92] fix: applied currency and date pipes where possible --- .../bund-details/bund-details.component.html | 32 ++++++++++----- .../bund-details/bund-details.component.ts | 35 ---------------- .../eu-details.component.html | 41 +++++++++++++------ .../eu-cordis-details/eu-details.component.ts | 27 ++---------- .../organizations-table.component.html | 8 ++-- .../organizations-table.component.ts | 10 +---- .../modules/projects/projects.component.html | 4 +- webapp/src/app/resolvers/utils/formatters.ts | 20 --------- 8 files changed, 62 insertions(+), 115 deletions(-) delete mode 100644 webapp/src/app/resolvers/utils/formatters.ts diff --git a/webapp/src/app/modules/projects/bund-details/bund-details.component.html b/webapp/src/app/modules/projects/bund-details/bund-details.component.html index fcceb4bd..e310a9dd 100644 --- a/webapp/src/app/modules/projects/bund-details/bund-details.component.html +++ b/webapp/src/app/modules/projects/bund-details/bund-details.component.html @@ -53,14 +53,16 @@
calendar_today
- {{ getStartDate() || 'N/A' }} + {{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} Förderbeginn
event_busy
- {{ getFundingStatus(getEndDate()) }} + {{ + getFundingStatus(bundProject.funding_end_date) + }} Förderende
@@ -77,7 +79,9 @@
paid
- {{ getFundingAmountDisplay() }} + {{ + bundProject.funding_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} Fördersumme
@@ -351,7 +355,12 @@ @if (bundProject.funding_amount) {
Fördersumme
-
{{ getFundingAmountDisplay() }}
+
+ {{ + bundProject.funding_amount + | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} +
} @if (bundProject.funding_amount) { @@ -374,12 +383,15 @@
Förderende
{{ getFundingStatus(getEndDate()) }}
--> - @if (getDuration()) { -
-
Laufzeit
-
{{ getDuration() }}
-
- } + +
+
Laufzeit
+
+ von {{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} bis + {{ bundProject.funding_end_date | date: 'dd.MM.yyyy' }} +
+
+ @if (bundProject.joint_project) {
Gemeinschaftsprojekt
diff --git a/webapp/src/app/modules/projects/bund-details/bund-details.component.ts b/webapp/src/app/modules/projects/bund-details/bund-details.component.ts index 29fe06ab..73b06e6e 100644 --- a/webapp/src/app/modules/projects/bund-details/bund-details.component.ts +++ b/webapp/src/app/modules/projects/bund-details/bund-details.component.ts @@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common'; import { MatCardModule } from '@angular/material/card'; import { MatIconModule } from '@angular/material/icon'; import { BundProjectDetails } from '../../../api/model/bundProjectDetails'; -import { formatGermanDate } from '../../../resolvers/utils/formatters'; @Component({ selector: 'app-bund-details', @@ -45,18 +44,6 @@ export class BundDetailsComponent implements OnInit { : `${fundingEndDate}`; } - formatCurrency(amount: number | null | undefined): string { - if (amount === null || amount === undefined) return 'N/A'; - - // Format as Euro with thousands separators - return new Intl.NumberFormat('de-DE', { - style: 'currency', - currency: 'EUR', - minimumFractionDigits: 0, - maximumFractionDigits: 0, - }).format(amount); - } - searchForPersonName(personName: string): void { this.router.navigate(['/persons'], { queryParams: { @@ -110,22 +97,7 @@ export class BundDetailsComponent implements OnInit { getAssociatedPersons(): string[] { return this.bundProject?.associated_persons || []; } - getStartDate(): string { - return formatGermanDate(this.bundProject?.funding_start_date ?? ''); - } - getEndDate(): string { - return formatGermanDate(this.bundProject?.funding_end_date ?? ''); - } - - getDuration(): string { - const start = this.bundProject?.funding_start_date; - const end = this.bundProject?.funding_end_date; - - if (!start || !end) return ''; - - return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`; - } /** * All institutions as a simple list. */ @@ -140,13 +112,6 @@ export class BundDetailsComponent implements OnInit { return this.bundProject?.is_new === true; } - /** - * Get display name for funding amount - */ - getFundingAmountDisplay(): string { - if (!this.bundProject?.funding_amount) return 'N/A'; - return this.formatCurrency(this.bundProject.funding_amount); - } getStatusDisplay(fundingEndDate: string | null | undefined): string { if (!fundingEndDate) return 'N/A'; if (fundingEndDate === '2999') return 'Laufend'; diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html index 1aa56279..5d3b5fe0 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.html @@ -72,14 +72,14 @@
calendar_today
- {{ formatDate(euProject.startDate) || 'N/A' }} + {{ euProject.startDate | date: 'dd.MM.yyyy' }} Förderbeginn
event_busy
- {{ formatDate(euProject.endDate) || 'N/A' }} + {{ euProject.endDate | date: 'dd.MM.yyyy' }} Förderende
@@ -94,7 +94,10 @@
euro_symbol
- {{ formatCurr(euProject.ecMaxContribution) }} + {{ + euProject.ecMaxContribution + | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} EU-Beitrag
@@ -103,7 +106,10 @@
attach_money
- {{ formatCurr(euProject.totalCost) }} + {{ + euProject.totalCost + | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} Gesamtkosten
@@ -368,19 +374,29 @@ @if (euProject.ecMaxContribution) {
Max. EU-Beitrag
-
{{ formatCurr(euProject.ecMaxContribution) }}
+
+ {{ + euProject.ecMaxContribution + | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} +
} @if (euProject.totalCost) {
Gesamtkosten
-
{{ formatCurr(euProject.totalCost) }}
+
+ {{ + euProject.totalCost + | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} +
} @if (euProject.ecSignatureDate) {
EU-Unterzeichnung
-
{{ formatDate(euProject.ecSignatureDate) }}
+
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
} @if (euProject.nature) { @@ -402,22 +418,21 @@
Laufzeit
- {{ - getDuration(euProject.startDate, euProject.endDate) || - 'N/A' - }} + von + {{ euProject.startDate | date: 'dd.MM.yyyy' }} + bis {{ euProject.endDate | date: 'dd.MM.yyyy' }}
@if (euProject.ecSignatureDate) {
EU-Unterzeichnung
-
{{ formatDate(euProject.ecSignatureDate) }}
+
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
} @if (euProject.contentUpdateDate) {
Letzte Aktualisierung
-
{{ formatDate(euProject.contentUpdateDate) }}
+
{{ euProject.contentUpdateDate | date: 'dd.MM.yyyy' }}
} @if (euProject.grantDoi) { diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts index cc1e83f0..17a030b7 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts @@ -1,7 +1,7 @@ // eu-details.component.ts (refactored) import { Component, OnInit, inject, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { CommonModule } from '@angular/common'; +import { CommonModule, CurrencyPipe } from '@angular/common'; import { MatCardModule } from '@angular/material/card'; import { MatIconModule } from '@angular/material/icon'; import { MatChipsModule } from '@angular/material/chips'; @@ -15,10 +15,7 @@ import { OrganizationsTableComponent } from './organizations-table/organizations import { PublicationsTableComponent } from './publications-table/publications-table.component'; import { PatentsCardsComponent } from './patents-cards/patents-cards.component'; import { DeliverablesCardsComponent } from './deliverables-cards/deliverables-cards.component'; -import { - formatCurrency, - formatGermanDate, -} from '../../../resolvers/utils/formatters'; + export type TabType = | 'overview' | 'organizations' @@ -42,6 +39,7 @@ export type TabType = PublicationsTableComponent, PatentsCardsComponent, DeliverablesCardsComponent, + CurrencyPipe, ], templateUrl: './eu-details.component.html', styleUrl: './eu-details.component.scss', @@ -325,25 +323,6 @@ export class EuDetailsComponent implements OnInit, OnDestroy { return end >= now ? 'Laufend' : 'Abgeschlossen'; } - getDuration(start: string | undefined, end: string | undefined): string { - if (!start || !end) return ''; - return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`; - } - - formatDate(date: string | undefined): string | undefined { - if (date) { - return formatGermanDate(date); - } - return date; - } - - formatCurr(value: number | undefined | null): string | null | undefined { - if (value) { - return formatCurrency(value); - } - return String(value); - } - getStatusColor(status: string | null | undefined): string { if (!status) return '#95a5a6'; diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html index 1e5bfd19..817b9833 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html +++ b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html @@ -43,7 +43,9 @@ } @else { @@ -58,7 +60,7 @@ @if (org.ecContribution) { {{ - formatCurr(org.ecContribution) + org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }} } @else { — @@ -118,4 +120,4 @@
-
\ No newline at end of file + diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts index a4603eaa..de322d8a 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts @@ -4,10 +4,10 @@ import { Router } from '@angular/router'; import { MatIcon } from '@angular/material/icon'; import { MatCard } from '@angular/material/card'; import { HEUOrganization } from '../../../../../api'; -import { formatCurrency } from '../../../../../resolvers/utils/formatters'; +import { CurrencyPipe } from '@angular/common'; @Component({ selector: 'app-organizations-table', - imports: [MatTableModule, MatIcon, MatCard], + imports: [MatTableModule, MatIcon, MatCard, CurrencyPipe], templateUrl: './organizations-table.component.html', styleUrl: './organizations-table.component.scss', }) @@ -46,10 +46,4 @@ export class OrganizationsTableComponent { getOrgsCount(): number { return this.orgs?.length || 0; } - formatCurr(value: number | undefined | null) { - if (value) { - return formatCurrency(value); - } - return value; - } } diff --git a/webapp/src/app/modules/projects/projects.component.html b/webapp/src/app/modules/projects/projects.component.html index 0ae1e25c..706f34fb 100644 --- a/webapp/src/app/modules/projects/projects.component.html +++ b/webapp/src/app/modules/projects/projects.component.html @@ -62,8 +62,8 @@ diff --git a/webapp/src/app/resolvers/utils/formatters.ts b/webapp/src/app/resolvers/utils/formatters.ts deleted file mode 100644 index 3131672a..00000000 --- a/webapp/src/app/resolvers/utils/formatters.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function formatGermanDate(dateString: string): string { - if (!dateString) return ''; - - return new Intl.DateTimeFormat('de-DE', { - day: 'numeric', - month: 'long', - year: 'numeric', - }).format(new Date(dateString)); -} - -export function formatCurrency(amount: number | null | undefined): string { - if (amount === null || amount === undefined) return 'N/A'; - - return new Intl.NumberFormat('de-DE', { - style: 'currency', - currency: 'EUR', - minimumFractionDigits: 0, - maximumFractionDigits: 0, - }).format(amount); -} From aaab04596d80065f8f67bc4b88b8e71c8e7293e0 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:53:52 +0200 Subject: [PATCH 42/92] translated status messaged on german --- service/src/main/inse/keywords/logic.py | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index b2017297..904b1e31 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -134,23 +134,23 @@ async def extract_keywords_stream( ) -> ExtractedKeywordsResponse: start_time = time.time() timeout_seconds = 60 # configurable - await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + await emit(KeywordsWsEvent(type="status", step="started", message="Starte Keyword-Extraktion").model_dump()) if mode == "url": - await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump()) text = await _get_text_content(query) - await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query - await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Empfangen {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" if limit: user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" user_prompt += f"\nInput:\n{text}" - await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump()) LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") @@ -234,7 +234,7 @@ async def extract_keywords_stream( await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump()) raise RuntimeError("LLM streaming call returned empty content") - await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump()) try: keywords_json = json.loads(keywords) @@ -270,16 +270,16 @@ async def extract_keywords_stream_enriched( ) -> ExtractedKeywordsResponse: start_time = time.time() timeout_seconds = 120 - await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + await emit(KeywordsWsEvent(type="status", step="started", message="Starte Keyword-Extraktion").model_dump()) if mode == "url": - await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump()) text = await _get_text_content(query) - await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query - await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Empfangen {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT user_prompt = "\nNow analyze the following text.\n" @@ -287,7 +287,7 @@ async def extract_keywords_stream_enriched( user_prompt += f"\nExtract exactly {limit} keywords for each level.\n" user_prompt += f"\nInput:\n{text}" - await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump()) LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") @@ -365,7 +365,7 @@ async def extract_keywords_stream_enriched( KeywordsWsEvent( type="status", step="enriching", - message=f"Enriching keyword '{keyword_text}' at level '{level}'", + message=f"Bearbeite keyword'{keyword_text}'", ).model_dump() ) task = asyncio.create_task(get_openalex_topic(level, idx, confirmed[level][idx].llm_keyword)) @@ -410,7 +410,7 @@ async def extract_keywords_stream_enriched( raise # ---------- Finalize ---------- - await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump()) try: keywords_json = json.loads(keywords) From f19059164ebbd14bd4d48a332bab7201e84ddc84 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:54:21 +0200 Subject: [PATCH 43/92] added simple shared topic autocompletion component --- .../topic-autocomplete.component.html | 59 +++++++++ .../topic-autocomplete.component.scss | 16 +++ .../topic-autocomplete.component.ts | 123 ++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html new file mode 100644 index 00000000..e7a2f20f --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html @@ -0,0 +1,59 @@ +
+ + {{ label() }} + + + @if (searchControl.value.trim()) { + + } + + @if (searchControl.value) { + + } + + + @if (loading()) { + + + Lade Themen... + + } + + @for (topic of topics(); track topic) { + {{ topic }} + } + + @if ( + !loading() && + searchControl.value.trim().length >= minCharacters() && + topics().length === 0 + ) { + Keine passenden Themen gefunden. + } + + +
diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss new file mode 100644 index 00000000..e8769993 --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss @@ -0,0 +1,16 @@ +:host { + width: 100%; +} + +.topic-autocomplete { + width: 100%; +} + +mat-form-field { + width: 100%; +} + +.topic-field { + width: 100%; + min-width: 320px; +} diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts new file mode 100644 index 00000000..6b14edd7 --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts @@ -0,0 +1,123 @@ +import { CommonModule } from '@angular/common'; +import { Component, DestroyRef, input, output, signal } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { TopicsService } from '../../../api/api/topics.service'; +import { EventEmitter } from '@angular/core'; +import { + catchError, + debounceTime, + distinctUntilChanged, + finalize, + map, + of, + switchMap, +} from 'rxjs'; + +@Component({ + selector: 'app-topic-autocomplete', + standalone: true, + imports: [ + CommonModule, + ReactiveFormsModule, + MatAutocompleteModule, + MatButtonModule, + MatFormFieldModule, + MatIconModule, + MatInputModule, + MatProgressSpinnerModule, + ], + templateUrl: './topic-autocomplete.component.html', + styleUrl: './topic-autocomplete.component.scss', +}) +export class TopicAutocompleteComponent { + readonly label = input('Thema'); + readonly placeholder = input('Thema suchen oder eintippen...'); + readonly minCharacters = input(2); + readonly limit = input(12); + + readonly topicSelected = output(); + + readonly searchControl = new FormControl('', { nonNullable: true }); + readonly topics = signal([]); + readonly loading = signal(false); + + constructor( + private readonly topicsService: TopicsService, + private readonly destroyRef: DestroyRef, + ) { + this.searchControl.valueChanges + .pipe( + debounceTime(250), + distinctUntilChanged(), + switchMap((query) => { + const normalizedQuery = query.trim(); + if (normalizedQuery.length < this.minCharacters()) { + this.loading.set(false); + return of([] as string[]); + } + + this.loading.set(true); + return this.topicsService + .autocompleteTopics( + normalizedQuery, + undefined, + undefined, + undefined, + this.limit(), + ) + .pipe( + map((response) => + Array.from( + new Set( + (response.results ?? []) + .map((topic) => topic.display_name?.trim() ?? '') + .filter((topic) => !!topic), + ), + ), + ), + catchError((error) => { + console.error( + 'Error fetching topic autocomplete options:', + error, + ); + return of([] as string[]); + }), + finalize(() => this.loading.set(false)), + ); + }), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((topics) => { + this.topics.set(topics); + }); + } + + selectTopic(topic: string): void { + this.searchControl.setValue('', { emitEvent: false }); + this.topics.set([]); + this.topicSelected.emit(topic); + } + onKeydownTab(event: KeyboardEvent): void { + event.preventDefault(); + this.searchControl.setValue(this.topics()[0], { emitEvent: false }); + } + submitCurrentValue(): void { + const topic = this.searchControl.value.trim(); + if (!topic) return; + this.searchControl.setValue('', { emitEvent: false }); + this.topics.set([]); + this.topicSelected.emit(topic); + } + + clear(): void { + this.searchControl.setValue(''); + this.topics.set([]); + } +} From f8228c5ea7d61ba5f249b8bc516c60e6d3594cc5 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:54:56 +0200 Subject: [PATCH 44/92] added click event on keywords to navigate to keywords component --- .../app/modules/news-detail/news-detail.component.html | 9 ++++++--- .../src/app/modules/news-detail/news-detail.component.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webapp/src/app/modules/news-detail/news-detail.component.html b/webapp/src/app/modules/news-detail/news-detail.component.html index cdb886cf..d1bd9864 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.html +++ b/webapp/src/app/modules/news-detail/news-detail.component.html @@ -116,9 +116,12 @@ track keyword; let i = $index ) { - {{ - keyword - }} + {{ keyword }} } } @else {

Keine Schlüsselwörter gefunden.

diff --git a/webapp/src/app/modules/news-detail/news-detail.component.ts b/webapp/src/app/modules/news-detail/news-detail.component.ts index e93ec298..8f721f20 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -6,7 +6,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; - +import { Router } from '@angular/router'; import { WorksService } from '../../api'; interface MentionedPerson { @@ -45,6 +45,7 @@ export class NewsDetailComponent implements OnInit { private readonly httpClient = inject(HttpClient); private readonly worksService = inject(WorksService); private readonly location = inject(Location); + private readonly router = inject(Router); article: NewsArticleDetail | null = null; loading = false; @@ -70,7 +71,11 @@ export class NewsDetailComponent implements OnInit { navigateBack(): void { this.location.back(); } - + onKeywordClick(keyword: string): void { + this.router.navigate(['/keywords'], { + queryParams: { selected: keyword, manual: keyword }, + }); + } formatDate(dateStr?: string | null): string { if (!dateStr) return '-'; const date = new Date(dateStr); From 25988d6c46abd0c8d56b91fe5e4e3b286c297927 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:56:43 +0200 Subject: [PATCH 45/92] added keywords enrichment, refactored --- .../keywords-search.component.ts | 724 ++++++++++++------ 1 file changed, 491 insertions(+), 233 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index ec7b5f34..cbe0cce0 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -1,4 +1,10 @@ -import { Component, signal, computed } from '@angular/core'; +import { + Component, + computed, + signal, + Signal, + WritableSignal, +} from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -18,8 +24,13 @@ import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResp import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; +import { TopicsService } from '../../api/api/topics.service'; +import { KeywordsTopicsRequest } from '../../api/model/keywordsTopicsRequest'; import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; -type InputMode = 'url' | 'text' | 'keywords'; +import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/topic-autocomplete.component'; + +type InputMode = 'url' | 'text'; +type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; @Component({ selector: 'app-keywords-search', @@ -35,6 +46,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatCardModule, MatExpansionModule, MatProgressBarModule, + TopicAutocompleteComponent, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -44,33 +56,61 @@ export class KeywordsSearchComponent { selectedInputType: 'url' as InputMode, urlInput: '', textInput: '', - keywordInput: '', }); private readonly SESSION_KEY = 'keywords-search-source'; - // Category signals - readonly broadKeywords = signal([]); - readonly coarseKeywords = signal([]); - readonly fineKeywords = signal([]); - readonly manualKeywords = signal([]); + + // Category signals - the full backend entries are the source of truth; + // the *Keywords() computed signals below just project the label out of them. + private readonly broadKeywordEntries = signal([]); + private readonly coarseKeywordEntries = signal([]); + private readonly fineKeywordEntries = signal([]); + private readonly manualKeywordEntries = signal([]); + + readonly broadKeywords = computed(() => + this.broadKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly coarseKeywords = computed(() => + this.coarseKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly fineKeywords = computed(() => + this.fineKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly manualKeywords = computed(() => + this.manualKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); readonly selectedKeywords = signal([]); readonly isExtracting = signal(false); - readonly extractionSource = signal(null); - readonly selectedBroadKeywords = computed(() => - this.selectedKeywords().filter((k) => this.broadKeywords().includes(k)), - ); - readonly selectedCoarseKeywords = computed(() => - this.selectedKeywords().filter((k) => this.coarseKeywords().includes(k)), - ); - readonly selectedFineKeywords = computed(() => - this.selectedKeywords().filter((k) => this.fineKeywords().includes(k)), - ); - readonly selectedManualKeywords = computed(() => - this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), - ); + // Single place mapping a category name to its label signal and its + // backing entries signal. Replaces four near-identical computed()s and + // a category switch statement that used to live below. + private readonly categoryKeywordsMap: Record< + KeywordCategory, + Signal + > = { + broad: this.broadKeywords, + coarse: this.coarseKeywords, + fine: this.fineKeywords, + manual: this.manualKeywords, + }; + private readonly categoryEntriesMap: Record< + KeywordCategory, + WritableSignal + > = { + broad: this.broadKeywordEntries, + coarse: this.coarseKeywordEntries, + fine: this.fineKeywordEntries, + manual: this.manualKeywordEntries, + }; + + readonly selectedBroadKeywords = this.selectedInCategory('broad'); + readonly selectedCoarseKeywords = this.selectedInCategory('coarse'); + readonly selectedFineKeywords = this.selectedInCategory('fine'); + readonly selectedManualKeywords = this.selectedInCategory('manual'); + readonly extractedKeywordsExist = computed( () => this.broadKeywords().length > 0 || @@ -83,126 +123,224 @@ export class KeywordsSearchComponent { private isRestoringState = false; + // Set right before we call router.navigate() ourselves (from + // updateQueryParams()). Lets the queryParamMap subscription below tell + // "we just wrote this URL" apart from "someone else navigated here" (a + // fresh mount, a deep link such as ?selected=x&manual=y from another + // page, a manual URL edit, browser back/forward). Only the latter should + // trigger a full restoreStateFromQueryParams(). + private isOwnNavigation = false; + readonly progress = signal(0); readonly statusMessage = signal(''); + constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, private readonly destroyRef: DestroyRef, private readonly websocketService: KeywordWebSocketService, + private readonly topicsService: TopicsService, ) { - this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { - //console.log('Component received event:', event); + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + if (this.isOwnNavigation) { + // This emission is just the router confirming the navigation we + // triggered ourselves in updateQueryParams(); our signals are + // already correct, so skip re-deriving state from the URL. + this.isOwnNavigation = false; + return; + } this.restoreStateFromQueryParams(); }); this.form.controls.selectedInputType.valueChanges .pipe(distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); this.form.controls.urlInput.valueChanges .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); this.form.controls.textInput.valueChanges .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); - //get streamed data - this.websocketService.getMessages().subscribe((event: WsEvent) => { - switch (event.type) { - case 'status': - console.log('STATUS:', event.step, event.message); - this.statusMessage.set(event.message || ''); - this.progress.set(this.getProgressForStep(event.step || '')); - break; - case 'keywords': - console.log('KEYWORDS:', event.keywords); - if (event.keywords) this.addExtractedKeyword(event.keywords); - break; + this.websocketService + .getMessages() + .subscribe((event: WsEvent) => this.handleWsEvent(event)); - case 'completed': - console.log('COMPLETED:', event.result); - this.processExtractedKeywords( - event.result as ExtractedKeywordsResponse, - ); - this.isExtracting.set(false); - this.progress.set(100); - this.statusMessage.set('Fertig!'); - this.websocketService.close(); - this.isExtracting.set(false); - break; - - case 'error': - console.error('ERROR:', event.message); - this.progress.set(0); - this.statusMessage.set('Fehler: ' + event.message); - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); - this.websocketService.close(); - this.isExtracting.set(false); - // Keep manual, but remove selected that are not in manual - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => - this.manualKeywords().includes(k), - ), - ); - // extractionSource stays as it was (or reset? we keep it) - this.updateQueryParams(); - break; - default: - console.warn('Unknown event type:', event); - } - // this.destroyRef.onDestroy(() => { - // this.websocketService.close(); - // }); - }); - - // Clear session storage on component destroy + // Clear session storage on component destroy, unless this is a page + // reload (in which case we want the cache to survive). this.destroyRef.onDestroy(() => { this.websocketService.close(); - const nav = this.router.lastSuccessfulNavigation; - const isReload = nav === null; + const isReload = this.router.lastSuccessfulNavigation === null; if (!isReload) { this.clearSourceFromSession(); } }); } + // --- Websocket event handling --------------------------------------- + + private handleWsEvent(event: WsEvent): void { + switch (event.type) { + case 'status': + this.handleStatusEvent(event); + break; + case 'keywords': + if (event.keywords) this.addExtractedKeyword(event.keywords); + break; + case 'completed': + this.handleCompletedEvent(event); + break; + case 'error': + this.handleErrorEvent(event); + break; + } + } + + private handleStatusEvent(event: WsEvent): void { + this.statusMessage.set(event.message || ''); + this.progress.set(this.getProgressForStep(event.step || '')); + } + + private handleCompletedEvent(event: WsEvent): void { + this.processExtractedKeywords(event.result as ExtractedKeywordsResponse); + this.progress.set(100); + this.statusMessage.set('Fertig!'); + this.websocketService.close(); + this.isExtracting.set(false); + } + + private handleErrorEvent(event: WsEvent): void { + this.progress.set(0); + this.statusMessage.set('Fehler: ' + event.message); + this.broadKeywordEntries.set([]); + this.coarseKeywordEntries.set([]); + this.fineKeywordEntries.set([]); + this.websocketService.close(); + this.isExtracting.set(false); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), + ); + this.updateQueryParams(); + } + + // --- Topic enrichment -------------------------------------------------- + + enrichManualKeywordsWithTopics(keywords: string[]): void { + if (keywords.length === 0) return; + + const currentEntries = this.manualKeywordEntries(); + const entriesByKeyword = new Map( + currentEntries.map((e) => [ + this.normalizeKeyword(e.llm_keyword.keyword), + e, + ]), + ); + + const toEnrich = keywords.filter((k) => { + const entry = entriesByKeyword.get(this.normalizeKeyword(k)); + return entry && !entry.topic_mapping?.topic; + }); + if (toEnrich.length === 0) return; + + const request: KeywordsTopicsRequest = { keywords: toEnrich }; + + this.topicsService.vectorSearchTopicsBatch(request).subscribe({ + next: ({ results }) => { + const current = this.manualKeywordEntries(); + const resultMap = new Map( + results.map((r) => [this.normalizeKeyword(r.keyword), r]), + ); + + const updated = current.map((entry) => { + const normalized = this.normalizeKeyword(entry.llm_keyword.keyword); + const enriched = resultMap.get(normalized); + if (enriched && !entry.topic_mapping?.topic) { + return { + ...entry, + topic_mapping: { + keyword: entry.llm_keyword.keyword, + topic: enriched.topic, + }, + }; + } + return entry; + }); + + this.manualKeywordEntries.set(updated); + this.updateQueryParams(); + }, + error: (error) => { + console.error('Error enriching topics:', error); + }, + }); + } + + // --- Tabs --------------------------------------------------------------- + selectedTabIndex(): number { - const mode = this.form.controls.selectedInputType.value; - if (mode === 'text') return 1; - if (mode === 'keywords') return 2; - return 0; + return this.form.controls.selectedInputType.value === 'text' ? 1 : 0; } onTabChange(index: number): void { - const nextMode: InputMode = - index === 1 ? 'text' : index === 2 ? 'keywords' : 'url'; + const nextMode: InputMode = index === 1 ? 'text' : 'url'; this.form.controls.selectedInputType.setValue(nextMode); } - // Add manually from Keywords tab - addKeywordFromInput(): void { - const keyword = this.form.controls.keywordInput.value.trim(); - if (!keyword) return; + // --- Keyword selection & manual entry ------------------------------------ - this.manualKeywords.set( - this.uniqueKeywords([...this.manualKeywords(), keyword]), - ); - this.selectedKeywords.set( - this.uniqueKeywords([...this.selectedKeywords(), keyword]), - ); - this.form.controls.keywordInput.setValue(''); - this.updateQueryParams(); + private keywordExists(keyword: string): boolean { + const normalized = this.normalizeKeyword(keyword); + return [ + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ...this.manualKeywords(), + ].some((k) => this.normalizeKeyword(k) === normalized); + } + + // Add manually from Keywords tab + addKeywordFromInput(keyword: string): void { + const normalizedKeyword = keyword.trim(); + if (!normalizedKeyword) return; + + if (this.keywordExists(normalizedKeyword)) { + this.statusMessage.set(`"${normalizedKeyword}" ist bereits vorhanden.`); + return; + } + + this.topicsService.vectorSearchTopics(normalizedKeyword).subscribe({ + next: ({ results }) => { + const newEntry: KeywordEntryWithTopic = { + llm_keyword: { + keyword: normalizedKeyword, + relevance_score: 1, + }, + topic_mapping: { + keyword: normalizedKeyword, + topic: results?.[0], + }, + }; + + const updated = this.uniqueKeywordEntries([ + ...this.manualKeywordEntries(), + newEntry, + ]); + + this.manualKeywordEntries.set(updated); + this.selectedKeywords.set([ + ...this.selectedKeywords(), + normalizedKeyword, + ]); + + // Explicit enrichment trigger for new keywords + this.enrichManualKeywordsWithTopics([normalizedKeyword]); + this.updateQueryParams(); + }, + }); } removeSelectedKeyword(keyword: string): void { @@ -213,15 +351,15 @@ export class KeywordsSearchComponent { } onCategoryChange( - category: 'broad' | 'coarse' | 'fine' | 'manual', + category: KeywordCategory, event: MatChipListboxChange, ): void { const newSelection = (event.value as string[]) || []; - const otherCategories = ['broad', 'coarse', 'fine', 'manual'].filter( - (c) => c !== category, - ); + const otherCategories = ( + Object.keys(this.categoryKeywordsMap) as KeywordCategory[] + ).filter((c) => c !== category); const otherSelected = otherCategories.flatMap((c) => { - const keywords = this.getCategoryKeywords(c); + const keywords = this.categoryKeywordsMap[c](); return this.selectedKeywords().filter((k) => keywords.includes(k)); }); const updated = [...otherSelected, ...newSelection]; @@ -229,21 +367,6 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - private getCategoryKeywords(category: string): string[] { - switch (category) { - case 'broad': - return this.broadKeywords(); - case 'coarse': - return this.coarseKeywords(); - case 'fine': - return this.fineKeywords(); - case 'manual': - return this.manualKeywords(); - default: - return []; - } - } - selectAllExtracted(): void { const all = [ ...this.selectedManualKeywords(), @@ -256,18 +379,19 @@ export class KeywordsSearchComponent { } deselectAllExtracted(): void { - const manual = this.selectedManualKeywords(); - this.selectedKeywords.set(this.uniqueKeywords(manual)); + this.selectedKeywords.set( + this.uniqueKeywords(this.selectedManualKeywords()), + ); this.updateQueryParams(); } clearExtractedKeywords(): void { - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); + this.broadKeywordEntries.set([]); + this.coarseKeywordEntries.set([]); + this.fineKeywordEntries.set([]); this.sourceContent.set(''); this.sourceUrl.set(null); - this.clearSourceFromSession(); + // Keep only selected keywords that are in the manual list const manualSet = new Set(this.manualKeywords()); this.selectedKeywords.set( @@ -277,6 +401,9 @@ export class KeywordsSearchComponent { // Reset the extraction source (no extracted keywords left) this.extractionSource.set(null); + // updateQueryParams() persists this cleared state to sessionStorage too + // (see saveSourceToSession() call inside it), so there's no need to + // separately wipe the session key here. this.updateQueryParams(); } @@ -288,110 +415,70 @@ export class KeywordsSearchComponent { ]; return allExtracted.every((k) => this.selectedKeywords().includes(k)); } - // isExtractionSourceMatch() { - // console.log( - // this.extractionSource(), - // this.form.controls.selectedInputType.value, - // ); - // return ( - // this.form.controls.selectedInputType.value === this.extractionSource() || - // this.form.controls.selectedInputType.value === 'keywords' - // ); - // } + isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + onExtractKeywordsClick(): void { if (this.isExtracting()) { this.cancelKeywordExtraction(); return; } - void this.extractKeywords(); } + addExtractedKeyword(keywords: ExtractedKeywords): void { - const broad = this.extractKeywordStrings(keywords.broad_keywords); - const coarse = this.extractKeywordStrings(keywords.coarse_grained); - const fine = this.extractKeywordStrings(keywords.fine_grained); - - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); + this.applyExtractedKeywords(keywords); } - onKeywordRemoved( - category: 'broad' | 'coarse' | 'fine' | 'manual', - keyword: string, - ): void { - // Remove from the category list - const categoryKeywords = this.getCategoryKeywords(category); - const updatedCategoryKeywords = categoryKeywords.filter( - (k) => k !== keyword, - ); - switch (category) { - case 'broad': - this.broadKeywords.set(updatedCategoryKeywords); - break; - case 'coarse': - this.coarseKeywords.set(updatedCategoryKeywords); - break; - case 'fine': - this.fineKeywords.set(updatedCategoryKeywords); - break; - case 'manual': - this.manualKeywords.set(updatedCategoryKeywords); - break; - } - // Remove from selected keywords if it was selected + onKeywordRemoved(category: KeywordCategory, keyword: string): void { + const entries = this.categoryEntriesMap[category]; + entries.set(this.filterKeywordEntries(entries(), keyword)); + this.selectedKeywords.set( this.selectedKeywords().filter((k) => k !== keyword), ); - this.updateQueryParams(); } processExtractedKeywords(result: ExtractedKeywordsResponse): void { - if (result === undefined || !result.results) { - return; - } + if (result === undefined || !result.results) return; + const { results, source, source_content, source_url } = result; - const broad = this.extractKeywordStrings(results.broad_keywords); - const coarse = this.extractKeywordStrings(results.coarse_grained); - const fine = this.extractKeywordStrings(results.fine_grained); - - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); + this.applyExtractedKeywords(results); this.sourceContent.set(source_content); this.extractionSource.set(source as InputMode); this.sourceUrl.set(source_url ?? ''); - this.saveSourceToSession(); + // Keep only selected keywords that still exist in any category (including manual) const allExtracted = [ - ...broad, - ...coarse, - ...fine, + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), ...this.manualKeywords(), ]; this.selectedKeywords.set( this.selectedKeywords().filter((k) => allExtracted.includes(k)), ); + // updateQueryParams() also calls saveSourceToSession() - no need to call + // it separately here. this.updateQueryParams(); } + async extractKeywords(): Promise { this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; - // Reset progress and status this.progress.set(0); this.statusMessage.set('Starte Extraktion...'); const currentMode = this.form.controls.selectedInputType.value; const keywordsRequest: KeywordsRequest = { - query: query, + query, mode: currentMode, limit: undefined, }; @@ -416,56 +503,168 @@ export class KeywordsSearchComponent { } search(): void { - console.log('searching for keywords:', this.selectedKeywords()); - // e.g. navigate to search results page - // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); + const payload = { + extractedKeywords: this.getSelectedExtractedKeywordEntries(), + manualKeywords: this.getSelectedManualKeywordEntries(), + keywords: this.selectedKeywords(), + }; + + console.log('searching for keywords:', payload); + // e.g. navigate to search results page with the full payload in navigation state + // this.router.navigate(['/search'], { state: payload }); } - private extractKeywordStrings(items: KeywordEntryWithTopic[]): string[] { - return this.uniqueKeywords( - (items ?? []) - .map((item) => { - const openalexKeyword = (item as any).topic_mapping?.keyword?.trim(); - const llmKeyword = (item as any).llm_keyword?.keyword?.trim(); - // return openalexKeyword || llmKeyword || ''; - return openalexKeyword || ''; - }) - .filter((kw) => !!kw), + // --- Helpers -------------------------------------------------------------- + + private selectedInCategory(category: KeywordCategory): Signal { + return computed(() => + this.selectedKeywords().filter((k) => + this.categoryKeywordsMap[category]().includes(k), + ), ); } - // State restoration from URL + private applyExtractedKeywords(keywords: ExtractedKeywords): void { + const seenKeywords = new Set( + this.manualKeywords().map((keyword) => this.normalizeKeyword(keyword)), + ); + this.broadKeywordEntries.set( + this.uniqueKeywordEntries(keywords.broad_keywords, seenKeywords), + ); + this.coarseKeywordEntries.set( + this.uniqueKeywordEntries(keywords.coarse_grained, seenKeywords), + ); + this.fineKeywordEntries.set( + this.uniqueKeywordEntries(keywords.fine_grained, seenKeywords), + ); + } + + private getSelectedExtractedKeywordEntries(): KeywordEntryWithTopic[] { + const selected = new Set( + this.selectedKeywords().map((k) => this.normalizeKeyword(k)), + ); + return [ + ...this.broadKeywordEntries(), + ...this.coarseKeywordEntries(), + ...this.fineKeywordEntries(), + ].filter((item) => + selected.has(this.normalizeKeyword(this.getKeywordLabel(item))), + ); + } + + private getSelectedManualKeywordEntries(): KeywordEntryWithTopic[] { + const selected = new Set( + this.selectedKeywords().map((k) => this.normalizeKeyword(k)), + ); + return this.manualKeywordEntries().filter((item) => + selected.has(this.normalizeKeyword(this.getKeywordLabel(item))), + ); + } + + private filterKeywordEntries( + items: KeywordEntryWithTopic[], + keyword: string, + ): KeywordEntryWithTopic[] { + const normalized = this.normalizeKeyword(keyword); + return items.filter( + (item) => + this.normalizeKeyword(this.getKeywordLabel(item)) !== normalized, + ); + } + + private getKeywordLabel(item: KeywordEntryWithTopic): string { + return item.llm_keyword.keyword.trim(); + } + + private keywordEntriesFromStrings( + keywords: string[], + seenKeywords: Set = new Set(), + ): KeywordEntryWithTopic[] { + const entries: KeywordEntryWithTopic[] = []; + + for (const keyword of this.uniqueKeywords(keywords)) { + const normalized = this.normalizeKeyword(keyword); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + entries.push({ + llm_keyword: { keyword, relevance_score: 0 }, + topic_mapping: null, + }); + } + + return entries; + } + + private uniqueKeywordEntries( + items: KeywordEntryWithTopic[], + seenKeywords: Set = new Set(), + ): KeywordEntryWithTopic[] { + const uniqueItems: KeywordEntryWithTopic[] = []; + for (const item of items ?? []) { + const normalized = this.normalizeKeyword(this.getKeywordLabel(item)); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + uniqueItems.push(item); + } + return uniqueItems; + } + + // --- URL <-> state sync ----------------------------------------------- + restoreStateFromQueryParams(): void { const queryParams = this.route.snapshot.queryParamMap; const mode = this.parseMode(queryParams.get('mode')); const urlInput = queryParams.get('url') ?? ''; const textInput = queryParams.get('text') ?? ''; - const broad = this.parseKeywordList(queryParams.get('broad')); - const coarse = this.parseKeywordList(queryParams.get('coarse')); - const fine = this.parseKeywordList(queryParams.get('fine')); const manual = this.parseKeywordList(queryParams.get('manual')); const selected = this.parseKeywordList(queryParams.get('selected')); const source = queryParams.get('source') ?? ''; + this.isRestoringState = true; + this.form.patchValue( - { - selectedInputType: mode, - urlInput, - textInput, - }, + { selectedInputType: mode, urlInput, textInput }, { emitEvent: false }, ); - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); - this.manualKeywords.set(manual); - this.selectedKeywords.set(this.uniqueKeywords(selected)); + this.extractionSource.set(source as InputMode); this.restoreSourceFromSession(); + + const merged = this.uniqueKeywordEntries([ + ...this.manualKeywordEntries(), // session restored entries + ...this.keywordEntriesFromStrings(manual), // query param entries + ]); + this.manualKeywordEntries.set(merged); + + // enrich only newly added keywords that have no topic yet + this.enrichManualKeywordsWithTopics(manual); + + // User intent (the current selection): the URL is always authoritative + // here, deliberately overriding whatever the session cache had. This + // is what makes a deep link like ?selected=foo&manual=bar from another + // page reliably preselect keywords, instead of getting merged with (or + // hidden behind) leftover state from a previous visit in the same tab. + + // clean up the selection to only include keywords that actually exist in + const manualKeywordSet = new Set( + this.manualKeywords().map((k) => this.normalizeKeyword(k)), + ); + const validSelected = selected.filter((k) => + manualKeywordSet.has(this.normalizeKeyword(k)), + ); + const selectionWasTrimmed = validSelected.length !== selected.length; + + this.selectedKeywords.set(this.uniqueKeywords(validSelected)); + this.isRestoringState = false; + + if (selectionWasTrimmed) { + this.updateQueryParams(); + } } - // Update URL query params updateQueryParams(): void { if (this.isRestoringState) return; @@ -480,42 +679,84 @@ export class KeywordsSearchComponent { selected: this.serializeKeywords(this.selectedKeywords()), }; - this.router.navigate([], { - relativeTo: this.route, - queryParams, - queryParamsHandling: 'merge', - replaceUrl: true, - }); + this.isOwnNavigation = true; + this.router + .navigate([], { + relativeTo: this.route, + queryParams, + queryParamsHandling: 'merge', + replaceUrl: true, + }) + .then((navigated) => { + // If Angular decided there was nothing to navigate (e.g. the URL + // would be identical), queryParamMap never emits, so the flag would + // otherwise stay stuck `true` and incorrectly swallow the *next* + // real external navigation. Reset it defensively in that case. + if (!navigated) { + this.isOwnNavigation = false; + } + }); + + // IMPORTANT: every state mutation flows through here, so this is also + // the single place that keeps sessionStorage in sync. Previously the + // session cache was only saved after a full extraction completed, so + // adding a manual keyword (or removing one, etc.) never updated it. The + // *next* query-param change then triggered restoreStateFromQueryParams() + // -> restoreSourceFromSession(), which overwrote the fresh manual + // keyword with that stale snapshot - making manually added keywords + // seem to vanish immediately. Saving here fixes that race. + this.saveSourceToSession(); } - // Save to sessionStorage private saveSourceToSession(): void { const data = { source: this.extractionSource(), sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), + broadKeywordEntries: this.broadKeywordEntries(), + coarseKeywordEntries: this.coarseKeywordEntries(), + fineKeywordEntries: this.fineKeywordEntries(), + manualKeywordEntries: this.manualKeywordEntries(), }; - sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + + try { + sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + } catch (error) { + console.error('Failed to persist keyword search state:', error); + } } - // Restore from sessionStorage private restoreSourceFromSession(): void { const raw = sessionStorage.getItem(this.SESSION_KEY); if (!raw) return; + try { - const { source, sourceContent, sourceUrl } = JSON.parse(raw); + const { + source, + sourceContent, + sourceUrl, + broadKeywordEntries, + coarseKeywordEntries, + fineKeywordEntries, + manualKeywordEntries, + } = JSON.parse(raw); + this.extractionSource.set(source as InputMode); this.sourceContent.set(sourceContent ?? ''); this.sourceUrl.set(sourceUrl ?? null); + this.broadKeywordEntries.set(broadKeywordEntries ?? []); + this.coarseKeywordEntries.set(coarseKeywordEntries ?? []); + this.fineKeywordEntries.set(fineKeywordEntries ?? []); + this.manualKeywordEntries.set(manualKeywordEntries ?? []); } catch { sessionStorage.removeItem(this.SESSION_KEY); } } - // Clear sessionStorage private clearSourceFromSession(): void { sessionStorage.removeItem(this.SESSION_KEY); } + private getCurrentExtractionQuery(): string { const mode = this.form.controls.selectedInputType.value; if (mode === 'url') return this.form.controls.urlInput.value.trim(); @@ -524,8 +765,7 @@ export class KeywordsSearchComponent { } private parseMode(mode: string | null): InputMode { - if (mode === 'text' || mode === 'keywords') return mode; - return 'url'; + return mode === 'text' ? 'text' : 'url'; } private parseKeywordList(rawValue: string | null): string[] { @@ -544,23 +784,41 @@ export class KeywordsSearchComponent { } private uniqueKeywords(values: string[]): string[] { - return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean))); + const uniqueValues: string[] = []; + const seenKeywords = new Set(); + + for (const value of values) { + const normalized = this.normalizeKeyword(value); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + uniqueValues.push(value.trim()); + } + + return uniqueValues; + } + + private normalizeKeyword(value: string): string { + return value.trim().toLowerCase(); } private toNullableParam(value: string): string | null { const normalized = value.trim(); return normalized.length ? normalized : null; } + private getProgressForStep(step: string): number { switch (step) { case 'started': return 10; case 'fetching_url': - return 30; + return 20; case 'content_extracted': - return 60; + return 30; case 'calling_llm': - return 80; + return 40; + case 'enriching': + return 60; default: return 50; // fallback for unknown steps } From 6dd57bfe2b2e22ea8ec88f47ded09096580ab4dd Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:56:51 +0200 Subject: [PATCH 46/92] ui adjusments --- .../keywords-search.component.html | 45 ++++-------- .../keywords-search.component.scss | 73 +++++++++---------- 2 files changed, 50 insertions(+), 68 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 958783a6..8eb10128 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -13,16 +13,16 @@ placeholder="https://example.com/article" [formControl]="form.controls.urlInput" /> -
- -
+ @@ -126,31 +126,14 @@
+ -
- - z. B. Knowledge Graphs - - - -
@if (manualKeywords().length > 0) { @for (keyword of manualKeywords(); track keyword) { Date: Fri, 3 Jul 2026 12:21:39 +0200 Subject: [PATCH 47/92] publications overview: make table cells clickable filters with active state --- .../person-publications.component.html | 72 +++++++-- .../person-publications.component.scss | 138 ++++++++++++++++-- .../person-publications.component.ts | 73 ++++++++- 3 files changed, 259 insertions(+), 24 deletions(-) diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index 274b4eb3..20b9481c 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -179,7 +179,19 @@ Jahr - {{ publication.publication_year || '-' }} + @if (publication.publication_year) { + + } @else { + - + } @@ -187,9 +199,17 @@ Typ @if (publication.type) { - - {{ publication.type }} - + } @else { - } @@ -199,7 +219,19 @@ Sprache / Quelle - {{ publication.language || '-' }} + @if (publication.language) { + + } @else { + - + } @@ -212,11 +244,33 @@ institution of publicationInstitutions.slice(0, 3); track institution.id ) { - - {{ institution.name }} - + [class.active]="isInstitutionActive(institution.id)" + [matTooltip]="institution.name" + matTooltipPosition="above" + [attr.aria-label]=" + 'Nach Institution ' + institution.name + ' filtern' + " + (click)="filterByInstitution(institution)"> + apartment + {{ institution.name }} + @if (institution.country) { + + {{ + institution.country.toUpperCase() + }} + } + } @empty { - } diff --git a/webapp/src/app/modules/person-publications/person-publications.component.scss b/webapp/src/app/modules/person-publications/person-publications.component.scss index 67adb843..3874f75f 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.scss +++ b/webapp/src/app/modules/person-publications/person-publications.component.scss @@ -267,6 +267,61 @@ a.title:hover { color: rgba(0, 0, 0, 0.54); } +.cell-filter-pill { + display: inline-flex; + align-items: center; + margin: 0; + padding: 3px 10px; + border: 1px solid var(--sg-border); + border-radius: 999px; + background: #fff; + color: var(--sg-text); + font-family: inherit; + font-size: 12px; + line-height: 1.2; + cursor: pointer; + transition: all 0.2s ease; + + &:hover, + &:focus-visible { + border-color: var(--sg-primary); + background: var(--sg-surface-soft); + outline: none; + } + + &.active { + border-color: var(--sg-primary); + color: var(--sg-primary); + font-weight: 600; + box-shadow: + 0 0 0 1px #ffffff, + 0 0 0 3px var(--sg-primary); + } +} + +.type-filter-btn { + display: inline-flex; + margin: 0; + padding: 0; + border: 0; + border-radius: 7px; + background: transparent; + cursor: pointer; + transition: box-shadow 0.2s ease; + + &:hover, + &:focus-visible { + outline: none; + box-shadow: 0 0 0 1px var(--sg-primary); + } + + &.active { + box-shadow: + 0 0 0 1px #ffffff, + 0 0 0 3px var(--sg-primary); + } +} + .topic-chips { display: flex; flex-wrap: wrap; @@ -295,31 +350,88 @@ a.title:hover { max-width: 280px; } -.publication-institution-tag, +.publication-institution-tag { + display: inline-flex; + align-items: center; + max-width: 200px; + margin: 0; + padding: 2px 6px; + border: 1px solid var(--sg-primary-border, var(--sg-border)); + border-radius: 4px; + background: var(--sg-primary-soft); + color: var(--sg-primary); + font-family: inherit; + font-size: 10px; + font-weight: 600; + line-height: normal; + cursor: pointer; + transition: all 0.2s ease; + + &:hover, + &:focus-visible { + background: var(--sg-primary); + color: #fff; + border-color: var(--sg-primary); + outline: none; + box-shadow: + 0 0 0 2px var(--sg-background), + 0 0 0 4px var(--sg-primary); + } + + &.active { + border-color: var(--sg-primary); + box-shadow: + 0 0 0 1px #ffffff, + 0 0 0 3px var(--sg-primary); + } + + &.active:hover, + &.active:focus-visible { + background: var(--sg-primary); + color: #fff; + } +} + +.publication-institution-tag .institution-icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-right: 4px; + font-size: 12px; +} + +.publication-institution-tag .institution-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; +} + +.publication-institution-tag .flag-img { + flex-shrink: 0; + margin-left: 6px; + border: 1px solid; +} + +.publication-institution-tag .country-code { + flex-shrink: 0; + margin-left: 2px; + font-size: 9px; +} + .publication-institution-more { display: inline-flex; align-items: center; - max-width: 180px; min-height: 24px; padding: 3px 8px; border: 1px solid var(--sg-border); border-radius: var(--sg-radius-sm); background: #fff; - color: var(--sg-text); + color: var(--sg-text-muted); font-size: 11px; line-height: 1.2; } -.publication-institution-tag { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.publication-institution-more { - color: var(--sg-text-muted); -} - ::ng-deep .mat-mdc-header-cell { color: var(--sg-text-muted); font-size: 12px; diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index 32f3f250..4d9f1fb0 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -25,6 +25,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; +import { MatTooltipModule } from '@angular/material/tooltip'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { catchError, @@ -100,6 +101,7 @@ interface PublicationFilterQueryState { MatSelectModule, MatSnackBarModule, MatTableModule, + MatTooltipModule, ReactiveFormsModule, RouterLink, TopicChipComponent, @@ -316,6 +318,67 @@ export class PersonPublicationsComponent implements OnInit { this.applyFilters(); } + filterByInstitution(institution: { id: string; name: string }): void { + if (!institution.id) return; + if (this.selectedInstitutions.some((item) => item.id === institution.id)) { + return; + } + this.selectedInstitutions = [ + ...this.selectedInstitutions, + { id: institution.id, display_name: institution.name }, + ]; + this.applyFilters(); + } + + isInstitutionActive(id: string): boolean { + return !!id && this.selectedInstitutions.some((item) => item.id === id); + } + + toggleYearFilter(year: number): void { + const control = this.filterForm.controls.publicationYears; + const current = control.value; + control.setValue( + current.includes(year) + ? current.filter((value) => value !== year) + : [...current, year], + ); + this.applyFilters(); + } + + toggleTypeFilter(type: string): void { + const control = this.filterForm.controls.types; + const current = control.value; + control.setValue( + current.includes(type) + ? current.filter((value) => value !== type) + : [...current, type], + ); + this.applyFilters(); + } + + toggleLanguageFilter(language: string): void { + const control = this.filterForm.controls.languages; + const current = control.value; + control.setValue( + current.includes(language) + ? current.filter((value) => value !== language) + : [...current, language], + ); + this.applyFilters(); + } + + isYearActive(year: number): boolean { + return this.filterForm.controls.publicationYears.value.includes(year); + } + + isTypeActive(type: string): boolean { + return this.filterForm.controls.types.value.includes(type); + } + + isLanguageActive(language: string): boolean { + return this.filterForm.controls.languages.value.includes(language); + } + displayTopic(option: string | TopicAutocompleteOption): string { return typeof option === 'string' ? option : (option.display_name ?? ''); } @@ -420,8 +483,13 @@ export class PersonPublicationsComponent implements OnInit { return 'info'; } - institutions(publication: Work): Array<{ id: string; name: string }> { - const institutionsById = new Map(); + institutions( + publication: Work, + ): Array<{ id: string; name: string; country: string | null }> { + const institutionsById = new Map< + string, + { id: string; name: string; country: string | null } + >(); for (const authorship of publication.authorships ?? []) { for (const institution of authorship.institutions ?? []) { @@ -430,6 +498,7 @@ export class PersonPublicationsComponent implements OnInit { institutionsById.set(institution.id, { id: institution.id, name: institution.display_name, + country: institution.country_code ?? null, }); } } From 116492baca6e8c22251a6a5133c365367d7953bb Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 3 Jul 2026 13:02:09 +0200 Subject: [PATCH 48/92] person list: style active institution filter as person-card chip --- .../person-list/person-list.component.html | 32 +++++++++++ .../person-list/person-list.component.scss | 55 ++++++++++++++++++- .../person-list/person-list.component.ts | 42 +++++++++++++- 3 files changed, 125 insertions(+), 4 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index e3d4fcc8..b0ccca88 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -61,6 +61,38 @@ close + } @else if (filter.category === 'institutionName') { + + + apartment + {{ + institutionFilterLabel(filter) + }} + @if (filter.countryCode) { + + {{ + filter.countryCode.toUpperCase() + }} + } + + + } @else { {{ filter.label }} diff --git a/webapp/src/app/modules/person-list/person-list.component.scss b/webapp/src/app/modules/person-list/person-list.component.scss index 92e7225d..7aa6e880 100644 --- a/webapp/src/app/modules/person-list/person-list.component.scss +++ b/webapp/src/app/modules/person-list/person-list.component.scss @@ -165,9 +165,58 @@ app-topic-chip.active-filter-topic-chip { white-space: nowrap; } -// Shared button resets +.active-institution-filter { + display: inline-flex; + align-items: center; + gap: 4px; + max-width: 100%; +} + +.filter-institution-chip { + display: inline-flex; + align-items: center; + max-width: min(280px, 46vw); + padding: 2px 6px; + border: 1px solid var(--sg-primary-border, var(--sg-border)); + border-radius: 4px; + background: var(--sg-primary-soft); + color: var(--sg-primary); + font-size: 11px; + font-weight: 600; +} + +.filter-institution-chip__icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-right: 4px; + font-size: 12px; +} + +.filter-institution-chip__name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; +} + +.filter-institution-chip__flag { + flex-shrink: 0; + margin-left: 6px; + border: 1px solid var(--sg-primary-border, var(--sg-border)); + vertical-align: middle; +} + +.filter-institution-chip__country { + flex-shrink: 0; + margin-left: 2px; + font-size: 9px; + white-space: nowrap; +} + .filter-chip button, .active-topic-filter button, +.active-institution-filter button, .clear-topic-search, .clear-all-btn { border: none; @@ -177,6 +226,7 @@ app-topic-chip.active-filter-topic-chip { .filter-chip button, .active-topic-filter button, +.active-institution-filter button, .clear-topic-search { padding: 0; display: flex; @@ -188,7 +238,8 @@ app-topic-chip.active-filter-topic-chip { } .filter-chip button mat-icon, -.active-topic-filter button mat-icon { +.active-topic-filter button mat-icon, +.active-institution-filter button mat-icon { font-size: 12px; width: 12px; height: 12px; diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index c20c0207..d1ad59a8 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -15,6 +15,7 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi import { CustomAuthor, + DehydratedInstitution, PersonsService, InstitutionsService, WorkTopic, @@ -289,13 +290,18 @@ export class PersonListComponent { this.applySidebarFilters(); } - // Active filters tags row get activeFilters(): Array<{ category: string; value: string; label: string; + countryCode?: string | null; }> { - const list: Array<{ category: string; value: string; label: string }> = []; + const list: Array<{ + category: string; + value: string; + label: string; + countryCode?: string | null; + }> = []; this.selectedTopics().forEach((t) => { list.push({ category: 'topic', value: t, label: `Thema: ${t}` }); }); @@ -309,11 +315,43 @@ export class PersonListComponent { category: 'institutionName', value: this.appliedInstitutionName, label: label, + countryCode: this.findInstitutionCountryCode( + this.appliedInstitutionName, + ), }); } return list; } + institutionFilterLabel(filter: { label: string }): string { + return filter.label.replace(/^Institution:\s*/, ''); + } + + private findInstitutionCountryCode(institutionName: string): string | null { + const normalized = institutionName.trim().toLowerCase(); + if (!normalized) { + return null; + } + + for (const person of this.persons) { + const candidates: Array = [ + ...(person.last_known_institutions ?? []), + ...(person.affiliations ?? []).map((a) => a.institution ?? undefined), + ]; + + for (const inst of candidates) { + if ( + inst?.country_code && + (inst.display_name ?? '').trim().toLowerCase() === normalized + ) { + return inst.country_code; + } + } + } + + return null; + } + removeFilter(filter: { category: string; value: string }): void { if (filter.category === 'topic') { this.selectedTopics.update((set) => { From 6fa5792e5eb5c0b74fd91dcf4ffc9b899356051e Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 3 Jul 2026 13:10:13 +0200 Subject: [PATCH 49/92] publication overview: show institution filter as person-card chip with flag --- .../person-publications.component.html | 22 +++++++- .../person-publications.component.scss | 54 ++++++++++++++++++- .../person-publications.component.ts | 16 ++++++ 3 files changed, 88 insertions(+), 4 deletions(-) diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index 20b9481c..375842a1 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -141,8 +141,26 @@ } @for (institution of selectedInstitutions; track institution.id) { - - Institution: {{ institution.display_name }} + @let instCountry = selectedInstitutionCountry(institution); + + + apartment + {{ + institution.display_name + }} + @if (instCountry) { + + {{ + instCountry.toUpperCase() + }} + } + + + +
+ diff --git a/webapp/src/app/modules/account/account.component.scss b/webapp/src/app/modules/account/account.component.scss index 25c46861..ff03e82e 100644 --- a/webapp/src/app/modules/account/account.component.scss +++ b/webapp/src/app/modules/account/account.component.scss @@ -42,3 +42,25 @@ font-weight: 600; color: var(--sg-text-muted); } + +.settings-tab { + padding: 1rem; + max-width: 50%; + display: flex; + flex-direction: column; + gap: 1rem; +} + +.change-password-form { + display: flex; + flex-direction: column; + gap: 1.5rem; +} + +.new-password-fields { + display: flex; + gap: 1rem; + > mat-form-field { + width: 100%; + } +} diff --git a/webapp/src/app/modules/account/account.component.ts b/webapp/src/app/modules/account/account.component.ts index 7a953dee..d4a9b5aa 100644 --- a/webapp/src/app/modules/account/account.component.ts +++ b/webapp/src/app/modules/account/account.component.ts @@ -1,21 +1,156 @@ -import { Component, effect, input } from '@angular/core'; +import { + Component, + computed, + effect, + inject, + input, + signal, +} from '@angular/core'; import { AccountProfile, UserRole } from '../../api'; import { RolePipe } from '../../shared/pipes/role.pipe'; import { MatChipsModule } from '@angular/material/chips'; import { MatTabsModule } from '@angular/material/tabs'; import { MatDividerModule } from '@angular/material/divider'; +import { MatInputModule } from '@angular/material/input'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { + form, + FormField, + maxLength, + minLength, + required, + validate, + FormRoot, +} from '@angular/forms/signals'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { CredentialService } from '../../shared/services/credential.service'; +import { MatSnackBar } from '@angular/material/snack-bar'; + +interface ChangePasswordForm { + oldPassword: string; + newPassword: string; + newPasswordRepeat: string; + showPasswords: boolean; +} @Component({ selector: 'app-account', - imports: [RolePipe, MatChipsModule, MatTabsModule, MatDividerModule], + imports: [ + RolePipe, + MatChipsModule, + MatTabsModule, + MatDividerModule, + MatInputModule, + FormsModule, + ReactiveFormsModule, + MatFormFieldModule, + MatDividerModule, + MatIconModule, + MatButtonModule, + MatSlideToggleModule, + FormField, + FormRoot, + ], templateUrl: './account.component.html', styleUrl: './account.component.scss', }) export class AccountComponent { readonly accountProfile = input.required(); + private readonly _credentialService = inject(CredentialService); + private readonly _snackBar = inject(MatSnackBar); + roles: UserRole[] = []; + changePasswordModel = signal({ + oldPassword: '', + newPassword: '', + newPasswordRepeat: '', + showPasswords: false, + }); + + oldPasswordErrorMessage = computed(() => { + const errors = this.changePasswordForm.oldPassword().errors(); + return errors.length > 0 && errors[0].message ? errors[0].message : null; + }); + + newPasswordErrorMessage = computed(() => { + const errors = this.changePasswordForm.newPassword().errors(); + return errors.length > 0 && errors[0].message ? errors[0].message : null; + }); + + newPasswordRepeatErrorMessage = computed(() => { + const errors = this.changePasswordForm.newPasswordRepeat().errors(); + return errors.length > 0 && errors[0].message ? errors[0].message : null; + }); + + changePasswordForm = form( + this.changePasswordModel, + (schemaPath) => { + required(schemaPath.oldPassword, { + message: 'Altes Passwort ist erforderlich.', + }); + required(schemaPath.newPassword, { + message: 'Neues Passwort ist erforderlich.', + }); + required(schemaPath.newPasswordRepeat, { + message: 'Neues Passwort wiederholen ist erforderlich.', + }); + + minLength(schemaPath.newPassword, 8, { + message: 'Neues Passwort muss mindestens 8 Zeichen lang sein.', + }); + maxLength(schemaPath.newPassword, 64, { + message: 'Neues Passwort darf maximal 64 Zeichen lang sein.', + }); + + validate(schemaPath.newPasswordRepeat, ({ value, valueOf }) => { + const newPassword = valueOf(schemaPath.newPassword).trim(); + const newPasswordRepeat = value().trim(); + + if (newPassword !== newPasswordRepeat) { + return { + kind: 'passwordMismatch', + message: 'Passwörter stimmen nicht überein.', + }; + } + + return null; + }); + }, + { + submission: { + action: async (field) => { + const oldPassword = field.oldPassword().value().trim(); + const newPassword = field.newPassword().value().trim(); + + if (!oldPassword || !newPassword) { + return; + } + this._credentialService + .changePassword(oldPassword, newPassword) + .subscribe({ + error: (error) => { + console.error('Error changing password:', error); + this._snackBar.open( + 'Das alte Passwort ist nicht korrekt. Bitte versuchen Sie es erneut.', + 'OK', + { duration: 7000 }, + ); + }, + }); + }, + }, + }, + ); + + inputFieldType = computed(() => + this.changePasswordModel().showPasswords ? 'text' : 'password', + ); + constructor() { effect(() => { this.roles = [this.accountProfile().role]; diff --git a/webapp/src/app/shared/services/credential.service.ts b/webapp/src/app/shared/services/credential.service.ts index 8e72953f..f276073c 100644 --- a/webapp/src/app/shared/services/credential.service.ts +++ b/webapp/src/app/shared/services/credential.service.ts @@ -18,6 +18,7 @@ import { AccountProfile, } from '../../api'; import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Router } from '@angular/router'; type LogoutResult = 'logged-out' | 'stopped-impersonating'; type UnauthorizedRecoveryResult = @@ -66,7 +67,7 @@ export class CredentialService { private request = 0; - constructor() { + constructor(private readonly router: Router) { const data = localStorage.getItem(CredentialService.KEY_GRANT); const id = data ? (JSON.parse(data) as AccessToken) : undefined; if (id && new Date(id.expires_at).getTime() >= Date.now()) { @@ -212,6 +213,7 @@ export class CredentialService { this.login.next(''); this.email.next(''); this.organizationName.next(''); + this.router.navigate(['/login'], { replaceUrl: true }); } public handleUnauthorized(): Observable { @@ -260,8 +262,13 @@ export class CredentialService { { withCredentials: true }, ) .pipe( - tap(() => this.clearLocalAuthState()), + tap(() => { + this.clearLocalAuthState(); + }), map(() => undefined), + catchError((err) => { + throw err; + }), ); } From cac2d81b5cf9452c798f14b66fe5415a88c4e8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 3 Jul 2026 13:14:05 +0200 Subject: [PATCH 51/92] fix(auth): prevention for same old and new password --- service/src/main/inse/auth/service.py | 10 ++++++++++ .../src/app/modules/account/account.component.ts | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/service/src/main/inse/auth/service.py b/service/src/main/inse/auth/service.py index d822d92c..0af15a4b 100644 --- a/service/src/main/inse/auth/service.py +++ b/service/src/main/inse/auth/service.py @@ -1080,6 +1080,16 @@ def change_password( detail="Current password is incorrect.", ) + if current_password == new_password: + logger.warning( + "Password change failed: new password is the same as the current password for account %s", + account.id, + ) + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail="New password cannot be the same as the current password.", + ) + account.password_hash = _hash_password(new_password) account.epoch += 1 diff --git a/webapp/src/app/modules/account/account.component.ts b/webapp/src/app/modules/account/account.component.ts index d4a9b5aa..8b3eec70 100644 --- a/webapp/src/app/modules/account/account.component.ts +++ b/webapp/src/app/modules/account/account.component.ts @@ -120,6 +120,21 @@ export class AccountComponent { return null; }); + + validate(schemaPath.newPassword, ({ value }) => { + const oldPassword = this.changePasswordModel().oldPassword.trim(); + const newPassword = value().trim(); + + if (oldPassword && newPassword && oldPassword === newPassword) { + return { + kind: 'passwordSameAsOld', + message: + 'Neues Passwort darf nicht dasselbe wie das alte Passwort sein.', + }; + } + + return null; + }); }, { submission: { From 8e56b59122a95da008a4a5c6ed59ecb5ba1d74e6 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 3 Jul 2026 13:16:04 +0200 Subject: [PATCH 52/92] person card: highlight institution when it matches active filter --- .../modules/person-card/person-card.component.html | 1 + .../modules/person-card/person-card.component.scss | 13 +++++++++++++ .../modules/person-card/person-card.component.ts | 9 +++++++++ .../modules/person-list/person-list.component.html | 1 + 4 files changed, 24 insertions(+) diff --git a/webapp/src/app/modules/person-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index 3522a567..49edc9ae 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -57,6 +57,7 @@ - @if (selectedInstitutions.length || selectedTopics.length) { + @let selectedYears = filterForm.controls.publicationYears.value; + @let selectedTypes = filterForm.controls.types.value; + @let selectedLanguages = filterForm.controls.languages.value; + @if ( + selectedInstitutions.length || + selectedTopics.length || + selectedYears.length || + selectedTypes.length || + selectedLanguages.length + ) {
Aktive Filter:
+ @for (year of selectedYears; track year) { + + + calendar_today + {{ year }} + + + + } + @for (type of selectedTypes; track type) { + + + category + {{ type }} + + + + } + @for (language of selectedLanguages; track language) { + + + translate + {{ + languageLabel(language) + }} + + + + } @for (topic of selectedTopics; track topic.id) { Thema: diff --git a/webapp/src/app/modules/person-publications/person-publications.component.scss b/webapp/src/app/modules/person-publications/person-publications.component.scss index 1f30a182..bf67b546 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.scss +++ b/webapp/src/app/modules/person-publications/person-publications.component.scss @@ -43,7 +43,7 @@ h2 { } .publication-filters mat-form-field { - width: 150px; + width: 175px; } .publication-filters .institution-filter, @@ -77,8 +77,17 @@ h2 { ::ng-deep .publication-filters .mat-mdc-text-field-wrapper { height: 42px; - background: #fff; + background: var(--sg-surface-soft); + border: 1px solid var(--sg-border); border-radius: var(--sg-radius-sm); + transition: + border-color 0.15s, + box-shadow 0.15s; +} + +::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper { + border-color: var(--sg-primary); + box-shadow: 0 0 0 2px var(--sg-primary-soft); } ::ng-deep .publication-filters .mat-mdc-form-field-infix { @@ -90,7 +99,19 @@ h2 { ::ng-deep .publication-filters .mdc-notched-outline__leading, ::ng-deep .publication-filters .mdc-notched-outline__notch, ::ng-deep .publication-filters .mdc-notched-outline__trailing { - border-color: #d9e2f0; + border: none; +} + +.filter-prefix-icon { + width: 18px; + height: 18px; + font-size: 18px; + color: var(--sg-text-soft); +} + +::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix { + padding: 0 4px 0 10px; + color: var(--sg-text-soft); } ::ng-deep .publication-filters .mat-mdc-select-value, @@ -118,6 +139,44 @@ h2 { line-height: 1.2; } +::ng-deep .select-search { + position: sticky; + top: 0; + z-index: 1; + display: flex; + align-items: center; + gap: 6px; + min-width: 200px; + padding: 8px 12px; + background: var(--sg-surface, #fff); + border-bottom: 1px solid var(--sg-border); +} + +::ng-deep .select-search__icon { + flex-shrink: 0; + width: 16px; + height: 16px; + font-size: 16px; + color: var(--sg-text-soft); +} + +::ng-deep .select-search__input { + flex: 1; + min-width: 0; + border: none; + outline: none; + background: transparent; + color: var(--sg-text); + font-family: inherit; + font-size: 13px; +} + +::ng-deep .select-search__empty { + padding: 10px 14px; + color: var(--sg-text-muted); + font-size: 13px; +} + .active-filters-row { display: flex; align-items: center; @@ -185,7 +244,7 @@ h2 { .filter-institution-chip { display: inline-flex; align-items: center; - max-width: 220px; + max-width: 340px; padding: 2px 6px; border: 1px solid var(--sg-primary-border, var(--sg-border)); border-radius: 4px; @@ -204,10 +263,13 @@ h2 { } .institution-name { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; min-width: 0; + white-space: normal; + overflow-wrap: anywhere; } .flag-img { @@ -223,6 +285,41 @@ h2 { } } +.active-meta-filter { + display: inline-flex; + align-items: center; + gap: 4px; + max-width: 100%; +} + +.filter-meta-chip { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border: 1px solid var(--sg-border-strong); + border-radius: 4px; + background: var(--sg-surface-soft); + color: var(--sg-text); + font-size: 11px; + font-weight: 600; +} + +.filter-meta-chip__icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-right: 4px; + font-size: 12px; + color: var(--sg-text-soft); +} + +.filter-meta-chip__label { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; +} + app-topic-chip.active-filter-topic-chip { max-width: min(320px, 48vw); } @@ -240,7 +337,8 @@ app-topic-chip.active-filter-topic-chip { .filter-chip button, .active-topic-filter button, -.active-institution-filter button { +.active-institution-filter button, +.active-meta-filter button { display: flex; padding: 0; border: 0; @@ -255,7 +353,8 @@ app-topic-chip.active-filter-topic-chip { .filter-chip button mat-icon, .active-topic-filter button mat-icon, -.active-institution-filter button mat-icon { +.active-institution-filter button mat-icon, +.active-meta-filter button mat-icon { width: 12px; height: 12px; font-size: 12px; @@ -397,6 +496,7 @@ table.is-hidden { .institution-tags { display: flex; flex-wrap: wrap; + align-items: flex-start; gap: 6px; max-width: 280px; } @@ -404,7 +504,7 @@ table.is-hidden { .publication-institution-tag { display: inline-flex; align-items: center; - max-width: 200px; + max-width: 100%; margin: 0; padding: 2px 6px; border: 1px solid var(--sg-primary-border, var(--sg-border)); @@ -452,10 +552,13 @@ table.is-hidden { } .publication-institution-tag .institution-name { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; min-width: 0; + white-space: normal; + overflow-wrap: anywhere; } .publication-institution-tag .flag-img { @@ -521,6 +624,17 @@ table.is-hidden { .mat-column-citations { text-align: center; } + + .mat-mdc-header-cell.mat-column-title, + .mat-mdc-header-cell.mat-column-institutions, + .mat-mdc-header-cell.mat-column-topics { + text-align: center; + } + + .mat-mdc-cell:not(:last-child), + .mat-mdc-header-cell:not(:last-child) { + border-right: 1px solid var(--sg-border); + } } mat-paginator { diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index d689e672..e0efcbf2 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -139,6 +139,9 @@ export class PersonPublicationsComponent implements OnInit { >('', { nonNullable: true, }); + readonly yearSearchControl = new FormControl('', { nonNullable: true }); + readonly typeSearchControl = new FormControl('', { nonNullable: true }); + readonly languageSearchControl = new FormControl('', { nonNullable: true }); readonly filterForm = new FormGroup({ publicationYears: new FormControl([], { nonNullable: true }), @@ -547,6 +550,68 @@ export class PersonPublicationsComponent implements OnInit { return Array.from(institutionsById.values()); } + yearSelectionSummary(): string { + return this.summarizeSelection( + this.filterForm.controls.publicationYears.value.map((year) => + String(year), + ), + ); + } + + typeSelectionSummary(): string { + return this.summarizeSelection(this.filterForm.controls.types.value); + } + + languageSelectionSummary(): string { + const labels = this.filterForm.controls.languages.value.map( + (value) => + this.languageOptions.find((option) => option.value === value)?.label ?? + value, + ); + return this.summarizeSelection(labels); + } + + private summarizeSelection(labels: string[]): string { + if (labels.length === 0) return ''; + if (labels.length === 1) return labels[0]; + return `+${labels.length}`; + } + + languageLabel(value: string): string { + return ( + this.languageOptions.find((option) => option.value === value)?.label ?? + value + ); + } + + filteredYearOptions(): number[] { + const term = this.yearSearchControl.value.trim(); + if (!term) return this.publicationYearOptions; + return this.publicationYearOptions.filter((year) => + String(year).includes(term), + ); + } + + filteredTypeOptions(): { value: string; label: string }[] { + const term = this.typeSearchControl.value.trim().toLowerCase(); + if (!term) return this.typeOptions; + return this.typeOptions.filter((type) => + type.label.toLowerCase().includes(term), + ); + } + + filteredLanguageOptions(): { value: string; label: string }[] { + const term = this.languageSearchControl.value.trim().toLowerCase(); + if (!term) return this.languageOptions; + return this.languageOptions.filter((language) => + language.label.toLowerCase().includes(term), + ); + } + + focusSelectSearch(input: HTMLInputElement): void { + setTimeout(() => input.focus()); + } + private filters() { return { publicationYears: this.filterForm.controls.publicationYears.value, From c1cba4bd4cace89e96a4baaafd60d59f0c494454 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 3 Jul 2026 15:54:24 +0200 Subject: [PATCH 57/92] person cards: limit topic display if too large --- webapp/src/app/modules/person-card/person-card.component.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/src/app/modules/person-card/person-card.component.scss b/webapp/src/app/modules/person-card/person-card.component.scss index 582fca20..c8b2db5a 100644 --- a/webapp/src/app/modules/person-card/person-card.component.scss +++ b/webapp/src/app/modules/person-card/person-card.component.scss @@ -263,6 +263,7 @@ } app-topic-chip.person-topic-chip { + min-width: 0; max-width: 100%; } @@ -271,6 +272,8 @@ app-topic-chip.person-topic-chip { } :host ::ng-deep app-topic-chip.person-topic-chip .topic-chip__label { + justify-self: stretch; + min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; From 1297f85124a914cccfbfa1bd3c99db3a2a373adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 3 Jul 2026 16:56:17 +0200 Subject: [PATCH 58/92] feat(auth): started auth restructure --- webapp/src/app/api/.openapi-generator/FILES | 1 + webapp/src/app/api/api/auth.service.ts | 10 +- webapp/src/app/api/model/models.ts | 1 + webapp/src/app/api/model/otkResponse.ts | 22 + webapp/src/app/app.routes.ts | 10 + .../app/modules/account/account.component.ts | 25 +- .../modules/accounts/accounts.component.html | 189 +++----- .../modules/accounts/accounts.component.scss | 5 + .../modules/accounts/accounts.component.ts | 122 ++++- .../modules/app-login/app-login.component.ts | 137 +++--- .../app-register/app-register.component.ts | 36 +- .../app/resolvers/accounts-page.resolver.ts | 19 + webapp/src/app/shared/guards/admin.guard.ts | 51 +- .../app/shared/guards/super-admin.guard.ts | 49 +- webapp/src/app/shared/guards/user.guard.ts | 37 +- .../authentication.interceptor.ts | 125 +++-- .../app/shared/services/credential.service.ts | 447 ++++++++---------- .../ui/app-layout/app-layout.component.html | 4 +- .../ui/app-layout/app-layout.component.ts | 27 +- .../ui/app-menu/app-menu.component.html | 14 +- .../shared/ui/app-menu/app-menu.component.ts | 12 +- 21 files changed, 664 insertions(+), 679 deletions(-) create mode 100644 webapp/src/app/api/model/otkResponse.ts create mode 100644 webapp/src/app/resolvers/accounts-page.resolver.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index f9eb4ffa..bc570cfd 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -139,6 +139,7 @@ model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts model/organizationPage.ts +model/otkResponse.ts model/patentEntry.ts model/patentsByAuthorResponse.ts model/personBio.ts diff --git a/webapp/src/app/api/api/auth.service.ts b/webapp/src/app/api/api/auth.service.ts index 6beb60cc..ef111294 100644 --- a/webapp/src/app/api/api/auth.service.ts +++ b/webapp/src/app/api/api/auth.service.ts @@ -41,6 +41,8 @@ import { InseAccountManagementModelOrganizationProfile } from '../model/inseAcco // @ts-ignore import { LoginResponse } from '../model/loginResponse'; // @ts-ignore +import { OtkResponse } from '../model/otkResponse'; +// @ts-ignore import { UpdateAccountRequest } from '../model/updateAccountRequest'; // @ts-ignore @@ -738,9 +740,9 @@ export class AuthService extends BaseService { * @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 requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; public requestOtk(bodyRequestOtk: BodyRequestOtk, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (bodyRequestOtk === null || bodyRequestOtk === undefined) { throw new Error('Required parameter bodyRequestOtk was null or undefined when calling requestOtk.'); @@ -782,7 +784,7 @@ export class AuthService extends BaseService { let localVarPath = `/api/auth/v2/request-otk`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: bodyRequestOtk, diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 6876bbeb..6d485f3d 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -115,6 +115,7 @@ export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; export * from './organizationPage'; +export * from './otkResponse'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; export * from './personBio'; diff --git a/webapp/src/app/api/model/otkResponse.ts b/webapp/src/app/api/model/otkResponse.ts new file mode 100644 index 00000000..7d956289 --- /dev/null +++ b/webapp/src/app/api/model/otkResponse.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface OtkResponse { + /** + * The status of the one-time code (OTC) request. + */ + status: string; + /** + * The unique identifier of the account for which the OTC was requested. + */ + account_id: string; +} + diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index efc1388d..c515ba70 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -21,6 +21,7 @@ import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu- import { euSingleProjectResolver } from './resolvers/eu-single-project-resolver'; import { publicationResolver } from './resolvers/publication-resolver'; import { accountResolver } from './resolvers/account.resolver'; +import { accountsPageResolver } from './resolvers/accounts-page.resolver'; export const routes: Routes = [ { @@ -107,6 +108,15 @@ export const routes: Routes = [ import('./modules/accounts/accounts.component').then( (mod) => mod.AccountsComponent, ), + resolve: { + accountPage: accountsPageResolver, + }, + runGuardsAndResolvers: (from, to) => { + const keys = ['page', 'size', 'search', 'organization_id']; + return keys.some( + (key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key), + ); + }, }, { path: 'organizations', diff --git a/webapp/src/app/modules/account/account.component.ts b/webapp/src/app/modules/account/account.component.ts index 8b3eec70..647e5a99 100644 --- a/webapp/src/app/modules/account/account.component.ts +++ b/webapp/src/app/modules/account/account.component.ts @@ -145,18 +145,19 @@ export class AccountComponent { if (!oldPassword || !newPassword) { return; } - this._credentialService - .changePassword(oldPassword, newPassword) - .subscribe({ - error: (error) => { - console.error('Error changing password:', error); - this._snackBar.open( - 'Das alte Passwort ist nicht korrekt. Bitte versuchen Sie es erneut.', - 'OK', - { duration: 7000 }, - ); - }, - }); + try { + await this._credentialService.changePassword( + oldPassword, + newPassword, + ); + } catch (error) { + console.error('Error changing password:', error); + this._snackBar.open( + 'Fehler beim Ändern des Passworts. Bitte versuchen Sie es erneut.', + 'OK', + { duration: 7000 }, + ); + } }, }, }, diff --git a/webapp/src/app/modules/accounts/accounts.component.html b/webapp/src/app/modules/accounts/accounts.component.html index 6a5fdb83..f8b2263f 100644 --- a/webapp/src/app/modules/accounts/accounts.component.html +++ b/webapp/src/app/modules/accounts/accounts.component.html @@ -14,133 +14,64 @@ -
- - Name oder E-Mail - - - - @if (credentialService.isEffectiveSuperAdmin()) { - - Organisation - - Alle Organisationen - @for (organization of organizations; track organization.id) { - - {{ organization.name }} - - } - - - } - -
- - -
-
- -
-
- {{ total }} Accounts - @if (isLoading) { - Wird geladen... - } -
- -
- - - - - - - - - - - - - @for (account of accounts; track account.id) { - - - - - - - - - } @empty { - - - - } - -
NameE-MailOrganisationRolleStatusAktionen
- - {{ account.email }}{{ account.organization_name }} - {{ account.role | role }} - - - {{ account.deleted ? 'deleted' : 'active' }} - - -
- - - -
-
Keine Accounts gefunden.
-
- - -
+
+ + +
+ + + + + + + + + {{ row.role | role }} + + + + + {{ row.deleted ? 'deleted' : 'active' }} + + + + +
+ + + +
+
diff --git a/webapp/src/app/modules/accounts/accounts.component.scss b/webapp/src/app/modules/accounts/accounts.component.scss index 53149e49..d06f840b 100644 --- a/webapp/src/app/modules/accounts/accounts.component.scss +++ b/webapp/src/app/modules/accounts/accounts.component.scss @@ -145,3 +145,8 @@ tr.deleted { flex-direction: column; } } + +mat-card, +mat-paginator { + background-color: var(--sg-background); +} diff --git a/webapp/src/app/modules/accounts/accounts.component.ts b/webapp/src/app/modules/accounts/accounts.component.ts index f02fa6da..17b62579 100644 --- a/webapp/src/app/modules/accounts/accounts.component.ts +++ b/webapp/src/app/modules/accounts/accounts.component.ts @@ -1,5 +1,13 @@ import { CommonModule } from '@angular/common'; -import { Component, OnInit, inject } from '@angular/core'; +import { + Component, + OnInit, + TemplateRef, + effect, + inject, + input, + viewChild, +} from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatFormFieldModule } from '@angular/material/form-field'; @@ -10,9 +18,8 @@ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { finalize } from 'rxjs'; -import { AccountManagementService } from '../../shared/services/account-management.service'; -import type { - AccountProfile, +import { + AccountManagementService, AccountRole, OrganizationProfile, } from '../../shared/services/account-management.service'; @@ -22,6 +29,18 @@ import type { AccountDialogResult, } from './account-dialog.component'; import { RolePipe } from '../../shared/pipes/role.pipe'; +import { + GenericColumn, + DataTableComponent, +} from '../../shared/ui/data-table/data-table.component'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; +import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../../shared/ui/query-param-selector/query-param-selector.component'; +import { MatCardModule } from '@angular/material/card'; +import { AccountPage, AccountProfile } from '../../api'; @Component({ selector: 'app-accounts', @@ -36,6 +55,11 @@ import { RolePipe } from '../../shared/pipes/role.pipe'; MatSnackBarModule, MatDialogModule, RolePipe, + DataTableComponent, + QueryParamPaginatorComponent, + QueryParamInputComponent, + QueryParamSelectorComponent, + MatCardModule, ], templateUrl: './accounts.component.html', styleUrl: './accounts.component.scss', @@ -67,9 +91,63 @@ export class AccountsComponent implements OnInit { organizationId: new FormControl(''), }); + accountColumns: GenericColumn[] = []; + accountRoleTmp = viewChild.required>('accountRoleTmp'); + accountStatusTmp = viewChild.required>('accountStatusTmp'); + accountActionsTmp = viewChild.required>('accountActionsTmp'); + + selectorOptions: SelectorOption[] = []; + + accountPage = input.required(); + + constructor() { + effect(() => { + console.log('accountPage changed:', this.accountPage()); + }); + } + ngOnInit(): void { this.loadOrganizations(); this.loadAccounts(); + this.accountColumns = [ + { + id: 'name', + header: 'Name', + type: 'accessor', + accessorKey: 'name', + }, + { + id: 'email', + header: 'E-Mail', + type: 'accessor', + accessorKey: 'email', + }, + { + id: 'organization_name', + header: 'Organisation', + type: 'accessor', + accessorKey: 'organization_name', + }, + { + id: 'role', + header: 'Rolle', + type: 'accessor', + accessorKey: 'role', + cellTemplate: this.accountRoleTmp(), + }, + { + id: 'status', + header: 'Status', + type: 'display', + cellTemplate: this.accountStatusTmp(), + }, + { + id: 'actions', + header: 'Aktionen', + type: 'display', + cellTemplate: this.accountActionsTmp(), + }, + ]; } protected loadAccounts(page = this.page): void { @@ -101,6 +179,10 @@ export class AccountsComponent implements OnInit { this.accountService.listOrganizations().subscribe({ next: (organizations) => { this.organizations = organizations; + this.selectorOptions = organizations.map((org) => ({ + value: org.id, + display_name: org.name, + })); }, }); } @@ -199,28 +281,24 @@ export class AccountsComponent implements OnInit { }); } - protected impersonate(account: AccountProfile): void { + protected async impersonate(account: AccountProfile): Promise { if (!this.canImpersonate(account)) { return; } - this.credentialService.impersonateAccount(account.id).subscribe({ - next: () => { - this.snackBar.open(`Impersonation aktiv: ${account.name}`, 'OK', { - duration: 4000, - }); - this.router.navigate(['/dashboard']); - }, - error: () => { - this.snackBar.open( - 'Impersonation konnte nicht gestartet werden.', - 'OK', - { - duration: 5000, - }, - ); - }, - }); + try { + await this.credentialService.impersonateAccount(account.id); + this.snackBar.open(`Impersonation aktiv: ${account.name}`, 'OK', { + duration: 4000, + }); + this.router.navigate(['/dashboard']); + } catch (error) { + console.error('Impersonation failed:', error); + this.snackBar.open('Impersonation konnte nicht gestartet werden.', 'OK', { + duration: 5000, + }); + return; + } } protected get canPageBack(): boolean { diff --git a/webapp/src/app/modules/app-login/app-login.component.ts b/webapp/src/app/modules/app-login/app-login.component.ts index 7d3b0cf7..916c5a33 100644 --- a/webapp/src/app/modules/app-login/app-login.component.ts +++ b/webapp/src/app/modules/app-login/app-login.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, effect, OnDestroy } from '@angular/core'; import { FormControl, FormGroup, @@ -11,7 +11,7 @@ import { MatInputModule } from '@angular/material/input'; import { CredentialService } from '../../shared/services/credential.service'; import { MatIconModule } from '@angular/material/icon'; import { CommonModule } from '@angular/common'; -import { finalize, Subscription } from 'rxjs'; +import { Subscription } from 'rxjs'; import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; import { Router, RouterLink } from '@angular/router'; import { HttpErrorResponse } from '@angular/common/http'; @@ -34,7 +34,7 @@ type LoginStep = 'credentials' | 'otk'; styleUrl: './app-login.component.scss', standalone: true, }) -export class AppLoginComponent implements OnInit, OnDestroy { +export class AppLoginComponent implements OnDestroy { credentialsForm = new FormGroup({ email: new FormControl('', [Validators.required, Validators.email]), password: new FormControl('', [ @@ -64,28 +64,21 @@ export class AppLoginComponent implements OnInit, OnDestroy { protected credentialService: CredentialService, protected router: Router, protected snackBar: MatSnackBar, - ) {} - - ngOnInit(): void { - this.subscription = this.credentialService.validating.subscribe( - (validating) => { - if (validating) { - this.credentialsForm.disable(); - this.otkForm.disable(); - } else { - this.credentialsForm.enable(); - this.otkForm.enable(); - this.checkEnter(); - } - }, - ); - if (!this.credentialService.validating.value) { - this.checkEnter(); - } + ) { + effect(() => { + if (this.credentialService.isValidating()) { + this.credentialsForm.disable(); + this.otkForm.disable(); + } else { + this.credentialsForm.enable(); + this.otkForm.enable(); + this.checkEnter(); + } + }); } checkEnter(): void { - if (this.credentialService.isAuthenticated.value) { + if (this.credentialService.isAuthenticated()) { this.router.navigate(['/dashboard']); } } @@ -98,7 +91,7 @@ export class AppLoginComponent implements OnInit, OnDestroy { this.stopCountdown(); } - requestOtk() { + async requestOtk() { if (this.credentialsForm.invalid || this.isSubmitting) { this.credentialsForm.markAllAsTouched(); return; @@ -110,39 +103,36 @@ export class AppLoginComponent implements OnInit, OnDestroy { const email = this.credentialsForm.controls.email.value ?? ''; const password = this.credentialsForm.controls.password.value ?? ''; - this.credentialService - .requestOtk(email, password) - .pipe( - finalize(() => { - this.isSubmitting = false; - this.credentialsForm.enable(); - }), - ) - .subscribe({ - next: (accountId) => { - if (!accountId) { - return; - } - - this.accountId = accountId; - this.currentStep = 'otk'; - this.otkForm.reset(); - this.startCountdown(); - this.snackBar.open( - 'OTK-Code wurde an die E-Mail-Adresse gesendet.', - 'OK', - { - duration: 4000, - }, - ); + try { + const otkResponse = await this.credentialService.requestOtk( + email, + password, + ); + const accountId = otkResponse.account_id; + this.accountId = accountId; + this.currentStep = 'otk'; + this.otkForm.reset(); + this.startCountdown(); + this.snackBar.open( + 'OTK-Code wurde an die E-Mail-Adresse gesendet.', + 'OK', + { + duration: 4000, }, - error: (error: HttpErrorResponse) => { - this.credentialService.clearLocalAuthState(); - this.snackBar.open(this.getLoginErrorMessage(error), 'OK', { - duration: 5000, - }); + ); + } catch (error: unknown) { + this.credentialService.clearLocalAuthState(); + this.snackBar.open( + this.getLoginErrorMessage(error as HttpErrorResponse), + 'OK', + { + duration: 5000, }, - }); + ); + } finally { + this.isSubmitting = false; + this.credentialsForm.enable(); + } } resendCode() { @@ -153,7 +143,7 @@ export class AppLoginComponent implements OnInit, OnDestroy { this.requestOtk(); } - login() { + async login() { if (this.otkForm.invalid || this.isSubmitting) { this.otkForm.markAllAsTouched(); return; @@ -178,29 +168,25 @@ export class AppLoginComponent implements OnInit, OnDestroy { this.isSubmitting = true; this.otkForm.disable(); - const email = this.credentialsForm.controls.email.value ?? ''; const code = this.otkForm.controls.code.value ?? ''; - this.credentialService - .loginWithOtk(this.accountId, email, code) - .pipe( - finalize(() => { - this.isSubmitting = false; - this.otkForm.enable(); - }), - ) - .subscribe({ - next: () => { - this.stopCountdown(); - this.router.navigate(['/dashboard']); + try { + await this.credentialService.loginWithOtk(this.accountId, code); + this.stopCountdown(); + this.router.navigate(['/dashboard']); + } catch (error: unknown) { + this.credentialService.clearLocalAuthState(); + this.snackBar.open( + this.getLoginErrorMessage(error as HttpErrorResponse), + 'OK', + { + duration: 5000, }, - error: (error: HttpErrorResponse) => { - this.credentialService.clearLocalAuthState(); - this.snackBar.open(this.getLoginErrorMessage(error), 'OK', { - duration: 5000, - }); - }, - }); + ); + } finally { + this.isSubmitting = false; + this.otkForm.enable(); + } } editCredentials() { @@ -240,6 +226,7 @@ export class AppLoginComponent implements OnInit, OnDestroy { } private getLoginErrorMessage(error: HttpErrorResponse): string { + console.error('Login error:', error); if (error.status === 401) { return 'E-Mail, Passwort oder OTK-Code ist ungültig.'; } diff --git a/webapp/src/app/modules/app-register/app-register.component.ts b/webapp/src/app/modules/app-register/app-register.component.ts index d4169732..ff05c039 100644 --- a/webapp/src/app/modules/app-register/app-register.component.ts +++ b/webapp/src/app/modules/app-register/app-register.component.ts @@ -5,6 +5,7 @@ import { signal, DestroyRef, OnInit, + effect, } from '@angular/core'; import { CommonModule } from '@angular/common'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -54,7 +55,7 @@ import { InstitutionsService } from '../../api'; templateUrl: './app-register.component.html', styleUrl: './app-register.component.scss', }) -export class AppRegisterComponent implements OnDestroy, OnInit { +export class AppRegisterComponent implements OnDestroy { private readonly fb = inject(FormBuilder); protected readonly credentialService = inject(CredentialService); private readonly router = inject(Router); @@ -73,42 +74,37 @@ export class AppRegisterComponent implements OnDestroy, OnInit { showPassword = false; constructor() { + effect(() => { + if (this.credentialService.isValidating()) { + this.registerForm.disable(); + } else { + this.registerForm.enable(); + this.checkEnter(); + } + }); + this.setupInstitutionAutocomplete(); } - ngOnInit(): void { - this.subscription = this.credentialService.validating.subscribe( - (validating) => { - if (validating) { - this.registerForm.disable(); - } else { - this.registerForm.enable(); - this.checkEnter(); - } - }, - ); - if (!this.credentialService.validating) { - this.checkEnter(); - } - } + ngOnDestroy(): void { this.subscription?.unsubscribe(); } checkEnter(): void { - if (this.credentialService.isAuthenticated.value) { + if (this.credentialService.isAuthenticated()) { this.router.navigate(['/dashboard']); } } submit() { if (this.registerForm.valid) { - this.credentialService.validating.next(true); + this.credentialService.isValidating.set(true); this.registerForm.disable(); this.subscription = this.credentialService .registerAccount(this.registerForm.value) .subscribe({ next: () => { - this.credentialService.validating.next(false); + this.credentialService.isValidating.set(false); this.snackBar.open( 'Konto erfolgreich erstellt! Du kannst Dich jetzt anmelden.', 'OK', @@ -117,7 +113,7 @@ export class AppRegisterComponent implements OnDestroy, OnInit { this.router.navigate(['/login']); }, error: (err) => { - this.credentialService.validating.next(false); + this.credentialService.isValidating.set(false); this.registerForm.enable(); const message = err.error?.message || diff --git a/webapp/src/app/resolvers/accounts-page.resolver.ts b/webapp/src/app/resolvers/accounts-page.resolver.ts new file mode 100644 index 00000000..1d4be85d --- /dev/null +++ b/webapp/src/app/resolvers/accounts-page.resolver.ts @@ -0,0 +1,19 @@ +import { ResolveFn } from '@angular/router'; +import { inject } from '@angular/core'; +import { AccountPage, AuthService } from '../api'; + +export const accountsPageResolver: ResolveFn = (route, state) => { + const page = Number(route.queryParamMap.get('page') ?? '0'); + const size = Number(route.queryParamMap.get('size') ?? '10'); + const search = route.queryParamMap.get('search') || undefined; + const organizationId = + route.queryParamMap.get('organization_id') || undefined; + + return inject(AuthService).listAccounts( + page, + size, + undefined, + search, + organizationId, + ); +}; diff --git a/webapp/src/app/shared/guards/admin.guard.ts b/webapp/src/app/shared/guards/admin.guard.ts index 55e18ca8..a8876ced 100644 --- a/webapp/src/app/shared/guards/admin.guard.ts +++ b/webapp/src/app/shared/guards/admin.guard.ts @@ -1,35 +1,36 @@ -import { inject } from '@angular/core'; +import { effect, inject, Injector } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; -import { catchError, filter, of, switchMap, take } from 'rxjs'; import { CredentialService } from '../services/credential.service'; export const adminGuard: CanActivateFn = () => { const credentialService = inject(CredentialService); const router = inject(Router); + const injector = inject(Injector); - return credentialService.validating.pipe( - filter((validating) => !validating), - take(1), - switchMap(() => { - if (!credentialService.isAuthenticated.value) { - void router.navigate(['/login']); - return of(false); - } + return new Promise((resolve) => { + const ref = effect( + () => { + if (credentialService.isValidating()) { + return; + } - return credentialService.validateCurrentSession().pipe( - switchMap(() => { - if ( - !credentialService.isEffectiveSuperAdmin() && - !credentialService.isEffectiveAdmin() - ) { - void router.navigate(['/dashboard']); - return of(false); - } + ref.destroy(); - return of(true); - }), - catchError(() => of(false)), - ); - }), - ); + if (!credentialService.isAuthenticated()) { + void router.navigate(['/login']); + resolve(false); + return; + } + + if (!credentialService.isEffectiveAdmin()) { + void router.navigate(['/dashboard']); + resolve(false); + return; + } + + resolve(true); + }, + { injector }, + ); + }); }; diff --git a/webapp/src/app/shared/guards/super-admin.guard.ts b/webapp/src/app/shared/guards/super-admin.guard.ts index b1936483..993f00a5 100644 --- a/webapp/src/app/shared/guards/super-admin.guard.ts +++ b/webapp/src/app/shared/guards/super-admin.guard.ts @@ -1,31 +1,36 @@ -import { inject } from '@angular/core'; +import { effect, inject, Injector } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; -import { catchError, filter, of, switchMap, take } from 'rxjs'; import { CredentialService } from '../services/credential.service'; export const superAdminGuard: CanActivateFn = () => { const credentialService = inject(CredentialService); const router = inject(Router); + const injector = inject(Injector); - return credentialService.validating.pipe( - filter((validating) => !validating), - take(1), - switchMap(() => { - if (!credentialService.isAuthenticated.value) { - void router.navigate(['/login']); - return of(false); - } + return new Promise((resolve) => { + const ref = effect( + () => { + if (credentialService.isValidating()) { + return; + } - return credentialService.validateCurrentSession().pipe( - switchMap(() => { - if (!credentialService.isEffectiveSuperAdmin()) { - void router.navigate(['/dashboard']); - return of(false); - } - return of(true); - }), - catchError(() => of(false)), - ); - }), - ); + ref.destroy(); + + if (!credentialService.isAuthenticated()) { + void router.navigate(['/login']); + resolve(false); + return; + } + + if (!credentialService.isEffectiveSuperAdmin()) { + void router.navigate(['/dashboard']); + resolve(false); + return; + } + + resolve(true); + }, + { injector }, + ); + }); }; diff --git a/webapp/src/app/shared/guards/user.guard.ts b/webapp/src/app/shared/guards/user.guard.ts index 190780ae..7145e5ea 100644 --- a/webapp/src/app/shared/guards/user.guard.ts +++ b/webapp/src/app/shared/guards/user.guard.ts @@ -1,25 +1,30 @@ -import { inject } from '@angular/core'; +import { effect, inject, Injector } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; -import { catchError, filter, map, of, switchMap, take } from 'rxjs'; import { CredentialService } from '../services/credential.service'; export const userGuard: CanActivateFn = () => { const credentialService = inject(CredentialService); const router = inject(Router); + const injector = inject(Injector); - return credentialService.validating.pipe( - filter((validating) => !validating), - take(1), - switchMap(() => { - if (!credentialService.isAuthenticated.value) { - void router.navigate(['/login']); - return of(false); - } + return new Promise((resolve) => { + const ref = effect( + () => { + if (credentialService.isValidating()) { + return; + } - return credentialService.validateCurrentSession().pipe( - map(() => true), - catchError(() => of(false)), - ); - }), - ); + ref.destroy(); + + if (!credentialService.isAuthenticated()) { + void router.navigate(['/login']); + resolve(false); + return; + } + + resolve(true); + }, + { injector }, + ); + }); }; diff --git a/webapp/src/app/shared/interceptors/authentication.interceptor.ts b/webapp/src/app/shared/interceptors/authentication.interceptor.ts index 130e6c94..194799a2 100644 --- a/webapp/src/app/shared/interceptors/authentication.interceptor.ts +++ b/webapp/src/app/shared/interceptors/authentication.interceptor.ts @@ -1,86 +1,73 @@ -import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http'; +import { + HttpErrorResponse, + HttpInterceptorFn, + HttpRequest, +} from '@angular/common/http'; import { inject } from '@angular/core'; import { Router } from '@angular/router'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { catchError, switchMap, tap, throwError } from 'rxjs'; +import { catchError, throwError } from 'rxjs'; import { CredentialService } from '../services/credential.service'; -import { UiFocusService } from '../services/ui-focus.service'; + +const UNAUTHENTICATED_POST_ENDPOINTS = [ + '/api/auth/v2/request-otk', + '/api/auth/v2/login', + '/institutions/autocomplete', +]; + +const isUnauthenticatedPostRequest = (req: any) => { + const url = req.url.split('?')[0]; + return ( + req.method === 'POST' && + UNAUTHENTICATED_POST_ENDPOINTS.some((endpoint) => url.endsWith(endpoint)) + ); +}; export const authenticationInterceptor: HttpInterceptorFn = (req, next) => { const url = req.url.split('?')[0]; - const uiFocusService = inject(UiFocusService); - const isPublicAuthRequest = - req.method === 'POST' && - (url.endsWith('/api/auth/v2/request-otk') || - url.endsWith('/api/auth/v2/login') || - url.endsWith('/api/auth/v2/access') || - url.endsWith('/api/auth/v2/refresh')); - - if (isPublicAuthRequest || url.endsWith('/institutions/autocomplete')) { + if (isUnauthenticatedPostRequest(req)) { return next(req); } const credentialService = inject(CredentialService); const router = inject(Router); - const snackBar = inject(MatSnackBar); - const tokenProvider = credentialService.getBearerToken(); - const isLogoutRequest = url.endsWith('/api/auth/v2/logout'); - return tokenProvider.pipe( - switchMap((response) => { - if (response == undefined) { - credentialService.clearLocalAuthState(); + if (!credentialService.isActiveIdentityToken()) { + void router.navigate(['/login']); + return throwError(() => new Error('No valid identity token')); + } + const idToken = credentialService.identityToken(); + let bearerToken: string; + if (url.endsWith('/api/auth/v2/access')) { + bearerToken = idToken?.raw_token ?? ''; + } else { + if (!credentialService.isActiveAccessToken()) { + credentialService.refreshAccessToken(idToken!); + } + const accessToken = credentialService.accessToken(); + if (!accessToken) { + void router.navigate(['/login']); + return throwError(() => new Error('No valid access token')); + } + return next(attachToken(req, accessToken.raw_token)); + } + const authorizedRequest = req.clone({ + headers: req.headers.set('Authorization', 'Bearer ' + bearerToken), + }); - snackBar.open( - 'Ihre Sitzung ist abgelaufen oder wurde beendet. Bitte melden Sie sich erneut an.', - 'OK', - { duration: 7000 }, - ); - - void router.navigate(['/login']); - - return throwError( - () => new HttpErrorResponse({ status: 403, statusText: 'Forbidden' }), - ); - } - - const authorizedRequest = req.clone({ - headers: req.headers.set('Authorization', 'Bearer ' + response), - }); - - return next(authorizedRequest).pipe( - catchError((error: HttpErrorResponse) => { - if (error.status === 401 && !isLogoutRequest) { - return credentialService.handleUnauthorized().pipe( - tap((result) => { - uiFocusService.blurActiveElement(); - - if (result === 'stopped-impersonating') { - snackBar.open( - 'Die Impersonation wurde beendet, weil die Sitzung nicht mehr gültig ist.', - 'OK', - { duration: 7000 }, - ); - - void router.navigate(['/accounts']); - } else if (result === 'logged-out') { - snackBar.open( - 'Ihre Sitzung ist abgelaufen oder wurde beendet. Bitte melden Sie sich erneut an.', - 'OK', - { duration: 7000 }, - ); - - void router.navigate(['/login']); - } - }), - switchMap(() => throwError(() => error)), - ); - } - - return throwError(() => error); - }), - ); + return next(authorizedRequest).pipe( + catchError((error: HttpErrorResponse) => { + console.error('Authentication error:', error); + return throwError(() => error); }), ); }; + +const attachToken = ( + req: HttpRequest, + token: string, +): HttpRequest => { + return req.clone({ + headers: req.headers.set('Authorization', 'Bearer ' + token), + }); +}; diff --git a/webapp/src/app/shared/services/credential.service.ts b/webapp/src/app/shared/services/credential.service.ts index f276073c..e578e992 100644 --- a/webapp/src/app/shared/services/credential.service.ts +++ b/webapp/src/app/shared/services/credential.service.ts @@ -1,56 +1,50 @@ -import { Injectable, computed, inject, signal } from '@angular/core'; -import { filter, take, map, catchError, finalize } from 'rxjs/operators'; -import { - BehaviorSubject, - Observable, - of, - switchMap, - tap, - throwError, -} from 'rxjs'; +import { Injectable, computed, effect, inject, signal } from '@angular/core'; +import { toObservable, toSignal } from '@angular/core/rxjs-interop'; +import { firstValueFrom, Observable, of, switchMap, throwError } from 'rxjs'; import { AccessResponse, AccessToken, AuthService, - Configuration, IdToken, - LoginResponse, AccountProfile, + RefreshToken, + OtkResponse, } from '../../api'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Router } from '@angular/router'; -type LogoutResult = 'logged-out' | 'stopped-impersonating'; -type UnauthorizedRecoveryResult = - | 'logged-out' - | 'stopped-impersonating' - | 'already-handling'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root', }) export class CredentialService { private readonly authService = inject(AuthService); - private readonly httpClient = inject(HttpClient); - private readonly apiConfiguration = inject(Configuration, { optional: true }); - private handlingUnauthorized = false; - private static readonly KEY_GRANT = 'grant'; + private static readonly KEY_IDENTITY_TOKEN = 'identity_token'; + private static readonly KEY_REFRESH_TOKEN = 'refresh_token'; + private static readonly KEY_ACCESS_TOKEN = 'access_token'; - public readonly validating = new BehaviorSubject(false); - public readonly isAuthenticated = new BehaviorSubject(false); + public readonly isValidating = signal(false); + public readonly isAuthenticated = computed( + () => this.accessToken() !== undefined, + ); public readonly isEffectiveSuperAdmin = computed( () => this.accessToken()?.effective_role === 'SUPER_ADMIN', ); public readonly isEffectiveAdmin = computed( - () => this.accessToken()?.effective_role === 'ADMIN', + () => + this.accessToken()?.effective_role === 'ADMIN' || + this.isEffectiveSuperAdmin(), ); public readonly effectiveOrganizationId = computed( () => this.accessToken()?.effective_organization_id, ); - public readonly login = new BehaviorSubject(''); - public readonly email = new BehaviorSubject(''); - public readonly organizationName = new BehaviorSubject(''); + public readonly login = computed( + () => this.accountProfile()?.name ?? this.accountProfile()?.email ?? '', + ); + public readonly email = computed(() => this.accountProfile()?.email ?? ''); + public readonly organizationName = computed( + () => this.accountProfile()?.organization_name ?? '', + ); public readonly realAccountId = computed( () => this.accessToken()?.real_account_id ?? '', @@ -62,298 +56,247 @@ export class CredentialService { () => this.realAccountId() !== this.effectiveAccountId(), ); - private readonly identityToken = signal(undefined); - private readonly accessToken = signal(undefined); + public readonly identityToken = signal(undefined); + public readonly refreshToken = signal(undefined); + public readonly accessToken = signal(undefined); + + public readonly isActiveIdentityToken = computed(() => { + const idToken = this.identityToken(); + return ( + idToken !== undefined && + new Date(idToken.expires_at).getTime() >= Date.now() + ); + }); + + public readonly isActiveAccessToken = computed(() => { + const accessToken = this.accessToken(); + return ( + accessToken !== undefined && + new Date(accessToken.expires_at).getTime() >= Date.now() + ); + }); + + public readonly accountProfile = toSignal( + toObservable(this.isAuthenticated).pipe( + switchMap((isAuthenticated) => + isAuthenticated + ? this.authService.getCurrentAccount() + : of(undefined), + ), + ), + { initialValue: undefined }, + ); private request = 0; + loadTokensFromStorage(): void { + const idTokenData = localStorage.getItem( + CredentialService.KEY_IDENTITY_TOKEN, + ); + const refreshTokenData = localStorage.getItem( + CredentialService.KEY_REFRESH_TOKEN, + ); + const accessTokenData = localStorage.getItem( + CredentialService.KEY_ACCESS_TOKEN, + ); + + if (idTokenData) { + this.identityToken.set(JSON.parse(idTokenData) as IdToken); + } + if (refreshTokenData) { + this.refreshToken.set(JSON.parse(refreshTokenData) as RefreshToken); + } + if (accessTokenData) { + this.accessToken.set(JSON.parse(accessTokenData) as AccessToken); + } + } + + storeIdentityToken(idToken: IdToken): void { + this.identityToken.set(idToken); + localStorage.setItem( + CredentialService.KEY_IDENTITY_TOKEN, + JSON.stringify(idToken), + ); + } + + storeRefreshToken(refreshToken: RefreshToken): void { + this.refreshToken.set(refreshToken); + localStorage.setItem( + CredentialService.KEY_REFRESH_TOKEN, + JSON.stringify(refreshToken), + ); + } + + storeAccessToken(accessToken: AccessToken): void { + this.accessToken.set(accessToken); + localStorage.setItem( + CredentialService.KEY_ACCESS_TOKEN, + JSON.stringify(accessToken), + ); + } + + clearTokensFromStorage(): void { + localStorage.removeItem(CredentialService.KEY_IDENTITY_TOKEN); + localStorage.removeItem(CredentialService.KEY_REFRESH_TOKEN); + localStorage.removeItem(CredentialService.KEY_ACCESS_TOKEN); + } + constructor(private readonly router: Router) { - const data = localStorage.getItem(CredentialService.KEY_GRANT); - const id = data ? (JSON.parse(data) as AccessToken) : undefined; + this.loadTokensFromStorage(); + effect(() => { + console.log('IdToken', this.identityToken()); + console.log('RefreshToken', this.refreshToken()); + console.log('AccessToken', this.accessToken()); + }); + const id = this.identityToken(); if (id && new Date(id.expires_at).getTime() >= Date.now()) { - this.identityToken.set(id); - this.validating.next(true); + this.isValidating.set(true); setTimeout(() => this.refreshAccessToken(id), 0); } } - public validateCurrentSession(): Observable { - return this.loadCurrentProfile(); - } - - public requestOtk(email: string, password: string): Observable { - const request = ++this.request; - this.validating.next(true); - this.isAuthenticated.next(false); + public async requestOtk( + email: string, + password: string, + ): Promise { + this.isValidating.set(true); this.identityToken.set(undefined); this.accessToken.set(undefined); - return this.authService - .requestOtk({ email: email.trim().toLowerCase(), password }) - .pipe( - map((response: { account_id?: string }) => { - if (this.request !== request) { - return ''; - } + const otkResponse: OtkResponse = await firstValueFrom( + this.authService.requestOtk({ + email: email.trim().toLowerCase(), + password, + }), + ); - return response.account_id ?? ''; - }), - finalize(() => { - if (this.request === request) { - this.validating.next(false); - } - }), - ); + this.isValidating.set(false); + return otkResponse; } - public loginWithOtk( + public async loginWithOtk( accountId: string, - email: string, emailCode: string, - ): Observable { + ): Promise { const request = ++this.request; - this.validating.next(true); - this.isAuthenticated.next(false); + this.isValidating.set(true); - return this.authService - .login({ account_id: accountId, email_code: emailCode.trim() }) - .pipe( - switchMap((response: LoginResponse) => { - if (this.request != request) return of(undefined); + const loginResponse = await firstValueFrom( + this.authService.login({ + account_id: accountId, + email_code: emailCode.trim(), + }), + ); - const idToken = response.id_token; + const idToken = loginResponse.id_token; + this.identityToken.set(idToken); + this.storeIdentityToken(idToken); - this.identityToken.set(idToken); - localStorage.setItem( - CredentialService.KEY_GRANT, - JSON.stringify(idToken), - ); - return this.getAccessGrantForIdentity(idToken, request); - }), - ); + this.isValidating.set(false); + await this.getAccessToken(idToken, request); } - public refreshAccessToken(identityToken: IdToken) { + public async refreshAccessToken(identityToken: IdToken) { const request = ++this.request; - this.validating.next(true); + this.isValidating.set(true); this.accessToken.set(undefined); - this.getAccessGrantForIdentity(identityToken, request).subscribe({ - error: () => { - if (this.request != request) return; + + await this.getAccessToken(identityToken, request).catch((err) => { + if (this.request === request) { this.clearLocalAuthState(); - }, + } + throw err; }); + + this.isValidating.set(false); } - public impersonateAccount(accountId: string): Observable { + public async impersonateAccount(accountId: string): Promise { const idToken = this.identityToken(); if (!idToken) { - return throwError(() => new Error('No identity token available.')); + throw new Error('No identity token available.'); } const request = ++this.request; - this.validating.next(true); + this.isValidating.set(true); this.accessToken.set(undefined); - return this.getAccessGrantForIdentity(idToken, request, accountId).pipe( - tap({ error: () => this.validating.next(false) }), - ); + await this.getAccessToken(idToken, request, accountId).catch((err) => { + if (this.request === request) { + this.clearLocalAuthState(); + } + throw err; + }); + this.isValidating.set(false); } - public stopImpersonating(): Observable { + public async stopImpersonating(): Promise { const idToken = this.identityToken(); if (!idToken) { - return throwError(() => new Error('No identity token available.')); + throw new Error('No identity token available.'); } const request = ++this.request; - this.validating.next(true); + this.isValidating.set(true); this.accessToken.set(undefined); - return this.getAccessGrantForIdentity(idToken, request).pipe( - tap({ error: () => this.validating.next(false) }), - ); + await this.getAccessToken(idToken, request); + this.isValidating.set(false); } - public logoutAccount(): Observable { - const wasImpersonating = this.isImpersonating(); - - return this.authService - .logout('body', false, { transferCache: false }) - .pipe( - catchError((error) => { - console.error('Backend logout failed', error); - return of(null); - }), - switchMap(() => { - if (!wasImpersonating) { - this.clearLocalAuthState(); - return of('logged-out' as const); - } - - return this.stopImpersonating().pipe( - map(() => 'stopped-impersonating' as const), - catchError((error) => { - console.error('Stop impersonating after logout failed', error); - this.clearLocalAuthState(); - return of('logged-out' as const); - }), - ); - }), - ); + public async logoutAccount() { + await firstValueFrom(this.authService.logout()); + this.clearLocalAuthState(); } public clearLocalAuthState(): void { this.request += 1; - localStorage.removeItem(CredentialService.KEY_GRANT); + this.clearTokensFromStorage(); this.identityToken.set(undefined); this.accessToken.set(undefined); - this.isAuthenticated.next(false); - this.validating.next(false); - this.login.next(''); - this.email.next(''); - this.organizationName.next(''); + this.isValidating.set(false); this.router.navigate(['/login'], { replaceUrl: true }); } - public handleUnauthorized(): Observable { - if (this.handlingUnauthorized) { - return of('already-handling' as const); - } - - this.handlingUnauthorized = true; - - const isImpersonating = this.isImpersonating(); - const identityToken = this.identityToken(); - - const recovery$ = - isImpersonating && identityToken - ? this.stopImpersonating().pipe( - map(() => 'stopped-impersonating' as const), - catchError((error) => { - console.error('Failed to stop impersonation after 401', error); - this.clearLocalAuthState(); - return of('logged-out' as const); - }), - ) - : of(null).pipe( - tap(() => this.clearLocalAuthState()), - map(() => 'logged-out' as const), - ); - - return recovery$.pipe( - finalize(() => { - this.handlingUnauthorized = false; - }), - ); - } - - public changePassword( + public async changePassword( currentPassword: string, newPassword: string, - ): Observable { - return this.httpClient - .post( - `${this.apiBasePath}/api/auth/v2/change-password`, - { - current_password: currentPassword, - new_password: newPassword, - }, - { withCredentials: true }, - ) - .pipe( - tap(() => { - this.clearLocalAuthState(); - }), - map(() => undefined), - catchError((err) => { - throw err; - }), - ); + ): Promise { + this.isValidating.set(true); + await firstValueFrom( + this.authService.changePassword({ + current_password: currentPassword, + new_password: newPassword, + }), + ); + this.clearLocalAuthState(); + this.isValidating.set(false); } public registerAccount(_data: unknown): Observable { return throwError(() => new Error('Registration is temporarily disabled.')); } - //review: arman (generated fix) - public getBearerToken(): Observable { - const accessToken = this.accessToken(); - const identityToken = this.identityToken(); - - // 1. If we have a valid access token, return it immediately and complete. - if ( - accessToken && - Date.now() < new Date(accessToken.expires_at).getTime() - ) { - return of(accessToken.raw_token); - } - - // 2. If we don't have a token, and we ARE NOT currently validating, trigger a refresh. - if (!this.validating.value) { - if (!identityToken) { - return of(undefined); // No identity token to refresh with. - } - this.refreshAccessToken(identityToken); - } - - // 3. Wait for the validation to finish, then return the resulting token. - return this.validating.pipe( - filter((isValidating) => !isValidating), // Wait until validating becomes false - take(1), // Take exactly 1 emission and then automatically complete() - map(() => this.accessToken()?.raw_token), - ); - } - - private getAccessGrantForIdentity( + private async getAccessToken( idToken: IdToken, request: number, effectiveAccountId?: string, - ): Observable { + ): Promise { + if (this.request !== request) { + return; + } + const realAccountId = idToken.real_account_id; - const headers = new HttpHeaders({ - Authorization: `Bearer ${idToken.raw_token}`, - }); - const payload = { - real_account_id: realAccountId, - effective_account_id: effectiveAccountId ?? realAccountId, - }; - return this.httpClient - .post(`${this.apiBasePath}/api/auth/v2/access`, payload, { - headers, - withCredentials: true, - }) - .pipe( - tap((result: AccessResponse) => { - if (this.request != request) return; + const result: AccessResponse = await firstValueFrom( + this.authService.getAccessToken({ + real_account_id: realAccountId, + effective_account_id: effectiveAccountId ?? realAccountId, + }), + ); - const accessToken = result.access_token; - - this.accessToken.set(accessToken); - this.isAuthenticated.next(true); - this.validating.next(false); - }), - map(() => undefined), - ); - } - - private get apiBasePath(): string { - return this.apiConfiguration?.basePath ?? ''; - } - - private loadCurrentProfile(): Observable { - return this.httpClient - .get(`${this.apiBasePath}/api/accounts/me`, { - withCredentials: true, - }) - .pipe( - tap((profile) => { - this.login.next(profile.name ?? profile.email ?? ''); - this.email.next(profile.email ?? ''); - this.organizationName.next(profile.organization_name ?? ''); - }), - map(() => undefined), - ); + this.accessToken.set(result.access_token); + this.refreshToken.set(result.refresh_token); + this.isValidating.set(false); } } diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index f4ae841c..7be187a0 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -3,7 +3,7 @@ - @if (credentialService.isAuthenticated | async) { + @if (credentialService.isAuthenticated()) { } - @if (credentialService.isAuthenticated | async) { + @if (credentialService.isAuthenticated()) { @if (credentialService.isImpersonating()) {
switch_account diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts index 127f842d..bee7ed7c 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts @@ -102,22 +102,21 @@ export class AppLayoutComponent implements OnInit, OnDestroy { this.mediaQuery.removeEventListener('change', this.mediaQueryListener); } - logout() { - this.credentialService.logoutAccount().subscribe({ - next: (result) => { - if (result === 'stopped-impersonating') { - this.router.navigate(['/accounts']); - } else { - this.router.navigate(['/login']); - } - }, - }); + async logout() { + const isImpersonating = this.credentialService.isImpersonating(); + + await this.credentialService.stopImpersonating(); + + if (isImpersonating) { + this.router.navigate(['/accounts']); + } else { + this.router.navigate(['/login']); + } } - stopImpersonating(): void { - this.credentialService.stopImpersonating().subscribe({ - next: () => this.router.navigate(['/accounts']), - }); + async stopImpersonating(): Promise { + await this.credentialService.stopImpersonating(); + this.router.navigate(['/accounts']); } navigateBack() { diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index b80e7271..a917f40b 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -101,13 +101,13 @@ } @else { @@ -115,13 +115,11 @@ diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index 96f2bd12..8d2bea96 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -68,7 +68,7 @@ export class AppMenuComponent { icon: 'groups', route: '/persons', queryParams: { - institutionName: this.credentialService.organizationName.value, + institutionName: this.credentialService.organizationName(), }, disabled: false, }, @@ -166,14 +166,8 @@ export class AppMenuComponent { }); dialogRef.componentInstance.confirmDelete.subscribe(() => { - this.credentialService.logoutAccount().subscribe({ - next: (result) => { - if (result === 'stopped-impersonating') { - this.router.navigate(['/accounts']); - } else { - this.router.navigate(['/login']); - } - }, + this.credentialService.logoutAccount().then(() => { + this.router.navigate(['/login']); }); }); } From 7b4c459fd89f8bb6be249f3bc8f775bc55b452a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 3 Jul 2026 17:00:19 +0200 Subject: [PATCH 59/92] fix(frontend/register): fixed wrong variable name --- .../src/app/modules/app-register/app-register.component.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/src/app/modules/app-register/app-register.component.html b/webapp/src/app/modules/app-register/app-register.component.html index e6349bc5..a9e758c6 100644 --- a/webapp/src/app/modules/app-register/app-register.component.html +++ b/webapp/src/app/modules/app-register/app-register.component.html @@ -84,9 +84,7 @@ mat-raised-button class="button" (click)="submit()" - [disabled]=" - !registerForm.valid || (credentialService.validating | async) - "> + [disabled]="!registerForm.valid || credentialService.isValidating()"> Registrieren From 0ea7713f05b5c6ec8bca11310708310e41278180 Mon Sep 17 00:00:00 2001 From: Farajollahi Date: Fri, 3 Jul 2026 19:14:41 +0200 Subject: [PATCH 60/92] implement active accounts --- .../src/main/inse/account_management/model.py | 2 + .../main/inse/account_management/service.py | 22 ++- .../inse/account_management/test_service.py | 180 ++++++++++++++++++ service/src/main/inse/auth/model.py | 6 + service/src/main/inse/auth/service.py | 44 ++++- .../src/main/inse/auth/test_auth_service.py | 29 +++ service/src/main/inse/database.py | 10 + .../inse/organization_management/service.py | 20 ++ .../organization_management/test_service.py | 60 ++++++ webapp/src/app/api/model/accountProfile.ts | 2 +- .../src/app/api/model/updateAccountRequest.ts | 2 +- webapp/src/app/app.routes.ts | 4 +- .../modules/accounts/accounts.component.html | 117 +++++++++--- .../modules/accounts/accounts.component.scss | 10 + .../modules/accounts/accounts.component.ts | 72 ++++++- .../modules/app-login/app-login.component.ts | 2 +- .../app/shared/guards/account-viewer.guard.ts | 36 ++++ .../services/account-management.service.ts | 2 + .../app/shared/services/credential.service.ts | 3 + .../ui/app-menu/app-menu.component.html | 6 +- .../shared/ui/app-menu/app-menu.component.ts | 14 +- 21 files changed, 594 insertions(+), 49 deletions(-) create mode 100644 service/src/main/inse/account_management/test_service.py create mode 100644 webapp/src/app/shared/guards/account-viewer.guard.ts diff --git a/service/src/main/inse/account_management/model.py b/service/src/main/inse/account_management/model.py index 2bb7613d..8b21edf7 100644 --- a/service/src/main/inse/account_management/model.py +++ b/service/src/main/inse/account_management/model.py @@ -20,6 +20,7 @@ class AccountProfile(BaseModel): organization_id: uuid.UUID organization_name: str deleted: bool + activated: bool is_current: bool = False is_real_account: bool = False is_impersonating: bool = False @@ -49,3 +50,4 @@ class UpdateAccountRequest(BaseModel): password: Optional[str] = Field(default=None, min_length=8) openalex_person_id: Optional[str] = None deleted: Optional[bool] = None + activated: Optional[bool] = None diff --git a/service/src/main/inse/account_management/service.py b/service/src/main/inse/account_management/service.py index 5ef45372..9e0362ad 100644 --- a/service/src/main/inse/account_management/service.py +++ b/service/src/main/inse/account_management/service.py @@ -38,6 +38,7 @@ def _account_to_profile(account: Account, token: AccessToken) -> AccountProfile: organization_id=account.organization_id, organization_name=organization_name, deleted=account.deleted, + activated=account.activated, is_current=account.id == token.effective_account_id, is_real_account=account.id == token.real_account_id, is_impersonating=token.is_impersonating(), @@ -108,17 +109,21 @@ def list_accounts( search: Optional[str] = None, organization_id: Optional[uuid.UUID] = None, ) -> AccountPage: - if not _is_admin(access_token.effective_role): + if access_token.effective_role not in { + UserRole.SUPER_ADMIN, + UserRole.ADMIN, + UserRole.MANAGER, + }: raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, - detail="Only admins can list accounts.", + detail="Only managers and admins can list accounts.", ) statement = select(Account) count_statement = select(func.count()).select_from(Account) filters = [] - if access_token.effective_role == UserRole.ADMIN: + if access_token.effective_role in {UserRole.ADMIN, UserRole.MANAGER}: filters.append(Account.organization_id == access_token.effective_organization_id) elif organization_id is not None: filters.append(Account.organization_id == organization_id) @@ -207,7 +212,7 @@ def list_organizations( if access_token.effective_role == UserRole.SUPER_ADMIN: organizations = session.exec( select(Organization) - .where(Organization.deleted == False) # noqa: E712 + .where(Organization.deleted.is_not(True)) .order_by(Organization.name) ).all() elif access_token.effective_role == UserRole.ADMIN: @@ -285,6 +290,15 @@ def update_account( account.deleted = payload.deleted account.epoch += 1 + if payload.activated is not None and payload.activated != account.activated: + if access_token.effective_role != UserRole.SUPER_ADMIN or is_self_update: + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail="Only super admins can activate or deactivate other accounts.", + ) + account.activated = payload.activated + account.epoch += 1 + session.add(account) session.commit() session.refresh(account) diff --git a/service/src/main/inse/account_management/test_service.py b/service/src/main/inse/account_management/test_service.py new file mode 100644 index 00000000..b6d43714 --- /dev/null +++ b/service/src/main/inse/account_management/test_service.py @@ -0,0 +1,180 @@ +from types import SimpleNamespace + +import pytest +from fastapi import HTTPException +from sqlmodel import Session, SQLModel, create_engine + +from inse.account_management import service +from inse.account_management.model import UpdateAccountRequest +from inse.auth.model import Account, Organization, UserRole + + +@pytest.fixture() +def session(): + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) + SQLModel.metadata.create_all(engine) + with Session(engine) as database_session: + yield database_session + + +def access_token(role, account_id, organization_id): + return SimpleNamespace( + effective_role=role, + effective_account_id=account_id, + real_account_id=account_id, + effective_organization_id=organization_id, + is_impersonating=lambda: False, + ) + + +def create_accounts(session): + organization = Organization(name="Test organization") + session.add(organization) + session.flush() + superadmin = Account( + email="superadmin@example.org", + name="Superadmin", + password_hash="hash", + organization_id=organization.id, + role=UserRole.SUPER_ADMIN, + ) + user = Account( + email="user@example.org", + name="User", + password_hash="hash", + organization_id=organization.id, + ) + session.add(superadmin) + session.add(user) + session.commit() + return organization, superadmin, user + + +def test_accounts_are_activated_by_default(session): + _, _, user = create_accounts(session) + assert user.activated is True + + +def test_superadmin_can_deactivate_and_reactivate_account(session): + organization, superadmin, user = create_accounts(session) + token = access_token(UserRole.SUPER_ADMIN, superadmin.id, organization.id) + + profile = service.update_account( + session, token, user.id, UpdateAccountRequest(activated=False) + ) + assert profile.activated is False + assert user.epoch == 1 + + profile = service.update_account( + session, token, user.id, UpdateAccountRequest(activated=True) + ) + assert profile.activated is True + assert user.epoch == 2 + + +def test_non_superadmin_cannot_change_activation(session): + organization, superadmin, user = create_accounts(session) + admin = Account( + email="admin@example.org", + name="Admin", + password_hash="hash", + organization_id=organization.id, + role=UserRole.ADMIN, + ) + session.add(admin) + session.commit() + + with pytest.raises(HTTPException) as error: + service.update_account( + session, + access_token(UserRole.ADMIN, admin.id, organization.id), + user.id, + UpdateAccountRequest(activated=False), + ) + + assert error.value.status_code == 403 + assert user.activated is True + + +def test_superadmin_cannot_deactivate_own_account(session): + organization, superadmin, _ = create_accounts(session) + + with pytest.raises(HTTPException) as error: + service.update_account( + session, + access_token(UserRole.SUPER_ADMIN, superadmin.id, organization.id), + superadmin.id, + UpdateAccountRequest(activated=False), + ) + + assert error.value.status_code == 403 + assert superadmin.activated is True + + +def test_manager_only_lists_accounts_from_own_organization(session): + organization, superadmin, user = create_accounts(session) + manager = Account( + email="manager@example.org", + name="Manager", + password_hash="hash", + organization_id=organization.id, + role=UserRole.MANAGER, + ) + other_organization = Organization(name="Other organization") + session.add(other_organization) + session.flush() + other_user = Account( + email="other@example.org", + name="Other User", + password_hash="hash", + organization_id=other_organization.id, + ) + session.add(manager) + session.add(other_user) + session.commit() + + result = service.list_accounts( + session, + access_token(UserRole.MANAGER, manager.id, organization.id), + page=0, + page_size=25, + organization_id=other_organization.id, + ) + + assert {profile.id for profile in result.items} == { + account.id for account in [superadmin, user, manager] + } + assert other_user.id not in {profile.id for profile in result.items} + + +def test_user_cannot_list_accounts(session): + organization, _, user = create_accounts(session) + + with pytest.raises(HTTPException) as error: + service.list_accounts( + session, + access_token(UserRole.USER, user.id, organization.id), + page=0, + page_size=25, + ) + + assert error.value.status_code == 403 + + +def test_superadmin_lists_all_active_organizations_for_selectbox(session): + first = Organization(name="Alpha") + second = Organization(name="Beta") + deleted = Organization(name="Deleted", deleted=True) + session.add(first) + session.add(second) + session.add(deleted) + session.commit() + + organizations = service.list_organizations( + session, + access_token(UserRole.SUPER_ADMIN, first.id, first.id), + ) + + assert [organization.name for organization in organizations] == ["Alpha", "Beta"] diff --git a/service/src/main/inse/auth/model.py b/service/src/main/inse/auth/model.py index a79aa113..bd519058 100644 --- a/service/src/main/inse/auth/model.py +++ b/service/src/main/inse/auth/model.py @@ -77,6 +77,12 @@ class Account(Durable, table=True): nullable=False, description="The epoch value for the account. Used for versioning of tokens.", ) + activated: bool = Field( + default=True, + nullable=False, + index=True, + description="Indicates whether the account is allowed to authenticate.", + ) password_hash: str = Field( index=False, nullable=False, diff --git a/service/src/main/inse/auth/service.py b/service/src/main/inse/auth/service.py index 3c24086e..9fd1f385 100644 --- a/service/src/main/inse/auth/service.py +++ b/service/src/main/inse/auth/service.py @@ -180,7 +180,11 @@ def request_otk(session: Session, email: str, password: str): logger.debug("OTK request for email %s: account found: %s", email, account) - if account is None or account.deleted or account.id is None: + if ( + account is None + or account.deleted + or account.id is None + ): logger.warning("OTK request failed for email %s: account not found", email) raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, @@ -196,6 +200,13 @@ def request_otk(session: Session, email: str, password: str): detail="Invalid email or password", ) + if not account.activated: + logger.warning("OTK request rejected for deactivated account %s", account.id) + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail="Account is deactivated and cannot log in.", + ) + otk_code = f"{secrets.randbelow(1_000_000):06d}" print(otk_code) @@ -300,7 +311,7 @@ def login( ) account = _get_active_account(session, account_id) - if not account or account.deleted or account.id is None: + if not account or account.deleted or not account.activated or account.id is None: logger.warning("Login failed: account is not active %s", account_id) raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, @@ -469,7 +480,12 @@ def _get_account_epoch( """ account = session.get(Account, account_id) - if account is None or account.deleted or account.id is None: + if ( + account is None + or account.deleted + or not account.activated + or account.id is None + ): raise AccountNotFoundException return account.epoch @@ -487,7 +503,7 @@ def _get_account_role(session: Session, account_id: uuid.UUID) -> UserRole: """ account = session.get(Account, account_id) - if not account or account.deleted or account.id is None: + if not account or account.deleted or not account.activated or account.id is None: raise AccountNotFoundException return account.role @@ -505,7 +521,7 @@ def _get_account_organization(session: Session, account_id: uuid.UUID) -> uuid.U """ account = session.get(Account, account_id) - if not account or account.deleted or account.id is None: + if not account or account.deleted or not account.activated or account.id is None: raise AccountNotFoundException return account.organization_id @@ -525,12 +541,18 @@ def _is_valid_impersonation( bool: True if impersonation is allowed, False otherwise. """ real_account = session.get(Account, real_account_id) - if not real_account or real_account.deleted or real_account.id is None: + if ( + not real_account + or real_account.deleted + or not real_account.activated + or real_account.id is None + ): raise AccountNotFoundException effective_account = session.get(Account, effective_account_id) if ( not effective_account or effective_account.deleted + or not effective_account.activated or effective_account.id is None ): raise AccountNotFoundException @@ -980,6 +1002,9 @@ def _verify_fp_token( account_id=epoch_account_id, ) + if uuid.UUID(real_account_id) != epoch_account_id: + _get_active_account(session, uuid.UUID(real_account_id)) + token_epoch = payload.get(EPOCH_KEY) if token_epoch is None or token_epoch != current_account_epoch: raise HTTPException( @@ -1016,7 +1041,12 @@ def _get_active_account(session: Session, account_id: uuid.UUID) -> Account: """ account = session.get(Account, account_id) - if account is None or account.deleted or account.id is None: + if ( + account is None + or account.deleted + or not account.activated + or account.id is None + ): raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, detail="Account is not active.", diff --git a/service/src/main/inse/auth/test_auth_service.py b/service/src/main/inse/auth/test_auth_service.py index 7db19bb4..0e61130c 100644 --- a/service/src/main/inse/auth/test_auth_service.py +++ b/service/src/main/inse/auth/test_auth_service.py @@ -210,6 +210,35 @@ def test_request_otk_invalid_credentials(in_memory_session, settings_backup): auth_service.request_otk(in_memory_session, email, "wrongpw") +def test_deactivated_account_cannot_request_otk(in_memory_session): + email = "inactive@example.com" + password = "rightpw" + _, account = create_org_and_account(in_memory_session, email, password) + account.activated = False + in_memory_session.add(account) + in_memory_session.commit() + + with pytest.raises(HTTPException) as error: + auth_service.request_otk(in_memory_session, email, password) + + assert error.value.status_code == 403 + assert error.value.detail == "Account is deactivated and cannot log in." + + +def test_deactivated_account_is_rejected_by_active_account_lookup(in_memory_session): + _, account = create_org_and_account( + in_memory_session, "inactive-lookup@example.com", "password" + ) + account.activated = False + in_memory_session.add(account) + in_memory_session.commit() + + with pytest.raises(HTTPException) as error: + auth_service._get_active_account(in_memory_session, account.id) + + assert error.value.status_code == 403 + + def test_login_with_expired_secret(in_memory_session, settings_backup): config_module.settings.token_hmac_key = "expired-key" config_module.settings.token_issuer_id = "expired-issuer" diff --git a/service/src/main/inse/database.py b/service/src/main/inse/database.py index 728b750f..39a7c24b 100644 --- a/service/src/main/inse/database.py +++ b/service/src/main/inse/database.py @@ -1,6 +1,7 @@ from typing import Annotated from fastapi import Depends +from sqlalchemy import inspect, text from sqlmodel import SQLModel, Session, create_engine from inse import config @@ -18,6 +19,15 @@ engine = create_engine( def create_db_and_tables(): """Creates the database and tables based on the SQLModel metadata.""" SQLModel.metadata.create_all(engine) + columns = {column["name"] for column in inspect(engine).get_columns("account")} + if "activated" not in columns: + with engine.begin() as connection: + connection.execute( + text( + "ALTER TABLE account ADD COLUMN activated " + "BOOLEAN NOT NULL DEFAULT TRUE" + ) + ) def get_session(): diff --git a/service/src/main/inse/organization_management/service.py b/service/src/main/inse/organization_management/service.py index 56d97db2..80dd88c9 100644 --- a/service/src/main/inse/organization_management/service.py +++ b/service/src/main/inse/organization_management/service.py @@ -73,6 +73,7 @@ def _member_counts( .where( Account.organization_id.in_(organization_ids), Account.deleted == False, # noqa: E712 + Account.activated == True, # noqa: E712 ) .group_by(Account.organization_id) ).all() @@ -91,6 +92,21 @@ def _to_profile( ) +def _deactivate_organization_accounts( + session: Session, organization_id: uuid.UUID +) -> None: + accounts = session.exec( + select(Account).where( + Account.organization_id == organization_id, + Account.activated == True, # noqa: E712 + ) + ).all() + for account in accounts: + account.activated = False + account.epoch += 1 + session.add(account) + + def get_organizations( session: Session, access_token: AccessToken, @@ -162,6 +178,8 @@ def update_organization( if payload.other_inst_id is not None: organization.openalex_institution_id = payload.other_inst_id.strip() or None if payload.deleted is not None: + if payload.deleted and not organization.deleted: + _deactivate_organization_accounts(session, organization.id) organization.deleted = payload.deleted session.add(organization) @@ -178,6 +196,8 @@ def delete_organization( ) -> None: _require_super_admin(access_token) organization = _get_organization_or_404(session, organization_id) + if not organization.deleted: + _deactivate_organization_accounts(session, organization.id) organization.deleted = True session.add(organization) session.commit() diff --git a/service/src/main/inse/organization_management/test_service.py b/service/src/main/inse/organization_management/test_service.py index ce3b3e03..a7ce6ff6 100644 --- a/service/src/main/inse/organization_management/test_service.py +++ b/service/src/main/inse/organization_management/test_service.py @@ -105,6 +105,66 @@ def test_superadmin_can_create_update_and_soft_delete(session): assert session.get(Organization, created.id).deleted is True +def test_deleting_organization_deactivates_all_its_accounts(session): + organization = Organization(name="Organization to delete") + session.add(organization) + session.flush() + active_account = Account( + email="active-delete@example.org", + name="Active", + password_hash="hash", + organization_id=organization.id, + epoch=3, + ) + inactive_account = Account( + email="inactive-delete@example.org", + name="Inactive", + password_hash="hash", + organization_id=organization.id, + activated=False, + epoch=5, + ) + session.add(active_account) + session.add(inactive_account) + session.commit() + + service.delete_organization( + session, token(UserRole.SUPER_ADMIN, organization.id), organization.id + ) + + session.refresh(active_account) + session.refresh(inactive_account) + assert active_account.activated is False + assert active_account.epoch == 4 + assert inactive_account.activated is False + assert inactive_account.epoch == 5 + + +def test_marking_organization_deleted_deactivates_its_accounts(session): + organization = Organization(name="Organization to update") + session.add(organization) + session.flush() + account = Account( + email="active-update@example.org", + name="Active", + password_hash="hash", + organization_id=organization.id, + ) + session.add(account) + session.commit() + + service.update_organization( + session, + token(UserRole.SUPER_ADMIN, organization.id), + organization.id, + UpdateOrganizationRequest(deleted=True), + ) + + session.refresh(account) + assert account.activated is False + assert account.epoch == 1 + + @pytest.mark.parametrize("role", [UserRole.ADMIN, UserRole.MANAGER, UserRole.USER]) def test_only_superadmin_can_create_organizations(session, role): organization = Organization(name="Scope") diff --git a/webapp/src/app/api/model/accountProfile.ts b/webapp/src/app/api/model/accountProfile.ts index 17a68e22..52a9f7e6 100644 --- a/webapp/src/app/api/model/accountProfile.ts +++ b/webapp/src/app/api/model/accountProfile.ts @@ -18,6 +18,7 @@ export interface AccountProfile { organization_id: string; organization_name: string; deleted: boolean; + activated: boolean; is_current?: boolean; is_real_account?: boolean; is_impersonating?: boolean; @@ -25,4 +26,3 @@ export interface AccountProfile { export namespace AccountProfile { } - diff --git a/webapp/src/app/api/model/updateAccountRequest.ts b/webapp/src/app/api/model/updateAccountRequest.ts index 15b0043d..1d4389f7 100644 --- a/webapp/src/app/api/model/updateAccountRequest.ts +++ b/webapp/src/app/api/model/updateAccountRequest.ts @@ -18,8 +18,8 @@ export interface UpdateAccountRequest { password?: string | null; openalex_person_id?: string | null; deleted?: boolean | null; + activated?: boolean | null; } export namespace UpdateAccountRequest { } - diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index efc1388d..2ec739ff 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -1,6 +1,5 @@ import { Routes } from '@angular/router'; import { userGuard } from './shared/guards/user.guard'; -import { adminGuard } from './shared/guards/admin.guard'; import { superAdminGuard } from './shared/guards/super-admin.guard'; import { collaborationNetworkResolver } from './resolvers/collaboration-network.resolver'; import { personListResolver } from './resolvers/person-list.resolver'; @@ -21,6 +20,7 @@ import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu- import { euSingleProjectResolver } from './resolvers/eu-single-project-resolver'; import { publicationResolver } from './resolvers/publication-resolver'; import { accountResolver } from './resolvers/account.resolver'; +import { accountViewerGuard } from './shared/guards/account-viewer.guard'; export const routes: Routes = [ { @@ -102,7 +102,7 @@ export const routes: Routes = [ }, { path: 'accounts', - canActivate: [adminGuard], + canActivate: [accountViewerGuard], loadComponent: () => import('./modules/accounts/accounts.component').then( (mod) => mod.AccountsComponent, diff --git a/webapp/src/app/modules/accounts/accounts.component.html b/webapp/src/app/modules/accounts/accounts.component.html index 6a5fdb83..5f2ac458 100644 --- a/webapp/src/app/modules/accounts/accounts.component.html +++ b/webapp/src/app/modules/accounts/accounts.component.html @@ -2,16 +2,25 @@
@@ -35,11 +44,19 @@ }
- -
@@ -62,19 +79,28 @@ Organisation Rolle Status - Aktionen + @if (!isReadOnly) { + Aktionen + } @for (account of accounts; track account.id) { - + - + } @else { + + } {{ account.email }} {{ account.organization_name }} @@ -82,16 +108,29 @@ {{ account.role | role }} - - {{ account.deleted ? 'deleted' : 'active' }} + + {{ + account.deleted + ? 'deleted' + : account.activated + ? 'active' + : 'inactive' + }} - -
+ @if (!isReadOnly) { + +
@@ -99,24 +138,48 @@ mat-icon-button type="button" aria-label="Impersonate" + matTooltip="Als dieser Account anmelden" [disabled]="!canImpersonate(account)" (click)="impersonate(account)"> switch_account + @if (credentialService.isEffectiveSuperAdmin()) { + + } -
- +
+ + } } @empty { - Keine Accounts gefunden. + + Keine Accounts gefunden. + } @@ -127,6 +190,7 @@ +
+ } + @for (r of comparisonRegions(); track r.id) { +
+ 🌍 {{ r.name }} + +
+ } + } @else { +
+ No regions/countries selected. Search to add. +
+ } +
+ + + +
+ + +
+

4. Compare Institutions

+ + @if (primaryInstitutionName()) { +
+ Assigned: + {{ primaryInstitutionName() }} +
+ } + +
+ @if (comparisonInstitutions().length > 0) { + @for (inst of comparisonInstitutions(); track inst.id) { +
+ 🏫 {{ inst.name }} + +
+ } + } @else { +
+ No additional institutions selected. Search to add. +
+ } +
+ + +
+ + +
+

Suggested Top Institutions

+
+ @if (isSuggestionsLoading()) { +
Loading suggestions...
+ } @else { + @for (item of topSuggestions(); track item.id || '') { + + } + } +
+
+ + +
+ +
+ + + +
+
+ Visualization Scale: +
+ + +
+
+ +
+ @if (isTrendLoading()) { +
+
+

Retrieving trend data from works index...

+
+ } + @if (selectedTrendTopics().length > 1) { +
+ @for (topic of selectedTrendTopics(); track topic) { + + } +
+ } + +
+
+ diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss new file mode 100644 index 00000000..7e2eda37 --- /dev/null +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss @@ -0,0 +1,449 @@ +.trend-layout { + display: grid; + grid-template-columns: 300px 1fr; + gap: 1.5rem; + margin-top: 1.5rem; + font-family: 'Inter', sans-serif; + + @media (max-width: 1024px) { + grid-template-columns: 1fr; + } +} + +.trend-sidebar { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.control-card { + background: white; + border-radius: 10px; + padding: 1.25rem; + border: 1px solid #e5e7eb; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); + + h3 { + font-size: 0.8rem; + font-weight: 600; + text-transform: uppercase; + color: #6b7280; + margin: 0 0 0.75rem 0; + letter-spacing: 0.05em; + } + + &.suggestions-card { + background: #fafafa; + } +} + +.checkbox-group { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.checkbox-label { + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 0.875rem; + color: #374151; + cursor: pointer; + + input[type='checkbox'] { + accent-color: #3b82f6; + width: 15px; + height: 15px; + cursor: pointer; + } +} + +.comparison-list { + display: flex; + flex-direction: column; + gap: 0.4rem; + max-height: 140px; + overflow-y: auto; + margin-bottom: 0.75rem; + + .empty-list-info { + font-size: 0.75rem; + color: #9ca3af; + text-align: center; + padding: 8px 0; + border: 1px dashed #e5e7eb; + border-radius: 5px; + } +} + +.comparison-item { + display: flex; + justify-content: space-between; + align-items: center; + background: #f3f4f6; + border: 1px solid #e5e7eb; + border-radius: 5px; + padding: 0.3rem 0.5rem; + + .item-name { + font-size: 0.75rem; + color: #374151; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 210px; + } + + .remove-btn { + background: none; + border: none; + color: #9ca3af; + cursor: pointer; + font-size: 0.7rem; + padding: 1px 4px; + border-radius: 3px; + &:hover { + color: #ef4444; + background: #fee2e2; + } + } + + &.location-item { + &.font-country { + background: #f0fdf4 !important; + border-color: #bbf7d0 !important; + .item-name { + color: #166534 !important; + } + } + &.font-region { + background: #eff6ff !important; + border-color: #bfdbfe !important; + .item-name { + color: #1e40af !important; + } + } + } +} + +.autocomplete-search { + position: relative; + width: 100%; + + input { + width: 100%; + padding: 0.5rem; + border-radius: 5px; + border: 1px solid #d1d5db; + font-size: 0.8125rem; + outline: none; + box-sizing: border-box; + &:focus { + border-color: #3b82f6; + } + } +} + +.autocomplete-results { + position: absolute; + top: 100%; + left: 0; + right: 0; + z-index: 50; + background: white; + border: 1px solid #e5e7eb; + border-radius: 5px; + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); + margin-top: 3px; + padding: 0; + list-style: none; + max-height: 180px; + overflow-y: auto; + + li button { + width: 100%; + text-align: left; + background: none; + border: none; + padding: 0.5rem 0.75rem; + cursor: pointer; + display: flex; + flex-direction: column; + &:hover { + background: #f3f4f6; + } + + .name { + font-size: 0.75rem; + font-weight: 500; + color: #1f2937; + } + .hint { + font-size: 0.65rem; + color: #9ca3af; + margin-top: 1px; + } + } +} + +.suggestions-list { + display: flex; + flex-direction: column; + gap: 0.4rem; + + .suggestions-loader { + font-size: 0.75rem; + color: #9ca3af; + text-align: center; + padding: 8px 0; + } +} + +.suggestion-item { + display: flex; + justify-content: space-between; + align-items: center; + background: white; + border: 1px solid #e5e7eb; + border-radius: 6px; + padding: 0.4rem 0.6rem; + text-align: left; + cursor: pointer; + + &:hover:not([disabled]) { + border-color: #3b82f6; + background: #f0f9ff; + transform: translateY(-1px); + } + + &[disabled] { + opacity: 0.5; + cursor: not-allowed; + background: #f3f4f6; + } + + .info { + display: flex; + flex-direction: column; + max-width: 210px; + + .name { + font-size: 0.75rem; + color: #374151; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + .meta { + font-size: 0.65rem; + color: #9ca3af; + margin-top: 1px; + } + } + .add-icon { + font-size: 1rem; + color: #3b82f6; + font-weight: 600; + } +} + +.trend-main { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.trend-toggles-bar { + display: flex; + justify-content: space-between; + align-items: center; + background: white; + border-radius: 10px; + padding: 0.6rem 1rem; + border: 1px solid #e5e7eb; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + + .toggle-label { + font-size: 0.8125rem; + font-weight: 500; + color: #4b5563; + } +} + +.toggle-buttons { + display: flex; + background: #f3f4f6; + border-radius: 6px; + padding: 2px; + + button { + padding: 0.4rem 0.8rem; + border: none; + background: none; + font-size: 0.75rem; + font-weight: 500; + color: #4b5563; + border-radius: 5px; + cursor: pointer; + + &:hover:not(.active) { + color: #111827; + background: rgba(255, 255, 255, 0.5); + } + &.active { + background: white; + color: #3b82f6; + font-weight: 600; + } + } +} + +.chart-holder-card { + position: relative; + background: white; + border-radius: 10px; + border: 1px solid #e5e7eb; + overflow: hidden; + min-height: 400px; +} + +.chart-topic-tabs { + display: flex; + gap: 0.4rem; + padding: 0.6rem 1rem; + background: #f9fafb; + border-bottom: 1px solid #e5e7eb; + + button { + padding: 0.3rem 0.6rem; + border: 1px solid #e5e7eb; + background: white; + color: #4b5563; + border-radius: 5px; + font-size: 0.75rem; + font-weight: 500; + cursor: pointer; + transition: all 0.15s ease; + + &:hover { + border-color: #3b82f6; + color: #3b82f6; + background: #f0f9ff; + } + + &.active { + background: #3b82f6; + border-color: #3b82f6; + color: white; + font-weight: 600; + } + } +} + +.loader-overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.8); + z-index: 10; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + + .spinner { + width: 32px; + height: 32px; + border: 3px solid rgba(59, 130, 246, 0.1); + border-radius: 50%; + border-top-color: #3b82f6; + animation: spin 0.8s linear infinite; + margin-bottom: 8px; + } + + p { + font-size: 0.8125rem; + color: #4b5563; + margin: 0; + } +} + +.search-trend-btn-container { + display: flex; + justify-content: flex-end; + padding: 0.5rem 0; +} + +.search-trend-btn { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.6rem 1.2rem; + border-radius: 6px; + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + border: 1px solid #3b82f6; + background-color: #3b82f6; + color: white; + transition: all 0.2s ease; + + &:hover:not([disabled]) { + background-color: #2563eb; + border-color: #2563eb; + box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2); + } + + &[disabled] { + opacity: 0.6; + cursor: not-allowed; + background-color: #9ca3af; + border-color: #9ca3af; + } + + &.dirty { + animation: pulse-border 2s infinite; + background-color: #2563eb; + border-color: #1d4ed8; + } +} + +.year-selectors { + display: flex; + gap: 0.5rem; + align-items: center; + + select { + flex: 1; + padding: 0.4rem; + border-radius: 5px; + border: 1px solid #d1d5db; + font-size: 0.8125rem; + background: white; + outline: none; + &:focus { + border-color: #3b82f6; + } + } +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +@keyframes pulse-border { + 0% { + box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); + } + 70% { + box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); + } + 100% { + box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); + } +} diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.spec.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.spec.ts new file mode 100644 index 00000000..b8b1b660 --- /dev/null +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UniTrendParentComponent } from './uni-trend-parent.component'; + +describe('UniTrendParentComponent', () => { + let component: UniTrendParentComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [UniTrendParentComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(UniTrendParentComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts new file mode 100644 index 00000000..94ac41df --- /dev/null +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -0,0 +1,470 @@ +import { + Component, + ChangeDetectionStrategy, + input, + computed, + signal, + effect, + inject, + OnInit, +} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { UniTrendChartComponent } from '../uni-trend-chart/uni-trend-chart.component'; +import { UniversityRankingsService } from '../../../api/api/university-rankings.service'; +import { InstitutionsService } from '../../../api/api/institutions.service'; +import { + TrendResponse, + TopInstitutionItem, + AutocompleteLocationItem, + AutocompleteResponse, +} from '../../../api'; + +@Component({ + selector: 'app-uni-trend-parent', + standalone: true, + imports: [CommonModule, FormsModule, UniTrendChartComponent], + templateUrl: './uni-trend-parent.component.html', + styleUrl: './uni-trend-parent.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class UniTrendParentComponent implements OnInit { + private readonly apiService = inject(UniversityRankingsService); + private readonly institutionsApiService = inject(InstitutionsService); + private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); + + // Input containing extracted/selected keywords from parent + readonly keywords = input([]); + + // Trend settings signals + readonly selectedTrendTopics = signal([]); + readonly primaryInstitution = signal(null); + readonly primaryInstitutionName = signal( + 'University of Duisburg-Essen', + ); + readonly comparisonInstitutions = signal<{ id: string; name: string }[]>([]); + readonly comparisonCountries = signal<{ id: string; name: string }[]>([]); + readonly comparisonRegions = signal<{ id: string; name: string }[]>([]); + readonly startYear = signal(2015); + readonly endYear = signal(new Date().getFullYear() - 1); + readonly chartMode = signal<'normalized' | 'total'>('total'); + readonly activeChartTopic = signal(''); + + // Cached parameters of the last active search request to track "isDirty" + readonly fetchedTopics = signal([]); + readonly fetchedInstitutions = signal<{ id: string; name: string }[]>([]); + readonly fetchedCountries = signal<{ id: string; name: string }[]>([]); + readonly fetchedRegions = signal<{ id: string; name: string }[]>([]); + + // Results & Loading signals + readonly rawTrendResponse = signal(null); + readonly isTrendLoading = signal(false); + readonly topSuggestions = signal([]); + readonly isSuggestionsLoading = signal(false); + + // Autocomplete UI state + readonly searchQuery = signal(''); + readonly searchResults = signal([]); + readonly locationQuery = signal(''); + readonly locationSearchResults = signal([]); + + // Years array for selects + readonly availableYears: number[] = []; + + // Computed: filters out items locally if they were removed from list + readonly trendResponse = computed(() => { + const raw = this.rawTrendResponse(); + if (!raw) return null; + + const currentInstIds = new Set( + this.comparisonInstitutions().map((i) => i.id.toLowerCase()), + ); + const currentCountryIds = new Set( + this.comparisonCountries().map((c) => c.id.toLowerCase()), + ); + const currentRegionIds = new Set( + this.comparisonRegions().map((r) => r.id.toLowerCase()), + ); + const defaultInstId = 'https://openalex.org/I62318514'.toLowerCase(); + + const filteredSeries = raw.series.filter((s: any) => { + const id = s.entity_id.toLowerCase(); + if (s.entity_type === 'institution') { + return id === defaultInstId || currentInstIds.has(id); + } else if (s.entity_type === 'country') { + return currentCountryIds.has(id); + } else if (s.entity_type === 'region') { + return currentRegionIds.has(id); + } + return false; + }); + + return { + ...raw, + series: filteredSeries, + }; + }); + + // Computed dirty state to enable "Search" button + readonly isDirty = computed(() => { + const fetchedInsts = this.fetchedInstitutions() + .map((i) => i.id) + .sort() + .join(','); + const currentInsts = this.comparisonInstitutions() + .map((i) => i.id) + .sort() + .join(','); + if (fetchedInsts !== currentInsts) return true; + + const fetchedC = this.fetchedCountries() + .map((c) => c.id) + .sort() + .join(','); + const currentC = this.comparisonCountries() + .map((c) => c.id) + .sort() + .join(','); + if (fetchedC !== currentC) return true; + + const fetchedR = this.fetchedRegions() + .map((r) => r.id) + .sort() + .join(','); + const currentR = this.comparisonRegions() + .map((r) => r.id) + .sort() + .join(','); + if (fetchedR !== currentR) return true; + + const fetchedT = this.fetchedTopics().sort().join(','); + const currentT = this.selectedTrendTopics().sort().join(','); + if (fetchedT !== currentT) return true; + + return false; + }); + + constructor() { + // Generate year range from 2000 to current year + const currentYear = new Date().getFullYear(); + for (let y = 2000; y <= currentYear; y++) { + this.availableYears.push(y); + } + + // Effect: automatically sync checkboxes list whenever input keywords change + effect( + () => { + const kws = this.keywords(); + if (kws.length > 0) { + // Find existing selections that are still in keywords, or default to all + const validSelections = this.selectedTrendTopics().filter((t) => + kws.includes(t), + ); + if (validSelections.length > 0) { + this.selectedTrendTopics.set(validSelections); + } else { + this.selectedTrendTopics.set(kws); + } + + // Initialize active chart topic to the first selected topic if empty or invalid + const active = this.activeChartTopic(); + if (!active || !this.selectedTrendTopics().includes(active)) { + this.activeChartTopic.set(this.selectedTrendTopics()[0] || ''); + } + } else { + this.selectedTrendTopics.set([]); + } + }, + { allowSignalWrites: true }, + ); + + // Handle initialization and synchronization of URL state + this.route.queryParams.subscribe((params) => { + // Parse institutions serialized as id|name + if (params['institutions']) { + const insts = Array.isArray(params['institutions']) + ? params['institutions'] + : [params['institutions']]; + const parsed = insts.map((i) => { + const parts = i.split('|'); + return { id: parts[0], name: parts[1] || parts[0] }; + }); + this.comparisonInstitutions.set(parsed); + } + // Parse countries + if (params['countries']) { + const ccs = Array.isArray(params['countries']) + ? params['countries'] + : [params['countries']]; + const parsed = ccs.map((c) => { + const parts = c.split('|'); + return { id: parts[0], name: parts[1] || parts[0] }; + }); + this.comparisonCountries.set(parsed); + } + // Parse regions + if (params['regions']) { + const regs = Array.isArray(params['regions']) + ? params['regions'] + : [params['regions']]; + const parsed = regs.map((r) => { + const parts = r.split('|'); + return { id: parts[0], name: parts[1] || parts[0] }; + }); + this.comparisonRegions.set(parsed); + } + + if (params['start_year']) { + this.startYear.set(Number(params['start_year'])); + } + if (params['end_year']) { + this.endYear.set(Number(params['end_year'])); + } + if (params['chart_mode']) { + this.chartMode.set(params['chart_mode'] as any); + } + if (params['active_chart_topic']) { + this.activeChartTopic.set(params['active_chart_topic']); + } + + // Auto-trigger load once on initial page render if keywords are present + if (this.rawTrendResponse() === null && this.keywords().length > 0) { + this.fetchTrendData(); + } + }); + } + + ngOnInit() { + this.loadTrendSuggestions(); + } + + // Fetch recommended institutions for comparison based on current topics + loadTrendSuggestions() { + this.isSuggestionsLoading.set(true); + const topics = this.selectedTrendTopics(); + const topic = + topics.length > 0 + ? topics[0] + : this.keywords().length > 0 + ? this.keywords()[0] + : 'Artificial Intelligence'; + + const countryFilter = + this.comparisonCountries().length > 0 + ? this.comparisonCountries()[0].id.split('/').pop() + : undefined; + const regionFilter = + this.comparisonRegions().length > 0 + ? this.comparisonRegions()[0].name + : undefined; + + this.apiService + .getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic, + regionFilter, + countryFilter, + 6, + ) + .subscribe({ + next: (res) => { + this.topSuggestions.set(res || []); + this.isSuggestionsLoading.set(false); + }, + error: () => { + this.isSuggestionsLoading.set(false); + }, + }); + } + + // Trigger search trend data (only when "Search" is clicked) + fetchTrendData() { + const topics = this.selectedTrendTopics(); + if (topics.length === 0) return; + + this.isTrendLoading.set(true); + + // Save parameters of this request to check dirty state later + this.fetchedTopics.set([...topics]); + this.fetchedInstitutions.set([...this.comparisonInstitutions()]); + this.fetchedCountries.set([...this.comparisonCountries()]); + this.fetchedRegions.set([...this.comparisonRegions()]); + + this.apiService + .getTrendApiInseServiceUniversityRankingsTrendGet( + topics, + this.comparisonInstitutions().map((i) => i.id), + this.comparisonCountries().map((c) => c.id), + this.comparisonRegions().map((r) => r.id), + ) + .subscribe({ + next: (response) => { + this.rawTrendResponse.set(response); + this.isTrendLoading.set(false); + this.updateUrlParams(); + }, + error: () => { + this.isTrendLoading.set(false); + }, + }); + } + + // Update query params to synchronize state + updateUrlParams() { + const queryParams: any = { + trend_topics: this.selectedTrendTopics(), + institutions: + this.comparisonInstitutions().length > 0 + ? this.comparisonInstitutions().map((i) => `${i.id}|${i.name}`) + : null, + countries: + this.comparisonCountries().length > 0 + ? this.comparisonCountries().map((c) => `${c.id}|${c.name}`) + : null, + regions: + this.comparisonRegions().length > 0 + ? this.comparisonRegions().map((r) => `${r.id}|${r.name}`) + : null, + start_year: this.startYear(), + end_year: this.endYear(), + chart_mode: this.chartMode(), + active_chart_topic: this.activeChartTopic(), + }; + + this.router.navigate([], { + relativeTo: this.route, + queryParams, + queryParamsHandling: 'merge', + }); + } + + // Checkbox topic toggling + onTrendTopicToggle(topic: string, event: Event) { + const isChecked = (event.target as HTMLInputElement).checked; + const current = this.selectedTrendTopics(); + let updated: string[]; + + if (isChecked) { + updated = current.includes(topic) ? current : [...current, topic]; + } else { + updated = + current.length > 1 ? current.filter((t) => t !== topic) : current; + if (current.length === 1) { + (event.target as HTMLInputElement).checked = true; + } + } + + this.selectedTrendTopics.set(updated); + + // Auto-update active tab selection if previous was removed + const active = this.activeChartTopic(); + if (!updated.includes(active)) { + this.activeChartTopic.set(updated[0] || ''); + } + } + + // Add comparison institution + addInstitution(id: string, name: string) { + const current = this.comparisonInstitutions(); + if (!current.some((i) => i.id === id) && id !== this.primaryInstitution()) { + this.comparisonInstitutions.set([...current, { id, name }]); + } + this.searchQuery.set(''); + this.searchResults.set([]); + } + + // Remove comparison institution (data reuses instantly via computed) + removeInstitution(id: string) { + const current = this.comparisonInstitutions(); + this.comparisonInstitutions.set(current.filter((i) => i.id !== id)); + } + + // Add country or region + addLocation(loc: AutocompleteLocationItem) { + if (loc.type === 'country') { + const current = this.comparisonCountries(); + if (!current.some((c) => c.id === loc.id)) { + this.comparisonCountries.set([ + ...current, + { id: loc.id, name: loc.display_name }, + ]); + } + } else if (loc.type === 'continent') { + const current = this.comparisonRegions(); + if (!current.some((r) => r.id === loc.id)) { + this.comparisonRegions.set([ + ...current, + { id: loc.id, name: loc.display_name }, + ]); + } + } + this.locationQuery.set(''); + this.locationSearchResults.set([]); + this.loadTrendSuggestions(); + } + + // Remove country or region + removeLocation(id: string, type: 'country' | 'continent') { + if (type === 'country') { + const current = this.comparisonCountries(); + this.comparisonCountries.set(current.filter((c) => c.id !== id)); + } else if (type === 'continent') { + const current = this.comparisonRegions(); + this.comparisonRegions.set(current.filter((r) => r.id !== id)); + } + this.loadTrendSuggestions(); + } + + // Scaling mode toggle (data reuses instantly) + setChartMode(mode: 'normalized' | 'total') { + this.chartMode.set(mode); + this.updateUrlParams(); + } + + // Topic tab toggle (data reuses instantly) + updateActiveChartTopic(topic: string) { + this.activeChartTopic.set(topic); + this.updateUrlParams(); + } + + // Autocomplete query changes for institutions + onSearchChange(query: string) { + this.searchQuery.set(query); + if (query.trim().length >= 3) { + this.institutionsApiService + .autocompleteInstitutions(query, undefined, 'education', 10) + .subscribe({ + next: (res) => { + this.searchResults.set(res.results || []); + }, + error: () => { + this.searchResults.set([]); + }, + }); + } else { + this.searchResults.set([]); + } + } + + // Autocomplete query changes for locations + onLocationSearchChange(query: string) { + this.locationQuery.set(query); + if (query.trim().length >= 2) { + this.apiService + .getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query, + ) + .subscribe({ + next: (res) => { + this.locationSearchResults.set(res || []); + }, + error: () => { + this.locationSearchResults.set([]); + }, + }); + } else { + this.locationSearchResults.set([]); + } + } +} From 1ddc5c42c56147f4fc0e2f60fa77d5f0769478d4 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Fri, 3 Jul 2026 22:33:32 +0200 Subject: [PATCH 64/92] generated frontend services and models --- service/src/main/inse/tags.py | 1 + .../main/inse/university_ranking/router.py | 2 +- webapp/src/app/api/api/api.ts | 3 + .../api/api/university-rankings.service.ts | 344 ++++++++++++++++++ .../app/api/model/autocompleteLocationItem.ts | 6 + webapp/src/app/api/model/models.ts | 3 + .../src/app/api/model/topInstitutionItem.ts | 7 + webapp/src/app/api/model/trendResponse.ts | 20 + .../keywords-search.component.html | 8 + .../keywords-search.component.ts | 2 + .../services/uni-ranking-service.ts | 10 +- .../uni-trend-chart.component.ts | 79 ++-- .../uni-trend-parent.component.ts | 4 +- 13 files changed, 447 insertions(+), 42 deletions(-) create mode 100644 webapp/src/app/api/api/university-rankings.service.ts create mode 100644 webapp/src/app/api/model/autocompleteLocationItem.ts create mode 100644 webapp/src/app/api/model/topInstitutionItem.ts create mode 100644 webapp/src/app/api/model/trendResponse.ts diff --git a/service/src/main/inse/tags.py b/service/src/main/inse/tags.py index 08fc4bd0..1b25c312 100644 --- a/service/src/main/inse/tags.py +++ b/service/src/main/inse/tags.py @@ -12,3 +12,4 @@ class Tags(StrEnum): AUTH = "Auth" ACCOUNT = "Account" ORGANIZATION = "Organization" + UNIVERSITY_RANKINGS = "University Rankings" diff --git a/service/src/main/inse/university_ranking/router.py b/service/src/main/inse/university_ranking/router.py index 22e24b1c..67c12957 100644 --- a/service/src/main/inse/university_ranking/router.py +++ b/service/src/main/inse/university_ranking/router.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) router = APIRouter( prefix="/api/inse-service/university-rankings", - tags=[Tags.INSTITUTIONS] + tags=[Tags.UNIVERSITY_RANKINGS] ) @router.get( diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 8ea55e0b..6a70a903 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -26,6 +26,8 @@ export * from './topics.service'; import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; +export * from './university-rankings.service'; +import { UniversityRankingsService } from './university-rankings.service'; export const APIS = [ AuthService, CompanyConnectionsService, @@ -41,4 +43,5 @@ export const APIS = [ ProjectsService, TopicsService, WorksService, + UniversityRankingsService, ]; diff --git a/webapp/src/app/api/api/university-rankings.service.ts b/webapp/src/app/api/api/university-rankings.service.ts new file mode 100644 index 00000000..f88965d8 --- /dev/null +++ b/webapp/src/app/api/api/university-rankings.service.ts @@ -0,0 +1,344 @@ +/** + * Innovation Search Engine API + * + * NOTE: This class is manually implemented to act as if it were auto-generated by OpenAPI Generator. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent, + HttpParameterCodec, + HttpContext, +} from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { RankingResponse } from '../model/rankingResponse'; +// @ts-ignore +import { TrendResponse } from '../model/trendResponse'; +// @ts-ignore +import { TopInstitutionItem } from '../model/topInstitutionItem'; +// @ts-ignore +import { AutocompleteLocationItem } from '../model/autocompleteLocationItem'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + +@Injectable({ + providedIn: 'root', +}) +export class UniversityRankingsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } + + public getRankingsApiInseServiceUniversityRankingsGet( + topic: + | 'Artificial Intelligence' + | 'Quantum Computing' + | 'Renewable Energy' + | 'Biotechnology', + metric?: 'publications' | 'citations', + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (topic === null || topic === undefined) { + throw new Error( + 'Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + topic, + 'topic', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + metric, + 'metric', + ); + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + + let localVarPath = `/api/inse-service/university-rankings`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + public getTrendApiInseServiceUniversityRankingsTrendGet( + topics: string[], + institutions?: string[], + countries?: string[], + regions?: string[], + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (topics === null || topics === undefined) { + throw new Error( + 'Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + if (topics) { + topics.forEach((val) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + val, + 'topics', + ); + }); + } + if (institutions) { + institutions.forEach((val) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + val, + 'institutions', + ); + }); + } + if (countries) { + countries.forEach((val) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + val, + 'countries', + ); + }); + } + if (regions) { + regions.forEach((val) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + val, + 'regions', + ); + }); + } + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + + let localVarPath = `/api/inse-service/university-rankings/trend`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic: string, + region?: string, + country?: string, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (topic === null || topic === undefined) { + throw new Error( + 'Required parameter topic was null or undefined when calling getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + topic, + 'topic', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + region, + 'region', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + country, + 'country', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + + let localVarPath = `/api/inse-service/university-rankings/top-institutions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + + let localVarPath = `/api/inse-service/university-rankings/autocomplete-locations`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } +} diff --git a/webapp/src/app/api/model/autocompleteLocationItem.ts b/webapp/src/app/api/model/autocompleteLocationItem.ts new file mode 100644 index 00000000..c3fe1cdd --- /dev/null +++ b/webapp/src/app/api/model/autocompleteLocationItem.ts @@ -0,0 +1,6 @@ +export interface AutocompleteLocationItem { + id: string; + display_name: string; + code: string; + type: 'country' | 'continent'; +} diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 8e381ef2..edd20e54 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -177,3 +177,6 @@ export * from './workTopicSubfield'; export * from './worksFilterProperties'; export * from './worksListResponse'; export * from './yearlyData'; +export * from './trendResponse'; +export * from './topInstitutionItem'; +export * from './autocompleteLocationItem'; diff --git a/webapp/src/app/api/model/topInstitutionItem.ts b/webapp/src/app/api/model/topInstitutionItem.ts new file mode 100644 index 00000000..8f1c6489 --- /dev/null +++ b/webapp/src/app/api/model/topInstitutionItem.ts @@ -0,0 +1,7 @@ +import { DehydratedInstitution } from './dehydratedInstitution'; + +export interface TopInstitutionItem extends DehydratedInstitution { + works_count?: number | null; + image_thumbnail_url?: string | null; + exact_topic_count?: number | null; +} diff --git a/webapp/src/app/api/model/trendResponse.ts b/webapp/src/app/api/model/trendResponse.ts new file mode 100644 index 00000000..7f5589f9 --- /dev/null +++ b/webapp/src/app/api/model/trendResponse.ts @@ -0,0 +1,20 @@ +export interface TopicYearlyData { + year: number; + raw: number; + normalized: number; + institutions_count: number; +} + +export interface TrendSeries { + entity_id: string; + entity_name: string; + entity_type: 'institution' | 'country' | 'region'; + country_code?: string | null; + topic_data: { [key: string]: Array }; +} + +export interface TrendResponse { + series: Array; + years: Array; + location_mappings?: { [key: string]: Array } | null; +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 8eb10128..d30dc5f6 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -229,5 +229,13 @@ Suchen + + + @if (selectedKeywords().length > 0) { +
+ +
+ } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 03a02061..52312b88 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -28,6 +28,7 @@ import { TopicsService } from '../../api/api/topics.service'; import { KeywordsTopicsRequest } from '../../api/model/keywordsTopicsRequest'; import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/topic-autocomplete.component'; +import { UniTrendParentComponent } from '../university-ranking/uni-trend-parent/uni-trend-parent.component'; type InputMode = 'url' | 'text'; type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; @@ -47,6 +48,7 @@ type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; MatExpansionModule, MatProgressBarModule, TopicAutocompleteComponent, + UniTrendParentComponent, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', diff --git a/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts b/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts index d3e362bf..311fc10f 100644 --- a/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts +++ b/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts @@ -3,6 +3,7 @@ import { inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { InstitutionsService, + UniversityRankingsService, RankingResponse, TrendResponse, TopInstitutionItem, @@ -20,6 +21,7 @@ export type DashboardMetric = 'publications' | 'citations'; @Injectable({ providedIn: 'root' }) export class UniversityRankingService { private apiService = inject(InstitutionsService); + private rankingsApiService = inject(UniversityRankingsService); /** * Fetches ranking and timeseries data directly from the backend. @@ -29,7 +31,7 @@ export class UniversityRankingService { topic: ResearchTopic, metric: DashboardMetric, ): Observable { - return this.apiService.getRankingsApiInseServiceUniversityRankingsGet( + return this.rankingsApiService.getRankingsApiInseServiceUniversityRankingsGet( topic, metric, ); @@ -45,7 +47,7 @@ export class UniversityRankingService { countries?: string[], regions?: string[], ): Observable { - return this.apiService.getTrendApiInseServiceUniversityRankingsTrendGet( + return this.rankingsApiService.getTrendApiInseServiceUniversityRankingsTrendGet( topics as any, institutions, countries, @@ -62,7 +64,7 @@ export class UniversityRankingService { country?: string, limit?: number, ): Observable { - return this.apiService.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + return this.rankingsApiService.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( topic, region, country, @@ -86,7 +88,7 @@ export class UniversityRankingService { * Autocompletes countries and continents. */ autocompleteLocations(query: string): Observable { - return this.apiService.getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + return this.rankingsApiService.getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( query, ); } diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts index f8ba7f61..f549b878 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts @@ -6,7 +6,7 @@ import { } from '@angular/core'; import { EChartsOption } from 'echarts'; import { NgxEchartsDirective } from 'ngx-echarts'; -import { TrendResponse } from '../../../api'; +import { TrendResponse, TrendSeries, TopicYearlyData } from '../../../api'; @Component({ selector: 'app-uni-trend-chart', @@ -162,10 +162,10 @@ export class UniTrendChartComponent { }, tooltip: { trigger: 'axis', - axisPointer: { type: 'cross' }, - backgroundColor: 'rgba(255, 255, 255, 0.95)', + backgroundColor: 'rgba(255, 255, 255, 0.96)', borderColor: '#e5e7eb', borderWidth: 1, + padding: 0, textStyle: { color: '#374151', fontSize: 12, @@ -178,14 +178,14 @@ export class UniTrendChartComponent { res += `Year: ${yearNum}
`; res += `
`; - trendData.series.forEach((entity, entityIdx) => { + trendData.series.forEach((entity: TrendSeries, entityIdx: number) => { const color = entityColors[entityIdx % entityColors.length]; res += `
`; res += ``; res += `${entity.entity_name}:
`; const yrData = entity.topic_data[selectedTopic]?.find( - (y) => y.year === yearNum, + (y: TopicYearlyData) => y.year === yearNum, ); if (yrData) { const val = @@ -201,24 +201,26 @@ export class UniTrendChartComponent { const instCountryCode = entity.country_code?.toUpperCase(); const parentCountry = trendData.series.find( - (s) => + (s: TrendSeries) => s.entity_type === 'country' && s.entity_id.toUpperCase() === instCountryCode, ); - const parentContinent = trendData.series.find((s) => { - if (s.entity_type !== 'region') return false; - const memberCountries = - trendData.location_mappings?.[s.entity_id] || []; - return memberCountries.some( - (c) => c.toUpperCase() === instCountryCode, - ); - }); + const parentContinent = trendData.series.find( + (s: TrendSeries) => { + if (s.entity_type !== 'region') return false; + const memberCountries = + trendData.location_mappings?.[s.entity_id] || []; + return memberCountries.some( + (c: string) => c.toUpperCase() === instCountryCode, + ); + }, + ); if (parentCountry) { const parentYr = parentCountry.topic_data[ selectedTopic - ]?.find((y) => y.year === yearNum); + ]?.find((y: TopicYearlyData) => y.year === yearNum); if (parentYr && parentYr.raw > 0) { const pct = (yrData.raw / parentYr.raw) * 100; contributionStr = ` (${pct.toFixed(1)}% of ${parentCountry.entity_name})`; @@ -226,17 +228,19 @@ export class UniTrendChartComponent { } else if (parentContinent) { const parentYr = parentContinent.topic_data[ selectedTopic - ]?.find((y) => y.year === yearNum); + ]?.find((y: TopicYearlyData) => y.year === yearNum); if (parentYr && parentYr.raw > 0) { const pct = (yrData.raw / parentYr.raw) * 100; contributionStr = ` (${pct.toFixed(1)}% of ${parentContinent.entity_name})`; } } else { const sumInsts = trendData.series - .filter((s) => s.entity_type === 'institution') - .reduce((sum, s) => { + .filter( + (s: TrendSeries) => s.entity_type === 'institution', + ) + .reduce((sum: number, s: TrendSeries) => { const y = s.topic_data[selectedTopic]?.find( - (yd) => yd.year === yearNum, + (yd: TopicYearlyData) => yd.year === yearNum, ); return sum + (y ? y.raw : 0); }, 0); @@ -248,24 +252,26 @@ export class UniTrendChartComponent { } else if (entity.entity_type === 'country') { const countryCode = entity.entity_id.toUpperCase(); - const parentContinent = trendData.series.find((s) => { - if (s.entity_type !== 'region') return false; - const memberCountries = - trendData.location_mappings?.[s.entity_id] || []; - return memberCountries.some( - (c) => c.toUpperCase() === countryCode, - ); - }); + const parentContinent = trendData.series.find( + (s: TrendSeries) => { + if (s.entity_type !== 'region') return false; + const memberCountries = + trendData.location_mappings?.[s.entity_id] || []; + return memberCountries.some( + (c: string) => c.toUpperCase() === countryCode, + ); + }, + ); const childInstsSum = trendData.series .filter( - (s) => + (s: TrendSeries) => s.entity_type === 'institution' && s.country_code?.toUpperCase() === countryCode, ) - .reduce((sum, s) => { + .reduce((sum: number, s: TrendSeries) => { const y = s.topic_data[selectedTopic]?.find( - (yd) => yd.year === yearNum, + (yd: TopicYearlyData) => yd.year === yearNum, ); return sum + (y ? y.raw : 0); }, 0); @@ -276,7 +282,7 @@ export class UniTrendChartComponent { if (parentContinent) { const parentYr = parentContinent.topic_data[ selectedTopic - ]?.find((y) => y.year === yearNum); + ]?.find((y: TopicYearlyData) => y.year === yearNum); if (parentYr && parentYr.raw > 0) { const pct = (yrData.raw / parentYr.raw) * 100; contributionStr = ` (${pct.toFixed(1)}% of ${parentContinent.entity_name})`; @@ -292,23 +298,24 @@ export class UniTrendChartComponent { trendData.location_mappings?.[continentId] || []; const childSum = trendData.series - .filter((s) => { + .filter((s: TrendSeries) => { if (s.entity_type === 'country') { return memberCountries.some( - (c) => c.toUpperCase() === s.entity_id.toUpperCase(), + (c: string) => + c.toUpperCase() === s.entity_id.toUpperCase(), ); } if (s.entity_type === 'institution') { return memberCountries.some( - (c) => + (c: string) => c.toUpperCase() === s.country_code?.toUpperCase(), ); } return false; }) - .reduce((sum, s) => { + .reduce((sum: number, s: TrendSeries) => { const y = s.topic_data[selectedTopic]?.find( - (yd) => yd.year === yearNum, + (yd: TopicYearlyData) => yd.year === yearNum, ); return sum + (y ? y.raw : 0); }, 0); diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index 94ac41df..70e0148a 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -16,6 +16,8 @@ import { UniversityRankingsService } from '../../../api/api/university-rankings. import { InstitutionsService } from '../../../api/api/institutions.service'; import { TrendResponse, + TrendSeries, + TopicYearlyData, TopInstitutionItem, AutocompleteLocationItem, AutocompleteResponse, @@ -89,7 +91,7 @@ export class UniTrendParentComponent implements OnInit { ); const defaultInstId = 'https://openalex.org/I62318514'.toLowerCase(); - const filteredSeries = raw.series.filter((s: any) => { + const filteredSeries = raw.series.filter((s: TrendSeries) => { const id = s.entity_id.toLowerCase(); if (s.entity_type === 'institution') { return id === defaultInstId || currentInstIds.has(id); From f4b8d0884c370828c570e93f9b2e758282c39fc1 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Sat, 4 Jul 2026 21:01:49 +0200 Subject: [PATCH 65/92] changed and refactored university-ranking to unify ranking and trend. Removed hardcoded placeholder, Whitelisted fields to reduce response size --- service/src/main/inse/main.py | 2 +- .../src/main/inse/university_ranking/logic.py | 211 +++++++++++++++--- .../src/main/inse/university_ranking/model.py | 4 +- .../main/inse/university_ranking/router.py | 84 ------- .../main/inse/university_ranking/service.py | 84 ++++++- .../inse/university_ranking/trend_logic.py | 26 ++- .../modules/dashboard/dashboard.component.ts | 46 ++-- .../services/uni-ranking-service.ts | 95 -------- .../uni-line-chart.component.html | 6 +- .../uni-line-chart.component.ts | 87 ++++---- .../uni-trend-parent.component.ts | 29 ++- 11 files changed, 376 insertions(+), 298 deletions(-) delete mode 100644 service/src/main/inse/university_ranking/router.py delete mode 100644 webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index 54a43096..24969bb8 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -24,7 +24,7 @@ from inse.exceptions import ( ) from inse.funders.service import router as funders_service_router from inse.projects.router import router as projects_router -from inse.university_ranking.router import router as university_ranking_router +from inse.university_ranking.service import router as university_ranking_router # caching from inse.middleware.etag_cache import ETagCacheMiddleware diff --git a/service/src/main/inse/university_ranking/logic.py b/service/src/main/inse/university_ranking/logic.py index 10d926ff..1accf196 100644 --- a/service/src/main/inse/university_ranking/logic.py +++ b/service/src/main/inse/university_ranking/logic.py @@ -1,65 +1,212 @@ import logging +import datetime from typing import List, Dict, Any -from .model import UniversityTopicData, YearlyData, UniversityRanking, ResearchTopic, DashboardMetric, RankingResponse +from .model import UniversityTopicData, YearlyData, UniversityRanking, DashboardMetric, RankingResponse from inse.integrations import elasticsearch +from inse.models.openalex.topic import Topic logger = logging.getLogger(__name__) -START_YEAR = 2015 -END_YEAR = 2026 +START_YEAR = 2000 +END_YEAR = datetime.datetime.now().year - 1 -async def get_ranking_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse: +async def resolve_topic(topic_query: str) -> Topic: + """Resolves a topic display name or ID using Elasticsearch with source whitelisting.""" + if topic_query.startswith("http") or "/T" in topic_query: + query = {"term": {"id": topic_query}} + else: + query = {"match_phrase": {"display_name": topic_query}} + + try: + res = await elasticsearch.search( + index="openalex-topics", + query=query, + size=1, + source=["id", "display_name", "description", "works_count", "cited_by_count"], + cluster="nes" + ) + hits = res.get("hits", {}).get("hits", []) + if hits: + return Topic.from_dict(hits[0]["_source"]) + except Exception as e: + logger.warning("Failed to resolve topic in ES: %s", e) + + return Topic(display_name=topic_query) + +async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> RankingResponse: """ Fetches real data from Elasticsearch and computes metrics for the dashboard. """ + topic_obj = await resolve_topic(topic_query) + topic_name = topic_obj.display_name or topic_query + query = { "bool": { - "must": [ - { - "match_phrase": { - "topics.display_name": topic - } - }, - { - "term": { - "geo.country_code": "DE" - } - } - ] + "must": [ + {"term": {"type": "education"}}, + {"term": {"geo.country_code": "DE"}}, + {"match_phrase": {"topics.display_name": topic_name}} + ] } } - - # Fetch top institutions for the topic by works_count res = await elasticsearch.search( index="openalex-institutions", query=query, - size=10, - sort=[{"works_count": "desc"}], + size=50, + source=["id", "display_name", "topics"], cluster="nes" ) hits = res.get("hits", {}).get("hits", []) - timeseries: List[UniversityTopicData] = [] + candidates = [] for hit in hits: source = hit["_source"] - # Map the counts_by_year from ES to our model - # We ensure every year from START_YEAR to END_YEAR is present, defaulting to 0 - es_counts = {c["year"]: c for c in source.get("counts_by_year", [])} + inst_id = source.get("id") + display_name = source.get("display_name", "Unknown") + # Extract topic-specific works count + exact_topic_count = 0 + for t in source.get("topics", []): + if t.get("display_name", "").lower() == topic_name.lower(): + exact_topic_count = t.get("count", 0) + break + + candidates.append({ + "id": inst_id, + "display_name": display_name, + "exact_topic_count": exact_topic_count + }) + + # Sort in Python by exact topic count descending and take the top 10 + candidates.sort(key=lambda x: x["exact_topic_count"], reverse=True) + top_10 = candidates[:10] + + # Initialize timeseries map: inst_id -> year -> (publications, citations) + years_range = list(range(START_YEAR, END_YEAR + 1)) + accumulated_data = { + inst["id"]: {yr: (0, 0) for yr in years_range} + for inst in top_10 + } + + if top_10: + # Build filter map for the single-pass aggregation query + filters_map = {} + for inst in top_10: + inst_id = inst["id"] + filters_map[inst_id] = { + "nested": { + "path": "authorships.institutions", + "query": { + "term": { + "authorships.institutions.id": inst_id + } + } + } + } + + # Topic filter clause (using topic ID if resolved, otherwise matching phrase) + topic_id = topic_obj.id + if topic_id: + topic_clause = { + "bool": { + "should": [ + {"nested": {"path": "topics", "query": {"term": {"topics.id": topic_id}}}}, + {"term": {"primary_topic.id": topic_id}} + ], + "minimum_should_match": 1 + } + } + else: + topic_clause = { + "bool": { + "should": [ + {"nested": {"path": "topics", "query": {"match_phrase": {"topics.display_name": topic_name}}}}, + {"match_phrase": {"primary_topic.display_name": topic_name}} + ], + "minimum_should_match": 1 + } + } + + # Construct single-pass ES query on openalex-works + works_query = { + "bool": { + "must": [ + { + "range": { + "publication_year": { + "gte": START_YEAR, + "lte": END_YEAR + } + } + }, + topic_clause + ] + } + } + + aggregations = { + "institutions_agg": { + "filters": { + "filters": filters_map + }, + "aggs": { + "by_year": { + "terms": { + "field": "publication_year", + "size": len(years_range) * 2 + }, + "aggs": { + "citations_sum": { + "sum": { + "field": "cited_by_count" + } + } + } + } + } + } + } + + try: + works_res = await elasticsearch.search( + index="openalex-works*", + query=works_query, + body={"aggs": aggregations}, + size=0, + cluster="nes" + ) + + inst_buckets = works_res.get("aggregations", {}).get("institutions_agg", {}).get("buckets", {}) + for inst_id, inst_bucket in inst_buckets.items(): + year_buckets = inst_bucket.get("by_year", {}).get("buckets", []) + for yr_bucket in year_buckets: + yr = int(yr_bucket.get("key")) + pubs = int(yr_bucket.get("doc_count", 0)) + cits = int(yr_bucket.get("citations_sum", {}).get("value", 0)) + if yr in years_range: + accumulated_data[inst_id][yr] = (pubs, cits) + except Exception as e: + logger.error("Error executing ranking aggregations on openalex-works: %s", e) + + # Map the accumulated results back into the timeseries response model + timeseries: List[UniversityTopicData] = [] + inst_name_map = {inst["id"]: inst["display_name"] for inst in top_10} + + for inst_id, year_dict in accumulated_data.items(): yearly_data = [] - for year in range(START_YEAR, END_YEAR + 1): - count_item = es_counts.get(year, {}) + for yr in years_range: + pubs, cits = year_dict[yr] yearly_data.append(YearlyData( - year=year, - publications=count_item.get("works_count", 0), - citations=count_item.get("cited_by_count", 0) + year=yr, + publications=pubs, + citations=cits )) - + timeseries.append(UniversityTopicData( - university=source.get("display_name", "Unknown"), - topic=topic, + university=inst_name_map[inst_id], + topic=topic_obj, yearly_data=yearly_data )) diff --git a/service/src/main/inse/university_ranking/model.py b/service/src/main/inse/university_ranking/model.py index 7a4791d7..866b04ad 100644 --- a/service/src/main/inse/university_ranking/model.py +++ b/service/src/main/inse/university_ranking/model.py @@ -1,7 +1,7 @@ from pydantic import BaseModel from typing import List, Literal, Dict, Optional +from inse.models.openalex.topic import Topic -ResearchTopic = Literal['Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', 'Biotechnology'] DashboardMetric = Literal['publications', 'citations'] class YearlyData(BaseModel): @@ -11,7 +11,7 @@ class YearlyData(BaseModel): class UniversityTopicData(BaseModel): university: str - topic: ResearchTopic + topic: Topic yearly_data: List[YearlyData] class UniversityRanking(BaseModel): diff --git a/service/src/main/inse/university_ranking/router.py b/service/src/main/inse/university_ranking/router.py deleted file mode 100644 index 67c12957..00000000 --- a/service/src/main/inse/university_ranking/router.py +++ /dev/null @@ -1,84 +0,0 @@ -import logging -from typing import List, Optional -from fastapi import APIRouter, Query, Depends, Request - -from inse.tags import Tags -from inse.database import get_session -from inse.auth import service as auth_service -from inse.auth.model import AccessToken, UserRole -from . import service, trend_logic -from .model import ( - RankingResponse, - ResearchTopic, - DashboardMetric, - TrendResponse, - TopInstitutionItem, - AutocompleteLocationItem -) - -logger = logging.getLogger(__name__) - -router = APIRouter( - prefix="/api/inse-service/university-rankings", - tags=[Tags.UNIVERSITY_RANKINGS] -) - -@router.get( - "", - response_model=RankingResponse, - summary="Returns data for the University Ranking Dashboard." -) -async def get_rankings( - topic: ResearchTopic = Query( - ..., - description="Research topic (e.g., 'Artificial Intelligence')" - ), - metric: DashboardMetric = Query("publications", description="Metric to rank by") -): - return await service.get_university_dashboard_data(topic, metric) - -@router.get( - "/trend", - response_model=TrendResponse, - summary="Returns timeseries publication data for compared institutions, countries and regions." -) -async def get_trend( - topics: List[ResearchTopic] = Query(..., description="List of topics to analyze"), - institutions: Optional[List[str]] = Query(None, description="List of OpenAlex Institution IDs"), - countries: Optional[List[str]] = Query(None, description="List of country codes"), - regions: Optional[List[str]] = Query(None, description="List of region identifiers") -): - return await trend_logic.get_trend_data( - topics=topics, - institutions=institutions, - countries=countries, - regions=regions - ) - -@router.get( - "/top-institutions", - response_model=List[TopInstitutionItem], - summary="Returns top institutions filtered by country/region and sorted by topic-level publications count." -) -async def get_top_institutions( - topic: str = Query(..., description="Research topic"), - region: Optional[str] = Query(None, description="Region identifier (e.g. EU)"), - country: Optional[str] = Query(None, description="Country code (e.g. DE)"), - limit: int = Query(10, description="Max suggestions to return") -): - return await trend_logic.get_top_institutions_by_region( - topic=topic, - region=region, - country=country, - limit=limit - ) - -@router.get( - "/autocomplete-locations", - response_model=List[AutocompleteLocationItem], - summary="Returns country and continent options for autocomplete inputs." -) -async def get_autocomplete_locations( - query: str = Query(..., description="Query text to search for countries/continents") -): - return await trend_logic.autocomplete_locations(query) \ No newline at end of file diff --git a/service/src/main/inse/university_ranking/service.py b/service/src/main/inse/university_ranking/service.py index 4eac89e6..c81ae0ee 100644 --- a/service/src/main/inse/university_ranking/service.py +++ b/service/src/main/inse/university_ranking/service.py @@ -1,6 +1,80 @@ -from . import logic -from .model import RankingResponse, ResearchTopic, DashboardMetric +import logging +from typing import List, Optional +from fastapi import APIRouter, Query -async def get_university_dashboard_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse: - """Orchestrates data retrieval and computation for the dashboard.""" - return await logic.get_ranking_data(topic, metric) \ No newline at end of file +from inse.tags import Tags +from . import logic, trend_logic +from .model import ( + RankingResponse, + DashboardMetric, + TrendResponse, + TopInstitutionItem, + AutocompleteLocationItem +) + +logger = logging.getLogger(__name__) + +router = APIRouter( + prefix="/api/inse-service/university-rankings", + tags=[Tags.UNIVERSITY_RANKINGS] +) + +@router.get( + "", + response_model=RankingResponse, + summary="Returns data for the University Ranking Dashboard." +) +async def get_rankings( + topic: str = Query( + ..., + description="Research topic display name or OpenAlex ID (e.g., 'Artificial Intelligence')" + ), + metric: DashboardMetric = Query("publications", description="Metric to rank by") +): + return await logic.get_ranking_data(topic, metric) + +@router.get( + "/trend", + response_model=TrendResponse, + summary="Returns timeseries publication data for compared institutions, countries and regions." +) +async def get_trend( + topics: List[str] = Query(..., description="List of topics to analyze"), + institutions: Optional[List[str]] = Query(None, description="List of OpenAlex Institution IDs"), + countries: Optional[List[str]] = Query(None, description="List of country codes"), + regions: Optional[List[str]] = Query(None, description="List of region identifiers") +): + return await trend_logic.get_trend_data( + topics=topics, + institutions=institutions, + countries=countries, + regions=regions + ) + +@router.get( + "/top-institutions", + response_model=List[TopInstitutionItem], + summary="Returns top institutions filtered by country/region and sorted by topic-level publications count." +) +async def get_top_institutions( + topic: str = Query(..., description="Research topic"), + region: Optional[str] = Query(None, description="Region identifier (e.g. EU)"), + country: Optional[str] = Query(None, description="Country code (e.g. DE)"), + limit: int = Query(10, description="Max suggestions to return") +): + return await trend_logic.get_top_institutions_by_region( + topic=topic, + region=region, + country=country, + limit=limit + ) + +@router.get( + "/autocomplete-locations", + response_model=List[AutocompleteLocationItem], + summary="Returns country and continent options for autocomplete inputs." +) +async def get_autocomplete_locations( + query: str = Query(..., description="Query text to search for countries/continents") +): + return await trend_logic.autocomplete_locations(query) \ No newline at end of file diff --git a/service/src/main/inse/university_ranking/trend_logic.py b/service/src/main/inse/university_ranking/trend_logic.py index c025bc74..a6a482aa 100644 --- a/service/src/main/inse/university_ranking/trend_logic.py +++ b/service/src/main/inse/university_ranking/trend_logic.py @@ -12,7 +12,6 @@ from .model import ( TrendSeries, TopicYearlyData, TopInstitutionItem, - ResearchTopic, AutocompleteLocationItem ) @@ -29,7 +28,7 @@ async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]: import asyncio - # Query countries index + # Query countries index (Idea: Instead of wildcard: use alternative names?) country_query = { "bool": { "should": [ @@ -66,8 +65,20 @@ async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]: try: countries_res, continents_res = await asyncio.gather( - elasticsearch.search(index=str(ESIndex.OPENALEX_COUNTRIES), query=country_query, size=10, cluster="nes"), - elasticsearch.search(index=str(ESIndex.OPENALEX_CONTINENTS), query=continent_query, size=5, cluster="nes") + elasticsearch.search( + index=str(ESIndex.OPENALEX_COUNTRIES), + query=country_query, + size=10, + source=["id", "display_name", "country_code", "wikidata_id"], + cluster="nes" + ), + elasticsearch.search( + index=str(ESIndex.OPENALEX_CONTINENTS), + query=continent_query, + size=5, + source=["id", "display_name", "wikidata_id"], + cluster="nes" + ) ) except Exception as e: logger.error("Failed to autocomplete locations in ES: %s", e) @@ -145,6 +156,7 @@ async def get_top_institutions_by_region( index=str(ESIndex.OPENALEX_INSTITUTIONS), query=query, size=50, + source=["id", "display_name", "country_code", "works_count", "image_thumbnail_url", "topics"], sort=[{"works_count": "desc"}], cluster="nes" ) @@ -182,7 +194,7 @@ async def get_top_institutions_by_region( return candidates[:limit] async def get_trend_data( - topics: List[ResearchTopic], + topics: List[str], institutions: Optional[List[str]] = None, countries: Optional[List[str]] = None, regions: Optional[List[str]] = None @@ -220,6 +232,7 @@ async def get_trend_data( index=str(ESIndex.OPENALEX_INSTITUTIONS), query={"terms": {"id": ids_to_resolve}}, size=len(ids_to_resolve), + source=["id", "display_name", "country_code"], cluster="nes" ) for hit in name_res.get("hits", {}).get("hits", []): @@ -242,6 +255,7 @@ async def get_trend_data( index=str(ESIndex.OPENALEX_COUNTRIES), query={"terms": {"country_code": clean_countries}}, size=len(clean_countries), + source=["country_code", "display_name"], cluster="nes" ) for hit in c_res.get("hits", {}).get("hits", []): @@ -267,6 +281,7 @@ async def get_trend_data( } }, size=len(clean_regions), + source=["id", "display_name", "wikidata_id", "countries"], cluster="nes" ) for hit in r_res.get("hits", {}).get("hits", []): @@ -297,6 +312,7 @@ async def get_trend_data( } }, size=len(topics) * 2, + source=["id", "display_name"], cluster="nes" ) for hit in topic_res.get("hits", {}).get("hits", []): diff --git a/webapp/src/app/modules/dashboard/dashboard.component.ts b/webapp/src/app/modules/dashboard/dashboard.component.ts index ef967b09..3906004e 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.ts +++ b/webapp/src/app/modules/dashboard/dashboard.component.ts @@ -1,13 +1,13 @@ -import { Component, OnInit } from '@angular/core'; -import { UniversityRankingService } from '../university-ranking/services/uni-ranking-service'; +import { Component, inject, OnInit } from '@angular/core'; import { UniversityLineChartComponent } from '../university-ranking/uni-line-chart/uni-line-chart.component'; import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component'; -import { UniversityTopicData, UniversityRanking } from '../../api'; -export type ResearchTopic = - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology'; +import { + UniversityTopicData, + UniversityRanking, + UniversityRankingsService, +} from '../../api'; + +export type ResearchTopic = string; export type DashboardMetric = 'publications' | 'citations'; @Component({ @@ -17,11 +17,12 @@ export type DashboardMetric = 'publications' | 'citations'; styleUrl: './dashboard.component.scss', }) export class DashboardComponent implements OnInit { + private readonly dataService = inject(UniversityRankingsService); + topics: ResearchTopic[] = [ - 'Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', - 'Biotechnology', + 'Artificial Intelligence and Decision Support Systems', ]; selectedTopic: ResearchTopic = 'Artificial Intelligence'; metric: DashboardMetric = 'publications'; @@ -30,8 +31,6 @@ export class DashboardComponent implements OnInit { computedRankings: UniversityRanking[] = []; isLoading = false; - constructor(private dataService: UniversityRankingService) {} - ngOnInit() { this.loadData(); } @@ -49,14 +48,21 @@ export class DashboardComponent implements OnInit { private loadData() { this.isLoading = true; this.dataService - .getRankingData(this.selectedTopic, this.metric) - .subscribe((response) => { - // Map backend snake_case properties to frontend camelCase if necessary, - // though OpenAPI Generator usually handles this. - console.log(response); - this.rawDataSource = (response.timeseries as any) || []; - this.computedRankings = (response.rankings as any) || []; - this.isLoading = false; + .getRankingsApiInseServiceUniversityRankingsGet( + this.selectedTopic, + this.metric, + ) + .subscribe({ + next: (response) => { + this.rawDataSource = (response.timeseries as any) || []; + this.computedRankings = (response.rankings as any) || []; + this.isLoading = false; + }, + error: () => { + this.rawDataSource = []; + this.computedRankings = []; + this.isLoading = false; + }, }); } } diff --git a/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts b/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts deleted file mode 100644 index 311fc10f..00000000 --- a/webapp/src/app/modules/university-ranking/services/uni-ranking-service.ts +++ /dev/null @@ -1,95 +0,0 @@ -// src/app/modules/university-ranking/services/university-data.service.ts -import { inject, Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; -import { - InstitutionsService, - UniversityRankingsService, - RankingResponse, - TrendResponse, - TopInstitutionItem, - AutocompleteResponse, - AutocompleteLocationItem, -} from '../../../api'; - -export type ResearchTopic = - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology'; -export type DashboardMetric = 'publications' | 'citations'; - -@Injectable({ providedIn: 'root' }) -export class UniversityRankingService { - private apiService = inject(InstitutionsService); - private rankingsApiService = inject(UniversityRankingsService); - - /** - * Fetches ranking and timeseries data directly from the backend. - * Calculations for growth and trends are now handled server-side. - */ - getRankingData( - topic: ResearchTopic, - metric: DashboardMetric, - ): Observable { - return this.rankingsApiService.getRankingsApiInseServiceUniversityRankingsGet( - topic, - metric, - ); - } - - //trend analysis part - /** - * Fetches the comparative trend analysis data. - */ - getTrend( - topics: string[], - institutions?: string[], - countries?: string[], - regions?: string[], - ): Observable { - return this.rankingsApiService.getTrendApiInseServiceUniversityRankingsTrendGet( - topics as any, - institutions, - countries, - regions, - ); - } - - /** - * Fetches recommendations/suggestions of top institutions based on a specific topic. - */ - getTopInstitutions( - topic: string, - region?: string, - country?: string, - limit?: number, - ): Observable { - return this.rankingsApiService.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( - topic, - region, - country, - limit, - ); - } - - /** - * Autocompletes institutions based on query text. - */ - autocomplete(query: string): Observable { - return this.apiService.autocompleteInstitutions( - query, - undefined, - 'education', - 10, - ); - } - - /** - * Autocompletes countries and continents. - */ - autocompleteLocations(query: string): Observable { - return this.rankingsApiService.getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query, - ); - } -} diff --git a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html index 41931384..09ab42d3 100644 --- a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html +++ b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html @@ -1,5 +1 @@ -
+
diff --git a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.ts index 799ad08f..cb123796 100644 --- a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.ts @@ -1,13 +1,13 @@ -// src/app/modules/university-ranking/components/line-chart/university-line-chart.component.ts -import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; +import { + Component, + ChangeDetectionStrategy, + input, + computed, +} from '@angular/core'; import { EChartsOption } from 'echarts'; import { NgxEchartsDirective } from 'ngx-echarts'; -import { UniversityTopicData, YearlyData } from '../../../api'; -export type ResearchTopic = - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology'; +import { UniversityTopicData } from '../../../api'; + export type DashboardMetric = 'publications' | 'citations'; @Component({ @@ -15,50 +15,55 @@ export type DashboardMetric = 'publications' | 'citations'; templateUrl: './uni-line-chart.component.html', styleUrl: './uni-line-chart.component.scss', imports: [NgxEchartsDirective], - standalone: true, + changeDetection: ChangeDetectionStrategy.OnPush, }) -export class UniversityLineChartComponent implements OnChanges { - @Input() data: UniversityTopicData[] = []; - @Input() metric: DashboardMetric = 'publications'; +export class UniversityLineChartComponent { + readonly data = input(null); + readonly metric = input('publications'); - chartOption: EChartsOption = { - title: { - text: 'Research Output Over Time', - left: 'center', - textStyle: { fontWeight: 'lighter' }, - }, - tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, - legend: { bottom: 0 }, - grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true }, - xAxis: { type: 'category', boundaryGap: false, data: [] }, - yAxis: { type: 'value', name: 'Volume' }, - dataZoom: [{ type: 'slider', show: true, bottom: 40 }], - series: [], - }; - - mergeOption: EChartsOption = {}; - - ngOnChanges(changes: SimpleChanges): void { - if (this.data.length > 0) { - this.updateChart(); - console.log('CHANGES!'); + readonly chartOption = computed(() => { + const rawData = this.data(); + if (!rawData || rawData.length === 0) { + return {}; } - } - private updateChart() { - const years = this.data[0].yearly_data.map((d) => d.year); - const series = this.data.map((uni) => ({ + const years = rawData[0].yearly_data.map((d) => d.year); + const chosenMetric = this.metric(); + + const series = rawData.map((uni) => ({ name: uni.university, type: 'line', smooth: true, emphasis: { focus: 'series' }, animationDuration: 2000, - data: uni.yearly_data.map((d) => d[this.metric]), + data: uni.yearly_data.map((d) => { + if (chosenMetric === 'citations') { + return d.citations || 0; + } + return d.publications || 0; + }), })); - this.mergeOption = { - xAxis: { data: years.map(String) }, + return { + title: { + text: 'Research Output Over Time', + left: 'center', + textStyle: { fontWeight: 'lighter' }, + }, + tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, + legend: { bottom: 0 }, + grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true }, + xAxis: { + type: 'category', + boundaryGap: false, + data: years.map(String), + }, + yAxis: { + type: 'value', + name: chosenMetric === 'citations' ? 'Citations' : 'Publications', + }, + dataZoom: [{ type: 'slider', show: true, bottom: 40 }], series: series as any, }; - } + }); } diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index 70e0148a..ae695357 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -5,6 +5,7 @@ import { computed, signal, effect, + untracked, inject, OnInit, } from '@angular/core'; @@ -12,8 +13,6 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { UniTrendChartComponent } from '../uni-trend-chart/uni-trend-chart.component'; -import { UniversityRankingsService } from '../../../api/api/university-rankings.service'; -import { InstitutionsService } from '../../../api/api/institutions.service'; import { TrendResponse, TrendSeries, @@ -21,6 +20,8 @@ import { TopInstitutionItem, AutocompleteLocationItem, AutocompleteResponse, + UniversityRankingsService, + InstitutionsService, } from '../../../api'; @Component({ @@ -96,9 +97,17 @@ export class UniTrendParentComponent implements OnInit { if (s.entity_type === 'institution') { return id === defaultInstId || currentInstIds.has(id); } else if (s.entity_type === 'country') { - return currentCountryIds.has(id); + return ( + currentCountryIds.has(id) || + currentCountryIds.has('https://openalex.org/countries/' + id) || + Array.from(currentCountryIds).some((cid) => cid.endsWith('/' + id)) + ); } else if (s.entity_type === 'region') { - return currentRegionIds.has(id); + return ( + currentRegionIds.has(id) || + currentRegionIds.has('https://openalex.org/continents/' + id) || + Array.from(currentRegionIds).some((rid) => rid.endsWith('/' + id)) + ); } return false; }); @@ -159,9 +168,12 @@ export class UniTrendParentComponent implements OnInit { effect( () => { const kws = this.keywords(); + const currentSelections = untracked(() => this.selectedTrendTopics()); + const currentActive = untracked(() => this.activeChartTopic()); + if (kws.length > 0) { // Find existing selections that are still in keywords, or default to all - const validSelections = this.selectedTrendTopics().filter((t) => + const validSelections = currentSelections.filter((t) => kws.includes(t), ); if (validSelections.length > 0) { @@ -171,9 +183,10 @@ export class UniTrendParentComponent implements OnInit { } // Initialize active chart topic to the first selected topic if empty or invalid - const active = this.activeChartTopic(); - if (!active || !this.selectedTrendTopics().includes(active)) { - this.activeChartTopic.set(this.selectedTrendTopics()[0] || ''); + const active = currentActive; + const updatedSelections = untracked(() => this.selectedTrendTopics()); + if (!active || !updatedSelections.includes(active)) { + this.activeChartTopic.set(updatedSelections[0] || ''); } } else { this.selectedTrendTopics.set([]); From 261f97eee0276943151cca9906bcbfec34b2d5b1 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Sat, 4 Jul 2026 21:04:48 +0200 Subject: [PATCH 66/92] regenerated frontend with openapi generator gradle service --- webapp/src/app/api/.openapi-generator/FILES | 6 + webapp/src/app/api/api/api.ts | 6 +- .../src/app/api/api/institutions.service.ts | 911 +++++++++++------- ...rvice.ts => universityRankings.service.ts} | 454 ++++++--- .../app/api/model/autocompleteLocationItem.ts | 19 +- webapp/src/app/api/model/models.ts | 8 +- .../src/app/api/model/topInstitutionItem.ts | 18 +- webapp/src/app/api/model/topicYearlyData.ts | 16 + webapp/src/app/api/model/trendResponse.ts | 24 +- webapp/src/app/api/model/trendSeries.ts | 27 + .../src/app/api/model/universityTopicData.ts | 23 +- 11 files changed, 1025 insertions(+), 487 deletions(-) rename webapp/src/app/api/api/{university-rankings.service.ts => universityRankings.service.ts} (54%) create mode 100644 webapp/src/app/api/model/topicYearlyData.ts create mode 100644 webapp/src/app/api/model/trendSeries.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 99b72add..28dbd8c3 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -17,6 +17,7 @@ api/personNetwork.service.ts api/persons.service.ts api/projects.service.ts api/topics.service.ts +api/universityRankings.service.ts api/works.service.ts configuration.ts encoder.ts @@ -38,6 +39,7 @@ model/authorSummaryStats.ts model/authorsFilterProperties.ts model/authorsListResponse.ts model/authorship.ts +model/autocompleteLocationItem.ts model/autocompleteResponse.ts model/autocompleteResponseMeta.ts model/autocompleteResponseResultsInner.ts @@ -164,16 +166,20 @@ model/refreshToken.ts model/score.ts model/sortDirection.ts model/tokenType.ts +model/topInstitutionItem.ts model/topic.ts model/topicCount.ts model/topicDomain.ts model/topicField.ts model/topicIds.ts model/topicSubfield.ts +model/topicYearlyData.ts model/topics.ts model/topicsByTime.ts model/topicsByYear.ts model/topicsListResponse.ts +model/trendResponse.ts +model/trendSeries.ts model/universityRanking.ts model/universityTopicData.ts model/updateAccountRequest.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 6a70a903..673b93bb 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -24,10 +24,10 @@ export * from './projects.service'; import { ProjectsService } from './projects.service'; export * from './topics.service'; import { TopicsService } from './topics.service'; +export * from './universityRankings.service'; +import { UniversityRankingsService } from './universityRankings.service'; export * from './works.service'; import { WorksService } from './works.service'; -export * from './university-rankings.service'; -import { UniversityRankingsService } from './university-rankings.service'; export const APIS = [ AuthService, CompanyConnectionsService, @@ -42,6 +42,6 @@ export const APIS = [ PersonsService, ProjectsService, TopicsService, - WorksService, UniversityRankingsService, + WorksService, ]; diff --git a/webapp/src/app/api/api/institutions.service.ts b/webapp/src/app/api/api/institutions.service.ts index a4ba3d62..b837e00e 100644 --- a/webapp/src/app/api/api/institutions.service.ts +++ b/webapp/src/app/api/api/institutions.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,12 +9,18 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent, + HttpParameterCodec, + HttpContext, +} from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -26,362 +32,593 @@ import { Institution } from '../model/institution'; import { InstitutionPage } from '../model/institutionPage'; // @ts-ignore import { InstitutionsListResponse } from '../model/institutionsListResponse'; -// @ts-ignore -import { RankingResponse } from '../model/rankingResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; - - @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class InstitutionsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { - super(basePath, configuration); + /** + * Returns institution options for autocomplete inputs. + * @endpoint get /api/inse-service/institutions/autocomplete + * @param query Institution search text, for example \'Duisburg Essen\'. + * @param countryCode Optional ISO country code filter. + * @param type Optional institution type filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteInstitutions( + query: string, + countryCode?: string, + type?: string, + limit?: number, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public autocompleteInstitutions( + query: string, + countryCode?: string, + type?: string, + limit?: number, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteInstitutions( + query: string, + countryCode?: string, + type?: string, + limit?: number, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteInstitutions( + query: string, + countryCode?: string, + type?: string, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling autocompleteInstitutions.', + ); } - /** - * Returns institution options for autocomplete inputs. - * @endpoint get /api/inse-service/institutions/autocomplete - * @param query Institution search text, for example \'Duisburg Essen\'. - * @param countryCode Optional ISO country code filter. - * @param type Optional institution type filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (query === null || query === undefined) { - throw new Error('Required parameter query was null or undefined when calling autocompleteInstitutions.'); - } + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + countryCode, + 'countryCode', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + type, + 'type', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - query, 'query'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - countryCode, 'countryCode'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - type, 'type'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - limit, 'limit'); + let localVarHeaders = this.defaultHeaders; - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * Returns a single institution by ID. - * Returns a single institution by its OpenAlex ID. - * @endpoint get /api/inse-service/institutions/{id} - * @param id - * @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 getInstitutionById(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getInstitutionById(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getInstitutionById(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getInstitutionById(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getInstitutionById.'); - } + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarHeaders = this.defaultHeaders; + const localVarTransferCache: boolean = options?.transferCache ?? true; - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } } - /** - * Returns data for the University Ranking Dashboard. - * @endpoint get /api/inse-service/university-rankings - * @param topic Research topic (e.g., \'Artificial Intelligence\') - * @param metric Metric to rank by - * @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 getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (topic === null || topic === undefined) { - throw new Error('Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.'); - } + let localVarPath = `/api/inse-service/institutions/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - topic, 'topic'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - metric, 'metric'); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/university-rankings`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + /** + * Returns a single institution by ID. + * Returns a single institution by its OpenAlex ID. + * @endpoint get /api/inse-service/institutions/{id} + * @param id + * @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 getInstitutionById( + id: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getInstitutionById( + id: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getInstitutionById( + id: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getInstitutionById( + id: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (id === null || id === undefined) { + throw new Error( + 'Required parameter id was null or undefined when calling getInstitutionById.', + ); } - /** - * Returns a list of OpenAlex institutions. - * @endpoint get /api/inse-service/institutions - * @param search Full-text search, for example \'Duisburg Essen\'. - * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'country_code\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + let localVarHeaders = this.defaultHeaders; - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - search, 'search'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - filter, 'filter'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sort, 'sort'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - groupBy, 'group_by'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - perPage, 'per_page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - cursor, 'cursor'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sample, 'sample'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - select, 'select'); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * Searches for institutions by name. - * Searches for institutions by name with pagination. - * @endpoint get /api/inse-service/institutions/search - * @param name Institution name to search for, for example \'University of Duisburg Essen\'. - * @param page Page number (0-indexed). - * @param size Number of institutions per page. - * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. - * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. - * @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 searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - name, 'name'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - size, 'size'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sortBy, 'sort_by'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sortingDirection, 'sorting_direction'); + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } } + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Returns a list of OpenAlex institutions. + * @endpoint get /api/inse-service/institutions + * @param search Full-text search, for example \'Duisburg Essen\'. + * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'country_code\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listInstitutions( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public listInstitutions( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listInstitutions( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listInstitutions( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + search, + 'search', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + filter, + 'filter', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sort, + 'sort', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + groupBy, + 'group_by', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + perPage, + 'per_page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + cursor, + 'cursor', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sample, + 'sample', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + select, + 'select', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Searches for institutions by name. + * Searches for institutions by name with pagination. + * @endpoint get /api/inse-service/institutions/search + * @param name Institution name to search for, for example \'University of Duisburg Essen\'. + * @param page Page number (0-indexed). + * @param size Number of institutions per page. + * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. + * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. + * @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 searchInstitutionsByName( + name?: string, + page?: number, + size?: number, + sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', + sortingDirection?: 'asc' | 'desc', + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public searchInstitutionsByName( + name?: string, + page?: number, + size?: number, + sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', + sortingDirection?: 'asc' | 'desc', + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public searchInstitutionsByName( + name?: string, + page?: number, + size?: number, + sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', + sortingDirection?: 'asc' | 'desc', + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public searchInstitutionsByName( + name?: string, + page?: number, + size?: number, + sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', + sortingDirection?: 'asc' | 'desc', + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + name, + 'name', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + size, + 'size', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sortBy, + 'sort_by', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sortingDirection, + 'sorting_direction', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } } diff --git a/webapp/src/app/api/api/university-rankings.service.ts b/webapp/src/app/api/api/universityRankings.service.ts similarity index 54% rename from webapp/src/app/api/api/university-rankings.service.ts rename to webapp/src/app/api/api/universityRankings.service.ts index f88965d8..4ed6111d 100644 --- a/webapp/src/app/api/api/university-rankings.service.ts +++ b/webapp/src/app/api/api/universityRankings.service.ts @@ -1,7 +1,11 @@ /** * Innovation Search Engine API * - * NOTE: This class is manually implemented to act as if it were auto-generated by OpenAPI Generator. + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. */ /* tslint:disable:no-unused-variable member-ordering */ @@ -19,13 +23,15 @@ import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; // @ts-ignore -import { RankingResponse } from '../model/rankingResponse'; +import { AutocompleteLocationItem } from '../model/autocompleteLocationItem'; // @ts-ignore -import { TrendResponse } from '../model/trendResponse'; +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { RankingResponse } from '../model/rankingResponse'; // @ts-ignore import { TopInstitutionItem } from '../model/topInstitutionItem'; // @ts-ignore -import { AutocompleteLocationItem } from '../model/autocompleteLocationItem'; +import { TrendResponse } from '../model/trendResponse'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -44,12 +50,159 @@ export class UniversityRankingsService extends BaseService { super(basePath, configuration); } + /** + * Returns country and continent options for autocomplete inputs. + * @endpoint get /api/inse-service/university-rankings/autocomplete-locations + * @param query Query text to search for countries/continents + * @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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( + query: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/university-rankings/autocomplete-locations`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + + /** + * Returns data for the University Ranking Dashboard. + * @endpoint get /api/inse-service/university-rankings + * @param topic Research topic display name or OpenAlex ID (e.g., \'Artificial Intelligence\') + * @param metric Metric to rank by + * @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 getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', + topic: string, + metric?: 'publications' | 'citations', + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getRankingsApiInseServiceUniversityRankingsGet( + topic: string, + metric?: 'publications' | 'citations', + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet( + topic: string, + metric?: 'publications' | 'citations', + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet( + topic: string, metric?: 'publications' | 'citations', observe: any = 'body', reportProgress: boolean = false, @@ -78,6 +231,7 @@ export class UniversityRankingsService extends BaseService { ); let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept(['application/json']); @@ -90,8 +244,21 @@ export class UniversityRankingsService extends BaseService { const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } let localVarPath = `/api/inse-service/university-rankings`; const { basePath, withCredentials } = this.configuration; @@ -113,99 +280,55 @@ export class UniversityRankingsService extends BaseService { ); } - public getTrendApiInseServiceUniversityRankingsTrendGet( - topics: string[], - institutions?: string[], - countries?: string[], - regions?: string[], - observe: any = 'body', - reportProgress: boolean = false, + /** + * Returns top institutions filtered by country/region and sorted by topic-level publications count. + * @endpoint get /api/inse-service/university-rankings/top-institutions + * @param topic Research topic + * @param region Region identifier (e.g. EU) + * @param country Country code (e.g. DE) + * @param limit Max suggestions to return + * @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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic: string, + region?: string, + country?: string, + limit?: number, + observe?: 'body', + reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean; }, - ): Observable { - if (topics === null || topics === undefined) { - throw new Error( - 'Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topics) { - topics.forEach((val) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - val, - 'topics', - ); - }); - } - if (institutions) { - institutions.forEach((val) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - val, - 'institutions', - ); - }); - } - if (countries) { - countries.forEach((val) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - val, - 'countries', - ); - }); - } - if (regions) { - regions.forEach((val) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - val, - 'regions', - ); - }); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - - let localVarPath = `/api/inse-service/university-rankings/trend`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - + ): Observable>; + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic: string, + region?: string, + country?: string, + limit?: number, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>>; + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic: string, + region?: string, + country?: string, + limit?: number, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>>; public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( topic: string, region?: string, @@ -248,6 +371,7 @@ export class UniversityRankingsService extends BaseService { ); let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept(['application/json']); @@ -260,8 +384,21 @@ export class UniversityRankingsService extends BaseService { const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } let localVarPath = `/api/inse-service/university-rankings/top-institutions`; const { basePath, withCredentials } = this.configuration; @@ -283,8 +420,60 @@ export class UniversityRankingsService extends BaseService { ); } - public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query: string, + /** + * Returns timeseries publication data for compared institutions, countries and regions. + * @endpoint get /api/inse-service/university-rankings/trend + * @param topics List of topics to analyze + * @param institutions List of OpenAlex Institution IDs + * @param countries List of country codes + * @param regions List of region identifiers + * @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 getTrendApiInseServiceUniversityRankingsTrendGet( + topics: Array, + institutions?: Array, + countries?: Array, + regions?: Array, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getTrendApiInseServiceUniversityRankingsTrendGet( + topics: Array, + institutions?: Array, + countries?: Array, + regions?: Array, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTrendApiInseServiceUniversityRankingsTrendGet( + topics: Array, + institutions?: Array, + countries?: Array, + regions?: Array, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTrendApiInseServiceUniversityRankingsTrendGet( + topics: Array, + institutions?: Array, + countries?: Array, + regions?: Array, observe: any = 'body', reportProgress: boolean = false, options?: { @@ -293,20 +482,52 @@ export class UniversityRankingsService extends BaseService { transferCache?: boolean; }, ): Observable { - if (query === null || query === undefined) { + if (topics === null || topics === undefined) { throw new Error( - 'Required parameter query was null or undefined when calling getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.', + 'Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.', ); } let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); + if (topics) { + topics.forEach((element) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + element, + 'topics', + ); + }); + } + if (institutions) { + institutions.forEach((element) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + element, + 'institutions', + ); + }); + } + if (countries) { + countries.forEach((element) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + element, + 'countries', + ); + }); + } + if (regions) { + regions.forEach((element) => { + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + element, + 'regions', + ); + }); + } let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept(['application/json']); @@ -319,12 +540,25 @@ export class UniversityRankingsService extends BaseService { const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - let localVarPath = `/api/inse-service/university-rankings/autocomplete-locations`; + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/university-rankings/trend`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request>( + return this.httpClient.request( 'get', `${basePath}${localVarPath}`, { diff --git a/webapp/src/app/api/model/autocompleteLocationItem.ts b/webapp/src/app/api/model/autocompleteLocationItem.ts index c3fe1cdd..b07e699e 100644 --- a/webapp/src/app/api/model/autocompleteLocationItem.ts +++ b/webapp/src/app/api/model/autocompleteLocationItem.ts @@ -1,6 +1,23 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + export interface AutocompleteLocationItem { id: string; display_name: string; code: string; - type: 'country' | 'continent'; + type: AutocompleteLocationItem.TypeEnum; +} +export namespace AutocompleteLocationItem { + export const TypeEnum = { + Country: 'country', + Continent: 'continent', + } as const; + export type TypeEnum = (typeof TypeEnum)[keyof typeof TypeEnum]; } diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index edd20e54..2077ece1 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -14,6 +14,7 @@ export * from './authorSummaryStats'; export * from './authorsFilterProperties'; export * from './authorsListResponse'; export * from './authorship'; +export * from './autocompleteLocationItem'; export * from './autocompleteResponse'; export * from './autocompleteResponseMeta'; export * from './autocompleteResponseResultsInner'; @@ -139,16 +140,20 @@ export * from './refreshToken'; export * from './score'; export * from './sortDirection'; export * from './tokenType'; +export * from './topInstitutionItem'; export * from './topic'; export * from './topicCount'; export * from './topicDomain'; export * from './topicField'; export * from './topicIds'; export * from './topicSubfield'; +export * from './topicYearlyData'; export * from './topics'; export * from './topicsByTime'; export * from './topicsByYear'; export * from './topicsListResponse'; +export * from './trendResponse'; +export * from './trendSeries'; export * from './universityRanking'; export * from './universityTopicData'; export * from './updateAccountRequest'; @@ -177,6 +182,3 @@ export * from './workTopicSubfield'; export * from './worksFilterProperties'; export * from './worksListResponse'; export * from './yearlyData'; -export * from './trendResponse'; -export * from './topInstitutionItem'; -export * from './autocompleteLocationItem'; diff --git a/webapp/src/app/api/model/topInstitutionItem.ts b/webapp/src/app/api/model/topInstitutionItem.ts index 8f1c6489..827fe6df 100644 --- a/webapp/src/app/api/model/topInstitutionItem.ts +++ b/webapp/src/app/api/model/topInstitutionItem.ts @@ -1,6 +1,20 @@ -import { DehydratedInstitution } from './dehydratedInstitution'; +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ -export interface TopInstitutionItem extends DehydratedInstitution { +export interface TopInstitutionItem { + id?: string | null; + display_name?: string | null; + ror?: string | null; + country_code?: string | null; + type?: string | null; + lineage?: Array | null; works_count?: number | null; image_thumbnail_url?: string | null; exact_topic_count?: number | null; diff --git a/webapp/src/app/api/model/topicYearlyData.ts b/webapp/src/app/api/model/topicYearlyData.ts new file mode 100644 index 00000000..15e4c59a --- /dev/null +++ b/webapp/src/app/api/model/topicYearlyData.ts @@ -0,0 +1,16 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export interface TopicYearlyData { + year: number; + raw: number; + normalized: number; + institutions_count: number; +} diff --git a/webapp/src/app/api/model/trendResponse.ts b/webapp/src/app/api/model/trendResponse.ts index 7f5589f9..e6b291c9 100644 --- a/webapp/src/app/api/model/trendResponse.ts +++ b/webapp/src/app/api/model/trendResponse.ts @@ -1,17 +1,13 @@ -export interface TopicYearlyData { - year: number; - raw: number; - normalized: number; - institutions_count: number; -} - -export interface TrendSeries { - entity_id: string; - entity_name: string; - entity_type: 'institution' | 'country' | 'region'; - country_code?: string | null; - topic_data: { [key: string]: Array }; -} +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { TrendSeries } from './trendSeries'; export interface TrendResponse { series: Array; diff --git a/webapp/src/app/api/model/trendSeries.ts b/webapp/src/app/api/model/trendSeries.ts new file mode 100644 index 00000000..1dc054be --- /dev/null +++ b/webapp/src/app/api/model/trendSeries.ts @@ -0,0 +1,27 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { TopicYearlyData } from './topicYearlyData'; + +export interface TrendSeries { + entity_id: string; + entity_name: string; + entity_type: TrendSeries.EntityTypeEnum; + country_code?: string | null; + topic_data: { [key: string]: Array }; +} +export namespace TrendSeries { + export const EntityTypeEnum = { + Institution: 'institution', + Country: 'country', + Region: 'region', + } as const; + export type EntityTypeEnum = + (typeof EntityTypeEnum)[keyof typeof EntityTypeEnum]; +} diff --git a/webapp/src/app/api/model/universityTopicData.ts b/webapp/src/app/api/model/universityTopicData.ts index fc517b7c..3bf43088 100644 --- a/webapp/src/app/api/model/universityTopicData.ts +++ b/webapp/src/app/api/model/universityTopicData.ts @@ -1,28 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { YearlyData } from './yearlyData'; +import { Topic } from './topic'; - -export interface UniversityTopicData { - university: string; - topic: UniversityTopicData.TopicEnum; - yearly_data: Array; +export interface UniversityTopicData { + university: string; + topic: Topic; + yearly_data: Array; } -export namespace UniversityTopicData { - export const TopicEnum = { - ArtificialIntelligence: 'Artificial Intelligence', - QuantumComputing: 'Quantum Computing', - RenewableEnergy: 'Renewable Energy', - Biotechnology: 'Biotechnology' - } as const; - export type TopicEnum = typeof TopicEnum[keyof typeof TopicEnum]; -} - - From e648ea1ec460d5f23abfc38712aba041b0699759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sat, 4 Jul 2026 22:37:34 +0200 Subject: [PATCH 67/92] feat(backend/auth): added otk response model --- service/src/main/inse/auth/model.py | 7 +++++++ service/src/main/inse/auth/router.py | 3 ++- service/src/main/inse/auth/service.py | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/service/src/main/inse/auth/model.py b/service/src/main/inse/auth/model.py index a79aa113..21d7d706 100644 --- a/service/src/main/inse/auth/model.py +++ b/service/src/main/inse/auth/model.py @@ -210,3 +210,10 @@ class AccessResponse(BaseModel): refresh_token: RefreshToken = Field( description="The refresh token issued alongside the access token for obtaining new access tokens." ) + + +class OtkResponse(BaseModel): + status: str = Field(description="The status of the one-time code (OTC) request.") + account_id: uuid.UUID = Field( + description="The unique identifier of the account for which the OTC was requested." + ) diff --git a/service/src/main/inse/auth/router.py b/service/src/main/inse/auth/router.py index 2ce4f52a..e80612bb 100644 --- a/service/src/main/inse/auth/router.py +++ b/service/src/main/inse/auth/router.py @@ -14,6 +14,7 @@ from inse.auth.model import ( AccessToken, IdToken, LoginResponse, + OtkResponse, RefreshToken, ) @@ -40,7 +41,7 @@ async def request_otk( session: SessionDep, email: Annotated[str, Body(description="User's email address")], password: Annotated[str, Body(description="User's password")], -): +) -> OtkResponse: return auth_service.request_otk(session=session, email=email, password=password) diff --git a/service/src/main/inse/auth/service.py b/service/src/main/inse/auth/service.py index 0af15a4b..dfaa1bf3 100644 --- a/service/src/main/inse/auth/service.py +++ b/service/src/main/inse/auth/service.py @@ -18,6 +18,7 @@ from inse.auth.model import ( IdToken, LoginResponse, Organization, + OtkResponse, RefreshToken, Secret, TokenType, @@ -155,7 +156,7 @@ def _verify_password(password: str, password_hash: str) -> bool: return False -def request_otk(session: Session, email: str, password: str): +def request_otk(session: Session, email: str, password: str) -> OtkResponse: """Requests a one-time key (OTK) for authentication using email and password. Validates the provided credentials and generates a one-time key if valid. Args: @@ -236,7 +237,7 @@ def request_otk(session: Session, email: str, password: str): else: logger.info("OTK generated for account %s", account.id) - return {"status": "ok", "account_id": str(account.id)} + return OtkResponse(status="success", account_id=account.id) def login( From 2703f465751410e2a0388ee44871f3f738bcb298 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Sat, 4 Jul 2026 23:12:03 +0200 Subject: [PATCH 68/92] Implemented scikit normalize batch, fixed blocking elastic search query, changed frontend to resize dynamically, fixed bug in dashboard --- .../src/main/inse/university_ranking/model.py | 2 +- .../inse/university_ranking/trend_logic.py | 176 +++++++++---- .../dashboard/dashboard.component.html | 4 +- .../modules/dashboard/dashboard.component.ts | 2 +- .../uni-line-chart.component.html | 6 +- .../uni-trend-chart.component.html | 6 +- .../uni-trend-chart.component.ts | 232 ++++++------------ 7 files changed, 222 insertions(+), 206 deletions(-) diff --git a/service/src/main/inse/university_ranking/model.py b/service/src/main/inse/university_ranking/model.py index 866b04ad..18a2fb32 100644 --- a/service/src/main/inse/university_ranking/model.py +++ b/service/src/main/inse/university_ranking/model.py @@ -34,6 +34,7 @@ class TopicYearlyData(BaseModel): year: int raw: int normalized: float + cumulative: float institutions_count: int class TrendSeries(BaseModel): @@ -53,7 +54,6 @@ from inse.models.openalex.dehydrated_institution import DehydratedInstitution class TopInstitutionItem(DehydratedInstitution): works_count: Optional[int] = None - image_thumbnail_url: Optional[str] = None exact_topic_count: Optional[int] = None class AutocompleteLocationItem(BaseModel): diff --git a/service/src/main/inse/university_ranking/trend_logic.py b/service/src/main/inse/university_ranking/trend_logic.py index a6a482aa..6cf70e13 100644 --- a/service/src/main/inse/university_ranking/trend_logic.py +++ b/service/src/main/inse/university_ranking/trend_logic.py @@ -2,6 +2,8 @@ import logging import uuid import datetime from typing import List, Dict, Any, Optional +import numpy as np +from sklearn.preprocessing import MinMaxScaler from sqlmodel import Session from inse.integrations import elasticsearch @@ -89,10 +91,11 @@ async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]: # Process continents for hit in continents_res.get("hits", {}).get("hits", []): source = hit["_source"] + code_val = source.get("wikidata_id") or source["id"].split("/")[-1] results.append(AutocompleteLocationItem( - id=source["id"], + id=code_val, display_name=source["display_name"], - code=source.get("wikidata_id") or source["id"].split("/")[-1], + code=code_val, type="continent" )) @@ -100,7 +103,7 @@ async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]: for hit in countries_res.get("hits", {}).get("hits", []): source = hit["_source"] results.append(AutocompleteLocationItem( - id=source["id"], + id=source["country_code"], display_name=source["display_name"], code=source["country_code"], type="country" @@ -109,20 +112,6 @@ async def autocomplete_locations(query: str) -> List[AutocompleteLocationItem]: return results -def clean_institution_id(inst_id: str) -> str: - inst_id = inst_id.strip() - if not inst_id.startswith("http"): - return f"https://openalex.org/{inst_id}" - return inst_id - -def min_max_normalize(values: List[int]) -> List[float]: - if not values: - return [] - min_val = min(values) - max_val = max(values) - if max_val == min_val: - return [0.0] * len(values) - return [float(v - min_val) / (max_val - min_val) for v in values] async def get_top_institutions_by_region( topic: str, @@ -156,7 +145,7 @@ async def get_top_institutions_by_region( index=str(ESIndex.OPENALEX_INSTITUTIONS), query=query, size=50, - source=["id", "display_name", "country_code", "works_count", "image_thumbnail_url", "topics"], + source=["id", "display_name", "country_code", "works_count", "topics"], sort=[{"works_count": "desc"}], cluster="nes" ) @@ -170,7 +159,6 @@ async def get_top_institutions_by_region( display_name = source.get("display_name", "Unknown") country_code = source.get("country_code") works_count = source.get("works_count") - image_thumbnail_url = source.get("image_thumbnail_url") # Extract exact count for the selected topic exact_topic_count = 0 @@ -184,7 +172,6 @@ async def get_top_institutions_by_region( display_name=display_name, country_code=country_code, works_count=works_count, - image_thumbnail_url=image_thumbnail_url, exact_topic_count=exact_topic_count )) @@ -217,7 +204,7 @@ async def get_trend_data( # Initialize institutions list and ensure primary is included query_institutions = [] if institutions: - query_institutions = [clean_institution_id(i) for i in institutions] + query_institutions = [i.strip() for i in institutions] if primary_inst_id not in query_institutions: query_institutions.insert(0, primary_inst_id) @@ -399,25 +386,73 @@ async def get_trend_data( topic_clauses.append(clause) topic_filters[t] = clause - # Construct the single-pass Elasticsearch query - query = { - "bool": { - "must": [ - { - "range": { - "publication_year": { - "gte": start_year, - "lte": end_year - } - } - }, - { - "bool": { - "should": topic_clauses, - "minimum_should_match": 1 + # Build query-level entity filters to optimize search performance + entity_should_clauses = [] + if query_institutions: + entity_should_clauses.append({ + "nested": { + "path": "authorships.institutions", + "query": { + "terms": { + "authorships.institutions.id": query_institutions } } - ] + } + }) + if clean_countries: + entity_should_clauses.append({ + "nested": { + "path": "authorships.institutions", + "query": { + "terms": { + "authorships.institutions.country_code": clean_countries + } + } + } + }) + all_continent_countries = [] + for member_ccs in continent_country_codes.values(): + all_continent_countries.extend(member_ccs) + if all_continent_countries: + entity_should_clauses.append({ + "nested": { + "path": "authorships.institutions", + "query": { + "terms": { + "authorships.institutions.country_code": list(set(all_continent_countries)) + } + } + } + }) + + # Construct the single-pass Elasticsearch query + must_clauses = [ + { + "range": { + "publication_year": { + "gte": start_year, + "lte": end_year + } + } + }, + { + "bool": { + "should": topic_clauses, + "minimum_should_match": 1 + } + } + ] + if entity_should_clauses: + must_clauses.append({ + "bool": { + "should": entity_should_clauses, + "minimum_should_match": 1 + } + }) + + query = { + "bool": { + "must": must_clauses } } @@ -469,6 +504,51 @@ async def get_trend_data( except Exception as e: logger.error("Error executing single-pass Elasticsearch query: %s", e) + # Construct lists of raw counts and S-Curves for all series to normalize in parallel + series_keys = [] + raw_lists = [] + cumsum_lists = [] + inst_counts_map = {} + + for entity_key, topic_dict in accumulated_data.items(): + for topic, year_dict in topic_dict.items(): + raw_counts = [] + inst_counts = [] + for yr in years_range: + count, inst_count = year_dict[yr] + raw_counts.append(count) + inst_counts.append(inst_count) + + cumulative_counts = list(np.cumsum(raw_counts)) + + series_keys.append((entity_key, topic)) + raw_lists.append(raw_counts) + cumsum_lists.append(cumulative_counts) + inst_counts_map[(entity_key, topic)] = inst_counts + + normalized_lookup = {} + if raw_lists: + # Construct matrices of shape (n_years, n_series) + raw_matrix = np.array(raw_lists, dtype=float).T + cumsum_matrix = np.array(cumsum_lists, dtype=float).T + + # Batch normalize columns in parallel using MinMaxScaler + scaler_raw = MinMaxScaler() + normalized_matrix = scaler_raw.fit_transform(raw_matrix) + + scaler_cumsum = MinMaxScaler() + normalized_cumsum_matrix = scaler_cumsum.fit_transform(cumsum_matrix) + + # Transpose back to lists of shape (n_series, n_years) + normalized_lists = normalized_matrix.T.tolist() + normalized_cumsum_lists = normalized_cumsum_matrix.T.tolist() + + for idx, (entity_key, topic) in enumerate(series_keys): + normalized_lookup[(entity_key, topic)] = { + "normalized": normalized_lists[idx], + "cumulative": normalized_cumsum_lists[idx] + } + # Process and build TrendSeries list series_list: List[TrendSeries] = [] @@ -494,22 +574,18 @@ async def get_trend_data( for topic, year_dict in topic_dict.items(): yearly_data_items: List[TopicYearlyData] = [] - # Extract raw counts and institution counts in sorted year order - raw_counts = [] - inst_counts = [] - for yr in years_range: - count, inst_count = year_dict[yr] - raw_counts.append(count) - inst_counts.append(inst_count) - - # MinMaxScaler normalization - normalized_counts = min_max_normalize(raw_counts) + lookup = normalized_lookup.get((entity_key, topic), {}) + norm_vals = lookup.get("normalized", [0.0] * len(years_range)) + cum_vals = lookup.get("cumulative", [0.0] * len(years_range)) + inst_counts = inst_counts_map.get((entity_key, topic), [1] * len(years_range)) for idx, yr in enumerate(years_range): + count, _ = year_dict[yr] yearly_data_items.append(TopicYearlyData( year=yr, - raw=raw_counts[idx], - normalized=normalized_counts[idx], + raw=count, + normalized=norm_vals[idx], + cumulative=cum_vals[idx], institutions_count=inst_counts[idx] )) diff --git a/webapp/src/app/modules/dashboard/dashboard.component.html b/webapp/src/app/modules/dashboard/dashboard.component.html index fbd76a45..1c451952 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.html +++ b/webapp/src/app/modules/dashboard/dashboard.component.html @@ -2,7 +2,9 @@

University Performance Dashboard

- @for (t of topics; track t) { } diff --git a/webapp/src/app/modules/dashboard/dashboard.component.ts b/webapp/src/app/modules/dashboard/dashboard.component.ts index 3906004e..53af9fad 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.ts +++ b/webapp/src/app/modules/dashboard/dashboard.component.ts @@ -24,7 +24,7 @@ export class DashboardComponent implements OnInit { 'Renewable Energy', 'Artificial Intelligence and Decision Support Systems', ]; - selectedTopic: ResearchTopic = 'Artificial Intelligence'; + selectedTopic: ResearchTopic = 'Quantum Computing'; metric: DashboardMetric = 'publications'; rawDataSource: UniversityTopicData[] = []; diff --git a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html index 09ab42d3..059525c8 100644 --- a/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html +++ b/webapp/src/app/modules/university-ranking/uni-line-chart/uni-line-chart.component.html @@ -1 +1,5 @@ -
+
diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html index d76650ac..0ac5df9a 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html @@ -1,6 +1,10 @@
@if (data() && data()!.series && data()!.series.length > 0) { -
+
} @else {
📊
diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts index f549b878..8f935aa8 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts @@ -18,10 +18,10 @@ import { TrendResponse, TrendSeries, TopicYearlyData } from '../../../api'; export class UniTrendChartComponent { // Input signals following Angular v21 standards readonly data = input(null); - readonly mode = input<'normalized' | 'total'>('total'); + readonly mode = input<'normalized' | 'total' | 'cumulative'>('normalized'); readonly activeTopic = input(null); - readonly startYear = input(2015); - readonly endYear = input(2026); + readonly startYear = input(2010); + readonly endYear = input(2025); // Computed signal to automatically rebuild ECharts options when data or mode changes readonly chartOptions = computed(() => { @@ -64,12 +64,15 @@ export class UniTrendChartComponent { // Build series: Line in top grid, growth volume bars and S-Curve in bottom grid trendData.series.forEach((entity, entityIdx) => { const color = entityColors[entityIdx % entityColors.length]; + const yrTopicData = entity.topic_data[selectedTopic] || []; // 1. Add line series for the currently selected topic (placed in Grid 0) - const yrTopicData = entity.topic_data[selectedTopic]; const lineData = years.map((year) => { - const yrData = yrTopicData?.find((y) => y.year === year); + const yrData = yrTopicData.find((y) => y.year === year); if (!yrData) return 0; + if (currentMode === 'cumulative') { + return yrData.cumulative; + } return currentMode === 'normalized' ? yrData.normalized : yrData.raw; }); @@ -93,16 +96,15 @@ export class UniTrendChartComponent { }); // 2. Add YoY growth volume bars for the selected topic (placed in Grid 1) - const volumeData = years.map((year) => { - const yrData = yrTopicData?.find((y) => y.year === year); - return yrData ? yrData.raw : 0; - }); + const bars = years.map((year) => { + const yrData = yrTopicData.find((y) => y.year === year); + const val = yrData ? yrData.raw : 0; - const bars = years.map((year, idx) => { - const val = volumeData[idx]; - const prevVal = idx > 0 ? volumeData[idx - 1] : val; - const trendSign = val >= prevVal ? 1 : -1; - return [idx, val, trendSign]; + // Find previous year's raw count (even if previous year is outside the viewport years range!) + const prevYrData = yrTopicData.find((y) => y.year === year - 1); + const prevVal = prevYrData ? prevYrData.raw : 0; + + return val - prevVal; }); series.push({ @@ -112,35 +114,7 @@ export class UniTrendChartComponent { yAxisIndex: 1, data: bars, itemStyle: { - color: (params: any) => { - const trendSign = params.value[2]; - return trendSign >= 0 ? '#10b981' : '#ef4444'; // Green vs Red - }, - }, - }); - - // 3. Add S-Curve cumulative publications trend overlay (placed in Grid 1) - let cumulativeSum = 0; - const cumulativeData = volumeData.map((val) => { - cumulativeSum += val; - return cumulativeSum; - }); - - series.push({ - name: `${entity.entity_name} (S-Curve)`, - type: 'line', - xAxisIndex: 1, - yAxisIndex: 2, - data: cumulativeData, - smooth: true, - symbol: 'none', - lineStyle: { - width: 2, - color: color, - type: 'dashed', - }, - itemStyle: { - color: color, + color: color, // Takes the color of the institution! }, }); }); @@ -148,7 +122,9 @@ export class UniTrendChartComponent { const yAxisName = currentMode === 'normalized' ? 'Normalized Scale (0 - 1)' - : 'Publications Volume'; + : currentMode === 'cumulative' + ? 'Cumulative Publications' + : 'Publications Volume'; return { title: { @@ -180,23 +156,39 @@ export class UniTrendChartComponent { trendData.series.forEach((entity: TrendSeries, entityIdx: number) => { const color = entityColors[entityIdx % entityColors.length]; + const yrTopicData = entity.topic_data[selectedTopic] || []; + + // Recalculate cumulative sum map for this entity + const cumulativeSumMap = new Map(); + let runningSum = 0; + trendData.years.forEach((yr) => { + const yrData = yrTopicData.find((y) => y.year === yr); + runningSum += yrData ? yrData.raw : 0; + cumulativeSumMap.set(yr, runningSum); + }); + res += `
`; res += ``; res += `${entity.entity_name}:
`; - const yrData = entity.topic_data[selectedTopic]?.find( + const yrData = yrTopicData.find( (y: TopicYearlyData) => y.year === yearNum, ); if (yrData) { const val = - currentMode === 'normalized' ? yrData.normalized : yrData.raw; + currentMode === 'normalized' + ? yrData.normalized + : currentMode === 'cumulative' + ? cumulativeSumMap.get(yearNum) || 0 + : yrData.raw; + const displayVal = currentMode === 'normalized' ? val.toFixed(2) : val.toLocaleString(); let contributionStr = ''; - if (currentMode === 'total') { + if (currentMode === 'total' || currentMode === 'cumulative') { if (entity.entity_type === 'institution') { const instCountryCode = entity.country_code?.toUpperCase(); @@ -222,7 +214,20 @@ export class UniTrendChartComponent { selectedTopic ]?.find((y: TopicYearlyData) => y.year === yearNum); if (parentYr && parentYr.raw > 0) { - const pct = (yrData.raw / parentYr.raw) * 100; + const parentCumulativeSum = + parentCountry.topic_data[selectedTopic] + ?.filter((y) => y.year <= yearNum) + .reduce((sum, y) => sum + y.raw, 0) || 0; + const instCumulativeSum = + cumulativeSumMap.get(yearNum) || 0; + const pct = + currentMode === 'cumulative' + ? parentCumulativeSum > 0 + ? (instCumulativeSum / parentCumulativeSum) * 100 + : 0 + : parentYr.raw > 0 + ? (yrData.raw / parentYr.raw) * 100 + : 0; contributionStr = ` (${pct.toFixed(1)}% of ${parentCountry.entity_name})`; } } else if (parentContinent) { @@ -230,7 +235,20 @@ export class UniTrendChartComponent { selectedTopic ]?.find((y: TopicYearlyData) => y.year === yearNum); if (parentYr && parentYr.raw > 0) { - const pct = (yrData.raw / parentYr.raw) * 100; + const parentCumulativeSum = + parentContinent.topic_data[selectedTopic] + ?.filter((y) => y.year <= yearNum) + .reduce((sum, y) => sum + y.raw, 0) || 0; + const instCumulativeSum = + cumulativeSumMap.get(yearNum) || 0; + const pct = + currentMode === 'cumulative' + ? parentCumulativeSum > 0 + ? (instCumulativeSum / parentCumulativeSum) * 100 + : 0 + : parentYr.raw > 0 + ? (yrData.raw / parentYr.raw) * 100 + : 0; contributionStr = ` (${pct.toFixed(1)}% of ${parentContinent.entity_name})`; } } else { @@ -249,83 +267,6 @@ export class UniTrendChartComponent { contributionStr = ` (${pct.toFixed(1)}% of compared institutions)`; } } - } else if (entity.entity_type === 'country') { - const countryCode = entity.entity_id.toUpperCase(); - - const parentContinent = trendData.series.find( - (s: TrendSeries) => { - if (s.entity_type !== 'region') return false; - const memberCountries = - trendData.location_mappings?.[s.entity_id] || []; - return memberCountries.some( - (c: string) => c.toUpperCase() === countryCode, - ); - }, - ); - - const childInstsSum = trendData.series - .filter( - (s: TrendSeries) => - s.entity_type === 'institution' && - s.country_code?.toUpperCase() === countryCode, - ) - .reduce((sum: number, s: TrendSeries) => { - const y = s.topic_data[selectedTopic]?.find( - (yd: TopicYearlyData) => yd.year === yearNum, - ); - return sum + (y ? y.raw : 0); - }, 0); - - const remainingVal = Math.max(0, yrData.raw - childInstsSum); - const remainingPct = (remainingVal / yrData.raw) * 100; - - if (parentContinent) { - const parentYr = parentContinent.topic_data[ - selectedTopic - ]?.find((y: TopicYearlyData) => y.year === yearNum); - if (parentYr && parentYr.raw > 0) { - const pct = (yrData.raw / parentYr.raw) * 100; - contributionStr = ` (${pct.toFixed(1)}% of ${parentContinent.entity_name})`; - } - } - - if (childInstsSum > 0) { - contributionStr += `
(excl. compared institutions: ${remainingVal.toLocaleString()} / ${remainingPct.toFixed(1)}%)`; - } - } else if (entity.entity_type === 'region') { - const continentId = entity.entity_id; - const memberCountries = - trendData.location_mappings?.[continentId] || []; - - const childSum = trendData.series - .filter((s: TrendSeries) => { - if (s.entity_type === 'country') { - return memberCountries.some( - (c: string) => - c.toUpperCase() === s.entity_id.toUpperCase(), - ); - } - if (s.entity_type === 'institution') { - return memberCountries.some( - (c: string) => - c.toUpperCase() === s.country_code?.toUpperCase(), - ); - } - return false; - }) - .reduce((sum: number, s: TrendSeries) => { - const y = s.topic_data[selectedTopic]?.find( - (yd: TopicYearlyData) => yd.year === yearNum, - ); - return sum + (y ? y.raw : 0); - }, 0); - - const remainingVal = Math.max(0, yrData.raw - childSum); - const remainingPct = (remainingVal / yrData.raw) * 100; - - if (childSum > 0) { - contributionStr = `
(excl. compared elements: ${remainingVal.toLocaleString()} / ${remainingPct.toFixed(1)}%)`; - } } } @@ -339,10 +280,14 @@ export class UniTrendChartComponent { }, }, legend: { - bottom: 5, - left: 'center', + orient: 'vertical', + right: 10, + top: 'middle', type: 'scroll', textStyle: { color: '#4b5563' }, + formatter: (name: string) => { + return name.length > 22 ? name.substring(0, 20) + '...' : name; + }, }, axisPointer: { link: [{ xAxisIndex: 'all' }], @@ -350,16 +295,16 @@ export class UniTrendChartComponent { }, grid: [ { - left: '6%', - right: '8%', - top: '12%', - height: '52%', + left: 60, + right: 220, + top: 60, + height: 250, }, { - left: '6%', - right: '8%', - top: '73%', - height: '14%', + left: 60, + right: 220, + top: 360, + height: 70, }, ], xAxis: [ @@ -405,26 +350,11 @@ export class UniTrendChartComponent { axisTick: { show: false }, splitLine: { show: false }, }, - { - scale: true, - gridIndex: 1, - position: 'right', - axisLabel: { color: '#9ca3af', show: true }, - axisLine: { lineStyle: { color: '#e5e7eb' } }, - splitLine: { show: false }, - }, ], - brush: { - toolbox: ['rect', 'lineX', 'clear'], - xAxisIndex: 'all', - brushLink: 'all', - outOfBrush: { colorAlpha: 0.15 }, - }, toolbox: { left: 'right', top: 'top', feature: { - brush: { type: ['rect', 'lineX', 'clear'] }, saveAsImage: { title: 'Save' }, }, }, From a464a95c4e430990d1caad61102ded24f1848416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 5 Jul 2026 00:19:06 +0200 Subject: [PATCH 69/92] fix(frontend/organizations): unfucked everything (again) --- webapp/src/app/app.routes.ts | 10 +- .../organization-dialog.component.ts | 28 ++-- .../organizations.component.html | 123 +++++----------- .../organizations.component.scss | 82 +---------- .../organizations/organizations.component.ts | 137 ++++++++++++------ ....ts => accounts-organizations.resolver.ts} | 2 +- .../organizations-organizations.resolver.ts | 12 ++ .../organization-management.service.ts | 75 ---------- 8 files changed, 171 insertions(+), 298 deletions(-) rename webapp/src/app/resolvers/{organizations.resolver.ts => accounts-organizations.resolver.ts} (85%) create mode 100644 webapp/src/app/resolvers/organizations-organizations.resolver.ts delete mode 100644 webapp/src/app/shared/services/organization-management.service.ts diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 940130e3..ac603aae 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -20,7 +20,8 @@ import { publicationResolver } from './resolvers/publication-resolver'; import { accountResolver } from './resolvers/account.resolver'; import { accountViewerGuard } from './shared/guards/account-viewer.guard'; import { accountsPageResolver } from './resolvers/accounts-page.resolver'; -import { organizationsResolver } from './resolvers/organizations.resolver'; +import { accountsOrganizationResolver } from './resolvers/accounts-organizations.resolver'; +import { organizationsOrganizationsResolver } from './resolvers/organizations-organizations.resolver'; export const routes: Routes = [ { @@ -117,7 +118,7 @@ export const routes: Routes = [ ), resolve: { accountPage: accountsPageResolver, - organizations: organizationsResolver, + organizations: accountsOrganizationResolver, }, runGuardsAndResolvers: 'always', }, @@ -128,7 +129,12 @@ export const routes: Routes = [ import('./modules/organizations/organizations.component').then( (mod) => mod.OrganizationsComponent, ), + resolve: { + organizationPage: organizationsOrganizationsResolver, + }, + runGuardsAndResolvers: 'always', }, + { path: 'news/:id', canActivate: [userGuard], diff --git a/webapp/src/app/modules/organizations/organization-dialog/organization-dialog.component.ts b/webapp/src/app/modules/organizations/organization-dialog/organization-dialog.component.ts index 6348c11f..a192c306 100644 --- a/webapp/src/app/modules/organizations/organization-dialog/organization-dialog.component.ts +++ b/webapp/src/app/modules/organizations/organization-dialog/organization-dialog.component.ts @@ -16,15 +16,22 @@ import { import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; -import type { - CreateOrganizationPayload, - OrganizationProfile, - UpdateOrganizationPayload, -} from '../../../shared/services/organization-management.service'; +import { InseOrganizationManagementModelOrganizationProfile } from '../../../api'; + +export interface CreateOrganizationPayload { + name: string; + other_inst_id?: string | null; +} + +export interface UpdateOrganizationPayload { + name?: string; + other_inst_id?: string | null; + deleted?: boolean; +} export interface OrganizationDialogData { mode: 'create' | 'edit'; - organization?: OrganizationProfile; + organization?: InseOrganizationManagementModelOrganizationProfile; } export type OrganizationDialogResult = @@ -66,10 +73,9 @@ export class OrganizationDialogComponent { nonNullable: true, validators: [Validators.required], }), - otherInstId: new FormControl( - this.data.organization?.other_inst_id ?? '', - { nonNullable: true }, - ), + otherInstId: new FormControl(this.data.organization?.other_inst_id ?? '', { + nonNullable: true, + }), deleted: new FormControl(this.data.organization?.deleted ?? false, { nonNullable: true, }), @@ -100,6 +106,6 @@ export class OrganizationDialogComponent { } protected close(): void { - this.dialogRef.close(undefined); + this.dialogRef.close(); } } diff --git a/webapp/src/app/modules/organizations/organizations.component.html b/webapp/src/app/modules/organizations/organizations.component.html index a6486b74..14853ec0 100644 --- a/webapp/src/app/modules/organizations/organizations.component.html +++ b/webapp/src/app/modules/organizations/organizations.component.html @@ -3,6 +3,7 @@

Organisationen

Mandanten, externe Institutions-IDs und Status verwalten.

+
-
-
- {{ total }} Organisationen - @if (isLoading) { - Wird geladen... - } -
- -
- - - - - - - - - - - - @for (organization of organizations; track organization.id) { - - - - - - - - } @empty { - - - - } - -
NameExterne Institutions-IDMitgliederStatusAktionen
- - {{ organization.other_inst_id || '–' }}{{ organization.member_count }} - - {{ organization.deleted ? 'deleted' : 'active' }} - - -
- - -
-
Keine Organisationen gefunden.
-
- - -
+ + + + + + + + + + {{ (row.deleted ? 'inactive' : 'active') | status }} + + + + +
+ + +
+
diff --git a/webapp/src/app/modules/organizations/organizations.component.scss b/webapp/src/app/modules/organizations/organizations.component.scss index b558f858..e455d7e3 100644 --- a/webapp/src/app/modules/organizations/organizations.component.scss +++ b/webapp/src/app/modules/organizations/organizations.component.scss @@ -5,15 +5,9 @@ padding: 24px; } -.page-header, -.table-header, -.pagination, -.row-actions { +.page-header { display: flex; align-items: center; -} - -.page-header { justify-content: space-between; gap: 16px; } @@ -32,60 +26,6 @@ p { margin-top: 6px; } -.table-panel { - overflow: hidden; - border: 1px solid #d7dde6; - border-radius: 8px; - background: #fff; -} - -.table-header { - justify-content: space-between; - padding: 16px; - border-bottom: 1px solid #e5e7eb; -} - -.table-wrap { - overflow-x: auto; -} - -table { - width: 100%; - border-collapse: collapse; -} - -th, -td { - padding: 12px 16px; - text-align: left; - border-bottom: 1px solid #edf1f7; - white-space: nowrap; -} - -th { - color: #475569; - font-weight: 700; - background: #f8fafc; -} - -tr.deleted { - color: #94a3b8; -} - -.identifier { - font-family: monospace; - font-size: 12px; -} - -.link-button { - border: 0; - background: transparent; - color: #1d4ed8; - padding: 0; - font: inherit; - cursor: pointer; -} - .status { display: inline-flex; align-items: center; @@ -103,21 +43,6 @@ tr.deleted { color: #991b1b; } -.row-actions { - gap: 4px; -} - -.empty { - color: #64748b; - text-align: center; -} - -.pagination { - justify-content: flex-end; - gap: 8px; - padding: 12px 16px; -} - @media (max-width: 640px) { .organizations-page { padding: 16px; @@ -128,3 +53,8 @@ tr.deleted { flex-direction: column; } } + +mat-card, +mat-paginator { + background-color: var(--sg-background); +} diff --git a/webapp/src/app/modules/organizations/organizations.component.ts b/webapp/src/app/modules/organizations/organizations.component.ts index 0d061c50..6cbaecb4 100644 --- a/webapp/src/app/modules/organizations/organizations.component.ts +++ b/webapp/src/app/modules/organizations/organizations.component.ts @@ -1,19 +1,34 @@ import { CommonModule } from '@angular/common'; -import { Component, OnInit, inject } from '@angular/core'; +import { + Component, + inject, + input, + OnInit, + TemplateRef, + viewChild, +} from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { MatIconModule } from '@angular/material/icon'; import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; -import { finalize } from 'rxjs'; -import { - OrganizationManagementService, - OrganizationProfile, -} from '../../shared/services/organization-management.service'; import type { OrganizationDialogComponent, OrganizationDialogData, OrganizationDialogResult, } from './organization-dialog/organization-dialog.component'; +import { + InseOrganizationManagementModelOrganizationProfile, + OrganizationPage, + OrganizationService, +} from '../../api'; +import { + GenericColumn, + DataTableComponent, +} from '../../shared/ui/data-table/data-table.component'; +import { MatCardModule } from '@angular/material/card'; +import { StatusPipe } from '../../shared/pipes/status.pipe'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; +import { Router } from '@angular/router'; @Component({ selector: 'app-organizations', @@ -23,50 +38,81 @@ import type { MatDialogModule, MatIconModule, MatSnackBarModule, + DataTableComponent, + MatCardModule, + StatusPipe, + QueryParamPaginatorComponent, ], templateUrl: './organizations.component.html', styleUrl: './organizations.component.scss', standalone: true, }) export class OrganizationsComponent implements OnInit { - private readonly organizationService = inject(OrganizationManagementService); + private readonly router = inject(Router); private readonly dialog = inject(MatDialog); private readonly snackBar = inject(MatSnackBar); + private readonly organizationService = inject(OrganizationService); - protected organizations: OrganizationProfile[] = []; - protected total = 0; - protected page = 0; - protected readonly pageSize = 10; - protected isLoading = false; + organizationPage = input.required(); + organizationColumns: GenericColumn[] = + []; + + organizationStatusTmp = viewChild.required>( + 'organizationStatusTmp', + ); + organizationActionsTmp = viewChild.required>( + 'organizationActionsTmp', + ); ngOnInit(): void { - this.loadOrganizations(); - } - - protected loadOrganizations(page = this.page): void { - this.page = page; - this.isLoading = true; - this.organizationService - .getOrganizations(page, this.pageSize) - .pipe(finalize(() => (this.isLoading = false))) - .subscribe({ - next: (result) => { - this.organizations = result.items; - this.total = result.total; - }, - error: () => this.showError('Organisationen konnten nicht geladen werden.'), - }); + this.organizationColumns = [ + { + id: 'name', + header: 'Name', + type: 'accessor', + accessorKey: 'name', + }, + { + id: 'other_inst_id', + header: 'Externe ID', + type: 'accessor', + accessorKey: 'other_inst_id', + }, + { + id: 'member_count', + header: 'Mitglieder', + type: 'accessor', + accessorKey: 'member_count', + }, + { + id: 'deleted', + header: 'Status', + type: 'accessor', + accessorKey: 'deleted', + cellTemplate: this.organizationStatusTmp(), + }, + { + id: 'actions', + header: 'Aktionen', + type: 'display', + cellTemplate: this.organizationActionsTmp(), + }, + ]; } protected startCreate(): void { this.openDialog({ mode: 'create' }); } - protected startEdit(organization: OrganizationProfile): void { + protected startEdit( + organization: InseOrganizationManagementModelOrganizationProfile, + ): void { this.openDialog({ mode: 'edit', organization }); } - protected deleteOrganization(organization: OrganizationProfile): void { + protected deleteOrganization( + organization: InseOrganizationManagementModelOrganizationProfile, + ): void { if (organization.deleted) return; import('../../shared/ui/confirmation-dialog/confirmation-dialog.component').then( @@ -87,26 +133,24 @@ export class OrganizationsComponent implements OnInit { ); } - private softDeleteOrganization(organization: OrganizationProfile): void { - this.organizationService.deleteOrganization(organization.id).subscribe({ + private softDeleteOrganization( + organization: InseOrganizationManagementModelOrganizationProfile, + ): void { + this.organizationService.deleteOrganisation(organization.id).subscribe({ next: () => { this.snackBar.open('Organisation wurde deaktiviert.', 'OK', { duration: 3000, }); - this.loadOrganizations(); + this.router.navigate([], { + queryParams: { page: 0 }, + queryParamsHandling: 'merge', + }); }, - error: () => this.showError('Organisation konnte nicht deaktiviert werden.'), + error: () => + this.showError('Organisation konnte nicht deaktiviert werden.'), }); } - protected get canPageBack(): boolean { - return this.page > 0; - } - - protected get canPageForward(): boolean { - return (this.page + 1) * this.pageSize < this.total; - } - private openDialog(data: OrganizationDialogData): void { import('./organization-dialog/organization-dialog.component').then( ({ OrganizationDialogComponent }) => { @@ -130,8 +174,8 @@ export class OrganizationsComponent implements OnInit { private save(result: OrganizationDialogResult): void { const request = result.mode === 'create' - ? this.organizationService.createOrganization(result.payload) - : this.organizationService.updateOrganization( + ? this.organizationService.createOrganisation(result.payload) + : this.organizationService.updateOrganisation( result.organizationId, result.payload, ); @@ -141,7 +185,10 @@ export class OrganizationsComponent implements OnInit { this.snackBar.open('Organisation wurde gespeichert.', 'OK', { duration: 3000, }); - this.loadOrganizations(0); + this.router.navigate([], { + queryParams: { page: 0 }, + queryParamsHandling: 'merge', + }); }, error: (error) => this.showError( diff --git a/webapp/src/app/resolvers/organizations.resolver.ts b/webapp/src/app/resolvers/accounts-organizations.resolver.ts similarity index 85% rename from webapp/src/app/resolvers/organizations.resolver.ts rename to webapp/src/app/resolvers/accounts-organizations.resolver.ts index 258d646c..8fb026c9 100644 --- a/webapp/src/app/resolvers/organizations.resolver.ts +++ b/webapp/src/app/resolvers/accounts-organizations.resolver.ts @@ -5,7 +5,7 @@ import { InseAccountManagementModelOrganizationProfile, } from '../api'; -export const organizationsResolver: ResolveFn< +export const accountsOrganizationResolver: ResolveFn< InseAccountManagementModelOrganizationProfile[] > = (route, state) => { return inject(AuthService).listAccountOrganizations(); diff --git a/webapp/src/app/resolvers/organizations-organizations.resolver.ts b/webapp/src/app/resolvers/organizations-organizations.resolver.ts new file mode 100644 index 00000000..70297dee --- /dev/null +++ b/webapp/src/app/resolvers/organizations-organizations.resolver.ts @@ -0,0 +1,12 @@ +import { inject } from '@angular/core'; +import { ResolveFn } from '@angular/router'; +import { OrganizationPage, OrganizationService } from '../api'; + +export const organizationsOrganizationsResolver: ResolveFn< + OrganizationPage +> = (route, state) => { + const page = Number(route.queryParamMap.get('page') ?? '0'); + const size = Number(route.queryParamMap.get('size') ?? '10'); + + return inject(OrganizationService).getOrganisations(page, size); +}; diff --git a/webapp/src/app/shared/services/organization-management.service.ts b/webapp/src/app/shared/services/organization-management.service.ts deleted file mode 100644 index 9597a005..00000000 --- a/webapp/src/app/shared/services/organization-management.service.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { HttpClient, HttpParams } from '@angular/common/http'; -import { Injectable, inject } from '@angular/core'; -import { Observable } from 'rxjs'; -import { Configuration } from '../../api'; - -export interface OrganizationProfile { - id: string; - name: string; - other_inst_id?: string | null; - deleted: boolean; - member_count: number; -} - -export interface OrganizationPage { - items: OrganizationProfile[]; - total: number; - page: number; - page_size: number; -} - -export interface CreateOrganizationPayload { - name: string; - other_inst_id?: string | null; -} - -export interface UpdateOrganizationPayload { - name?: string; - other_inst_id?: string | null; - deleted?: boolean; -} - -@Injectable({ providedIn: 'root' }) -export class OrganizationManagementService { - private readonly httpClient = inject(HttpClient); - private readonly apiConfiguration = inject(Configuration, { optional: true }); - - getOrganizations(page: number, pageSize: number): Observable { - const params = new HttpParams() - .set('page', page) - .set('page_size', pageSize); - return this.httpClient.get( - `${this.apiBasePath}/api/organizations`, - { params }, - ); - } - - createOrganization( - payload: CreateOrganizationPayload, - ): Observable { - return this.httpClient.post( - `${this.apiBasePath}/api/organizations`, - payload, - ); - } - - updateOrganization( - organizationId: string, - payload: UpdateOrganizationPayload, - ): Observable { - return this.httpClient.put( - `${this.apiBasePath}/api/organizations/${organizationId}`, - payload, - ); - } - - deleteOrganization(organizationId: string): Observable { - return this.httpClient.delete( - `${this.apiBasePath}/api/organizations/${organizationId}`, - ); - } - - private get apiBasePath(): string { - return this.apiConfiguration?.basePath ?? ''; - } -} From 73315457a6403c927998dea98ccd138dd6034d78 Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 02:19:38 +0200 Subject: [PATCH 70/92] fixed resonsiveness issue --- .../ui/topic-autocomplete/topic-autocomplete.component.html | 1 + .../ui/topic-autocomplete/topic-autocomplete.component.scss | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html index e7a2f20f..d23c2dc0 100644 --- a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html @@ -9,6 +9,7 @@ (click)="$event.preventDefault()" (keydown.enter)="submitCurrentValue(); $event.preventDefault()" (keydown.tab)="onKeydownTab($any($event))" /> + Füge ein Keyword hinzu @if (searchControl.value.trim()) { + } @else { + + } +
+
+ + + + text_fields + Extrahierte Keywords + + + account_tree + Topic Mapping + + +
+ +
+ +
+ +
+ +
+ + } +
Breite Keywords
Coarse Keywords
-
Fine Keywords
+
+ Fine Keywords +
Eigene Keywords
@@ -70,121 +151,146 @@
@if (broadKeywords().length > 0) { - - @for (keyword of broadKeywords(); track keyword) { - - {{ keyword }} - +
+ + @for ( + keyword of broadKeywords(); + track keyword.llm_keyword.keyword + ) { + + } - +
} @else { -

–

+

Nichts extrahiert

}
@if (coarseKeywords().length > 0) { - - @for (keyword of coarseKeywords(); track keyword) { - - {{ keyword }} - +
+ @for ( + keyword of coarseKeywords(); + track keyword.llm_keyword.keyword + ) { + + } - +
} @else { -

–

+

Nichts extrahiert

}
@if (fineKeywords().length > 0) { - - @for (keyword of fineKeywords(); track keyword) { - - {{ keyword }} - +
+ @for ( + keyword of fineKeywords(); + track keyword.llm_keyword.keyword + ) { + + } - +
} @else { -

–

+

Nichts extrahiert

}
-
- - +
@if (manualKeywords().length > 0) { - @for (keyword of manualKeywords(); track keyword) { - - {{ keyword }} - cancel - + @for ( + keyword of manualKeywords(); + track keyword.llm_keyword.keyword + ) { +
+ + + +
} + } @else if (loadingNewKeyword()) { +
+ + +
+ } @else { +

Nichts hinzugefügt

} - +
- - @if (extractedKeywordsExist()) { -
- @if (areAllExtractedSelected()) { - - } @else { - - } - -
- } - @if (isExtracting()) {
search diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index 3162536f..d92e54be 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -6,25 +6,135 @@ } .tab-content { - padding: 0.5rem 0; display: grid; + margin-top: 0.5rem; grid-template-columns: 5fr 1fr; gap: 0.5rem; + align-items: start; } - .full-width { width: 100%; } +.extract-btn { + white-space: nowrap; +} + .actions { display: flex; justify-content: center; } +.keywords-toolbar { + display: flex; + flex-direction: column; + background: var(--sg-background-muted, #f4f5f7); + + ::ng-deep app-topic-legend .topic-legend { + width: 100%; + margin: 0; + } +} + +.toolbar-controls { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + flex-wrap: wrap; + padding: 0.5rem 0.75rem; + background: var(--sg-background-muted, #f4f5f7); +} +.toolbar-wrapper { + display: grid; + grid-template-columns: 3fr 1.3fr; + border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); +} +.toolbar-group { + display: flex; + align-items: center; + gap: 0.6rem; +} + +.toolbar-group--select button { + display: flex; + align-items: center; + gap: 0.35rem; + font-size: 0.8rem; + line-height: 30px; + border-radius: 20px; + padding: 0 14px; + + mat-icon { + font-size: 20px; + width: 20px; + height: 20px; + } +} + +.toolbar-divider { + width: 1px; + align-self: stretch; + background: var(--sg-divider, rgba(0, 0, 0, 0.12)); + display: none; +} + +@media (min-width: 640px) { + .toolbar-divider { + display: block; + } +} + +mat-button-toggle-group { + border-radius: 20px; + overflow: hidden; +} + +/* Tablet / phone: stack the toolbar and go full-width */ +@media (max-width: 768px) { + .toolbar-controls { + flex-direction: column; + align-items: stretch; + } + + .toolbar-group { + justify-content: center; + } + + .toolbar-group--select button { + width: 100%; + justify-content: center; + } + + .toolbar-group--view { + justify-content: center; + } +} + +/* Phone: icon-only buttons to save space */ +@media (max-width: 480px) { + .btn-label { + display: none; + } + + .toolbar-group--select button { + width: auto; + padding: 0 10px; + } +} +mat-button-toggle-group { + flex-wrap: wrap; +} + +.toggle-text { + margin-left: 0.35rem; +} + .extraction-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; + border: 0; } .keyword-card { @@ -44,22 +154,23 @@ .keyword-table { display: flex; flex-direction: column; - gap: 0.5rem; - margin: 0.5rem 0; } .table-head { + border-top: 2px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); + padding-top: 0.5rem; display: grid; grid-template-columns: repeat(3, 1fr) 1.3fr; grid-template-rows: auto; column-gap: 1rem; border-bottom: 2px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); padding-bottom: 0.5rem; + background: var(--sg-background-muted, #f4f5f7); } .head-cell { min-width: 0; - text-align: center; /* Center header text */ + text-align: center; } .extracted-header { @@ -71,21 +182,6 @@ align-self: end; } -.own-header { - grid-column: 4; - grid-row: 1 / span 2; - display: flex; - flex-direction: column; - gap: 0.35rem; -} - -.own-header-title { - font-size: 0.95rem; - font-weight: 600; - color: var(--sg-text-primary); - text-align: center; /* Center own header title */ -} - .sub-cell { font-weight: 500; color: var(--sg-text-secondary); @@ -94,7 +190,7 @@ letter-spacing: 0.05em; align-self: end; grid-row: 2; - text-align: center; /* Center sub-cell text */ + text-align: center; } .broad-sub { @@ -109,6 +205,7 @@ .manual-sub { grid-column: 4; } + .keyword-input-row { margin-left: 0.5rem; width: 100%; @@ -121,30 +218,23 @@ &.compact { .small-field { flex: 10; - // collapse the outline field to a compact, chip-like height ::ng-deep .mat-mdc-text-field-wrapper { padding: 0 0.6rem; } - ::ng-deep .mat-mdc-form-field-flex { min-height: 8px; align-items: center; } - ::ng-deep .mat-mdc-form-field-infix { min-height: 8px; padding: 1rem 0; } - - // hide the hint/error subscript strip to remove extra height ::ng-deep .mat-mdc-form-field-subscript-wrapper { display: none; } - ::ng-deep input.mat-mdc-input-element { font-size: 0.8rem; } - ::ng-deep .mat-mdc-form-field-label, ::ng-deep mat-label { font-size: 1rem; @@ -159,15 +249,10 @@ flex: 1; .mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - line-height: 18px; - } - - ::ng-deep .mat-mdc-button-touch-target { - width: 28px; - height: 28px; + font-size: 26px; + width: 26px; + height: 26px; + line-height: 26px; } } } @@ -179,10 +264,10 @@ column-gap: 1rem; row-gap: 0.4rem; align-items: start; - border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Left border for columns */ + border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + //background: var(--sg-background-muted, #f4f5f7); } -/* Add vertical separators between columns */ .table-col { display: flex; flex-direction: column; @@ -195,16 +280,44 @@ border-right: none; } &:nth-child(3) { - border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.1)); } - mat-chip-listbox { + ::ng-deep app-topic-chip { width: 100%; - margin-top: 0.5rem; + } + + ::ng-deep app-topic-chip:not(.topic-chip--active) { + width: 100%; + opacity: 0.4; + } +} +.thick-border { + border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.1)); +} +.keyword-chip-stack { + display: flex; + flex-direction: column; + gap: 0.5rem; + margin-top: 0.5rem; + width: 100%; +} + +.manual-chip-row { + display: flex; + align-items: center; + width: 100%; + + app-topic-chip { + flex: 1 1 auto; + min-width: 0; + } + + button[mat-icon-button] { + flex: 0 0 auto; } } -/* Make chips removable and add hover effect */ .compact-chip { font-size: 1rem; padding: 0.2rem 0.6rem; @@ -215,11 +328,9 @@ animation: popIn 0.2s ease-in-out; cursor: default; - // Add removable indicator and hover effect &.mat-mdc-chip-option { .mat-mdc-chip-action { padding: 0 4px; - .mat-mdc-chip-action-label { padding: 0 4px; display: flex; @@ -227,8 +338,6 @@ gap: 4px; } } - - // Show remove button on hover for removable chips &:hover { ::ng-deep .mat-mdc-chip-remove { opacity: 1; @@ -236,7 +345,6 @@ } } - // Style for removable chips ::ng-deep .mat-mdc-chip-remove { opacity: 0; transition: opacity 0.2s ease; @@ -287,17 +395,19 @@ display: flex; flex-wrap: wrap; gap: 0.5rem; - justify-content: flex-end; + justify-content: space-between; margin-top: 0.5rem; button { + display: flex; + justify-content: center; font-size: 0.75rem; padding: 0 12px; line-height: 30px; mat-icon { - font-size: 18px; - width: 18px; - height: 18px; + font-size: 26px; + width: 26px; + height: 26px; } } } @@ -308,13 +418,77 @@ margin-top: 0.5rem; } -/* Responsive: stack columns on small screens */ +/* ============================================================ + RESPONSIVE BREAKPOINTS + ============================================================ */ + +/* Tablet: soften columns, keep 4 columns but tighter */ +@media (max-width: 1024px) { + .table-head, + .table-body { + column-gap: 0.5rem; + } + + .table-col { + padding: 0.4rem; + } + + .compact-chip { + width: 100%; + } +} + +/* Small tablet / large phone: stack columns */ @media (max-width: 768px) { + .content { + padding: 0.75rem; + } + + .tab-content { + grid-template-columns: 1fr; + } + + .extract-btn { + width: 100%; + justify-content: center; + } + .table-head, .table-body { grid-template-columns: 1fr; } + .table-head { + display: none; /* labels are redundant once stacked; see column titles below */ + } + + .table-col { + border-right: none; + border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + padding: 0.75rem 0.25rem; + + &:nth-child(3) { + border-right: none; + border-bottom: 3px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + } + + &:last-child { + border-bottom: none; + } + + /* Re-introduce a column label since .table-head is hidden */ + &::before { + content: attr(data-col-label); + font-weight: 500; + font-size: 0.85rem; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--sg-text-secondary); + margin-bottom: 0.35rem; + display: block; + } + } + .extracted-header { grid-column: 1; grid-row: 1; @@ -325,37 +499,66 @@ grid-row: 2; } - .broad-sub { - grid-column: 1; - grid-row: 3; - } - .coarse-sub { - grid-column: 1; - grid-row: 4; - } - .fine-sub { - grid-column: 1; - grid-row: 5; - } - .actions { align-self: center; justify-content: flex-start; } - .search-container { - justify-content: flex-start; + .search-container, + .select-all-container { + justify-content: stretch; + flex-direction: column; } - .table-col { - border-right: none; /* Remove column borders on mobile */ - border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + .search-btn, + .select-all-container button { + width: 100%; + } - &:last-child { - border-bottom: none; + .view-toggle-row { + justify-content: center; + text-align: center; + } + + mat-button-toggle-group { + width: 100%; + + ::ng-deep .mat-button-toggle { + flex: 1; } } } + +/* Phone: tighten further, reduce chip/font sizes */ +@media (max-width: 480px) { + .content { + padding: 0.5rem; + gap: 0.5rem; + } + + .keyword-card { + padding: 0.35rem; + } + + .sub-cell, + .toggle-text { + font-size: 0.8rem; + } + + .compact-chip { + font-size: 0.85rem; + min-height: 24px; + } + + .empty-state { + font-size: 0.8rem; + } + + .status-message { + font-size: 0.8rem; + } +} + /* Source expansion panel */ .source-expansion { margin: 0.75rem 0; @@ -406,22 +609,19 @@ background: rgba(0, 0, 0, 0.03); } } + .progress-container { margin-top: 1rem; padding: 0.5rem 0; - // Make the progress bar container relative for the shimmer overlay mat-progress-bar { position: relative; - overflow: hidden; // keeps the shimmer inside the bar + overflow: hidden; - // --- Set the bar fill to a constant blue --- - // Using the primary blue (adjust to your preferred "hell blue") ::ng-deep .mat-progress-bar-fill::after { - background-color: #2196f3; // bright blue + background-color: #2196f3; } - // --- Shimmer overlay (a moving highlight) --- &::after { content: ''; position: absolute; @@ -429,7 +629,7 @@ left: 0; width: 100%; height: 100%; - pointer-events: none; // allow clicks to pass through + pointer-events: none; background: linear-gradient( 105deg, transparent 0%, diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 03a02061..e2dcc526 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -9,7 +9,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; -import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; import { MatDividerModule } from '@angular/material/divider'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; @@ -28,10 +27,27 @@ import { TopicsService } from '../../api/api/topics.service'; import { KeywordsTopicsRequest } from '../../api/model/keywordsTopicsRequest'; import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/topic-autocomplete.component'; - +import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; +import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component'; +import { Topic } from '../../api/model/topic'; +import { + MatButtonToggleModule, + MatButtonToggleGroup, +} from '@angular/material/button-toggle'; +import { + topicHierarchyColor, + TopicHierarchyColorInput, +} from '../../resolvers/utils/topic-colors'; +import { + buildTopicLegendGroups, + TopicLegendGroup, + TopicLegendTopic, +} from '../../resolvers/utils/topic-legend'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { A11yModule } from '@angular/cdk/a11y'; type InputMode = 'url' | 'text'; type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; - +type KeywordView = 'llm' | 'topic'; @Component({ selector: 'app-keywords-search', imports: [ @@ -41,12 +57,17 @@ type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; MatInputModule, MatButtonModule, MatIconModule, - MatChipsModule, MatDividerModule, MatCardModule, MatExpansionModule, MatProgressBarModule, TopicAutocompleteComponent, + TopicChipComponent, + TopicLegendComponent, + MatButtonToggleModule, + MatButtonToggleGroup, + MatTooltipModule, + A11yModule, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -67,50 +88,16 @@ export class KeywordsSearchComponent { private readonly fineKeywordEntries = signal([]); private readonly manualKeywordEntries = signal([]); - readonly broadKeywords = computed(() => - this.broadKeywordEntries().map((item) => this.getKeywordLabel(item)), - ); - readonly coarseKeywords = computed(() => - this.coarseKeywordEntries().map((item) => this.getKeywordLabel(item)), - ); - readonly fineKeywords = computed(() => - this.fineKeywordEntries().map((item) => this.getKeywordLabel(item)), - ); - readonly manualKeywords = computed(() => - this.manualKeywordEntries().map((item) => this.getKeywordLabel(item)), - ); + readonly broadKeywords = computed(() => this.broadKeywordEntries()); + readonly coarseKeywords = computed(() => this.coarseKeywordEntries()); + readonly fineKeywords = computed(() => this.fineKeywordEntries()); + readonly manualKeywords = computed(() => this.manualKeywordEntries()); readonly selectedKeywords = signal([]); readonly isExtracting = signal(false); + readonly loadingNewKeyword = signal(false); readonly extractionSource = signal(null); - // Single place mapping a category name to its label signal and its - // backing entries signal. Replaces four near-identical computed()s and - // a category switch statement that used to live below. - private readonly categoryKeywordsMap: Record< - KeywordCategory, - Signal - > = { - broad: this.broadKeywords, - coarse: this.coarseKeywords, - fine: this.fineKeywords, - manual: this.manualKeywords, - }; - private readonly categoryEntriesMap: Record< - KeywordCategory, - WritableSignal - > = { - broad: this.broadKeywordEntries, - coarse: this.coarseKeywordEntries, - fine: this.fineKeywordEntries, - manual: this.manualKeywordEntries, - }; - - readonly selectedBroadKeywords = this.selectedInCategory('broad'); - readonly selectedCoarseKeywords = this.selectedInCategory('coarse'); - readonly selectedFineKeywords = this.selectedInCategory('fine'); - readonly selectedManualKeywords = this.selectedInCategory('manual'); - readonly extractedKeywordsExist = computed( () => this.broadKeywords().length > 0 || @@ -133,6 +120,23 @@ export class KeywordsSearchComponent { readonly progress = signal(0); readonly statusMessage = signal(''); + readonly keywordView = signal('llm'); + readonly subfieldLegendVisible = signal(true); + readonly subfieldLegendExpanded = signal(false); + + get topicLegendGroups(): TopicLegendGroup[] { + const topics = [ + ...this.broadKeywordEntries(), + ...this.coarseKeywordEntries(), + ...this.fineKeywordEntries(), + ...this.manualKeywordEntries(), + ] + .map((entry) => entry.topic_mapping?.topic) + .filter((topic): topic is Topic => Boolean(topic)) + .map((topic) => this.toTopicLegendTopic(topic)); + + return buildTopicLegendGroups(topics); + } constructor( private readonly formBuilder: FormBuilder, @@ -188,6 +192,7 @@ export class KeywordsSearchComponent { this.handleStatusEvent(event); break; case 'keywords': + console.log(event.keywords); if (event.keywords) this.addExtractedKeyword(event.keywords); break; case 'completed': @@ -220,9 +225,12 @@ export class KeywordsSearchComponent { this.fineKeywordEntries.set([]); this.websocketService.close(); this.isExtracting.set(false); + this.loadingNewKeyword.set(false); // Keep manual, but remove selected that are not in manual this.selectedKeywords.set( - this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), + this.selectedKeywords().filter((k) => + this.getKeywordLabels(this.manualKeywords()).includes(k), + ), ); this.updateQueryParams(); } @@ -295,15 +303,17 @@ export class KeywordsSearchComponent { private keywordExists(keyword: string): boolean { const normalized = this.normalizeKeyword(keyword); return [ - ...this.broadKeywords(), - ...this.coarseKeywords(), - ...this.fineKeywords(), - ...this.manualKeywords(), + ...this.getKeywordLabels(this.broadKeywords()), + ...this.getKeywordLabels(this.coarseKeywords()), + ...this.getKeywordLabels(this.fineKeywords()), + ...this.getKeywordLabels(this.manualKeywords()), ].some((k) => this.normalizeKeyword(k) === normalized); } // Add manually from Keywords tab addKeywordFromInput(keyword: string): void { + this.loadingNewKeyword.set(true); + const normalizedKeyword = keyword.trim(); if (!normalizedKeyword) return; @@ -335,7 +345,7 @@ export class KeywordsSearchComponent { ...this.selectedKeywords(), normalizedKeyword, ]); - + this.loadingNewKeyword.set(false); // Explicit enrichment trigger for new keywords this.enrichManualKeywordsWithTopics([normalizedKeyword]); this.updateQueryParams(); @@ -350,29 +360,40 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - onCategoryChange( - category: KeywordCategory, - event: MatChipListboxChange, - ): void { - const newSelection = (event.value as string[]) || []; - const otherCategories = ( - Object.keys(this.categoryKeywordsMap) as KeywordCategory[] - ).filter((c) => c !== category); - const otherSelected = otherCategories.flatMap((c) => { - const keywords = this.categoryKeywordsMap[c](); - return this.selectedKeywords().filter((k) => keywords.includes(k)); - }); - const updated = [...otherSelected, ...newSelection]; - this.selectedKeywords.set(this.uniqueKeywords(updated)); + toggleKeywordSelection(keyword: KeywordEntryWithTopic): void { + const label = this.getKeywordLabel(keyword); + const nextSelection = this.selectedKeywords().includes(label) + ? this.selectedKeywords().filter((value) => value !== label) + : [...this.selectedKeywords(), label]; + + this.selectedKeywords.set(this.uniqueKeywords(nextSelection)); + this.updateQueryParams(); + } + + isKeywordSelected(keyword: KeywordEntryWithTopic): boolean { + const normalized = this.normalizeKeyword(this.getKeywordLabel(keyword)); + return this.selectedKeywords().some( + (value) => this.normalizeKeyword(value) === normalized, + ); + } + + removeManualKeyword(keyword: KeywordEntryWithTopic): void { + const label = this.getKeywordLabel(keyword); + this.manualKeywordEntries.set( + this.filterKeywordEntries(this.manualKeywordEntries(), label), + ); + this.selectedKeywords.set( + this.selectedKeywords().filter((value) => value !== label), + ); this.updateQueryParams(); } selectAllExtracted(): void { const all = [ - ...this.selectedManualKeywords(), - ...this.broadKeywords(), - ...this.coarseKeywords(), - ...this.fineKeywords(), + ...this.getKeywordLabels(this.manualKeywords()), + ...this.getKeywordLabels(this.broadKeywords()), + ...this.getKeywordLabels(this.coarseKeywords()), + ...this.getKeywordLabels(this.fineKeywords()), ]; this.selectedKeywords.set(this.uniqueKeywords(all)); this.updateQueryParams(); @@ -380,7 +401,7 @@ export class KeywordsSearchComponent { deselectAllExtracted(): void { this.selectedKeywords.set( - this.uniqueKeywords(this.selectedManualKeywords()), + this.uniqueKeywords(this.getKeywordLabels(this.manualKeywords())), ); this.updateQueryParams(); } @@ -393,7 +414,7 @@ export class KeywordsSearchComponent { this.sourceUrl.set(null); // Keep only selected keywords that are in the manual list - const manualSet = new Set(this.manualKeywords()); + const manualSet = new Set(this.getKeywordLabels(this.manualKeywords())); this.selectedKeywords.set( this.selectedKeywords().filter((k) => manualSet.has(k)), ); @@ -409,9 +430,9 @@ export class KeywordsSearchComponent { areAllExtractedSelected(): boolean { const allExtracted = [ - ...this.broadKeywords(), - ...this.coarseKeywords(), - ...this.fineKeywords(), + ...this.getKeywordLabels(this.broadKeywords()), + ...this.getKeywordLabels(this.coarseKeywords()), + ...this.getKeywordLabels(this.fineKeywords()), ]; return allExtracted.every((k) => this.selectedKeywords().includes(k)); } @@ -432,16 +453,6 @@ export class KeywordsSearchComponent { this.applyExtractedKeywords(keywords); } - onKeywordRemoved(category: KeywordCategory, keyword: string): void { - const entries = this.categoryEntriesMap[category]; - entries.set(this.filterKeywordEntries(entries(), keyword)); - - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => k !== keyword), - ); - this.updateQueryParams(); - } - processExtractedKeywords(result: ExtractedKeywordsResponse): void { if (result === undefined || !result.results) return; @@ -454,10 +465,10 @@ export class KeywordsSearchComponent { // Keep only selected keywords that still exist in any category (including manual) const allExtracted = [ - ...this.broadKeywords(), - ...this.coarseKeywords(), - ...this.fineKeywords(), - ...this.manualKeywords(), + ...this.getKeywordLabels(this.broadKeywords()), + ...this.getKeywordLabels(this.coarseKeywords()), + ...this.getKeywordLabels(this.fineKeywords()), + ...this.getKeywordLabels(this.manualKeywords()), ]; this.selectedKeywords.set( this.selectedKeywords().filter((k) => allExtracted.includes(k)), @@ -516,17 +527,11 @@ export class KeywordsSearchComponent { // --- Helpers -------------------------------------------------------------- - private selectedInCategory(category: KeywordCategory): Signal { - return computed(() => - this.selectedKeywords().filter((k) => - this.categoryKeywordsMap[category]().includes(k), - ), - ); - } - private applyExtractedKeywords(keywords: ExtractedKeywords): void { const seenKeywords = new Set( - this.manualKeywords().map((keyword) => this.normalizeKeyword(keyword)), + this.getKeywordLabels(this.manualKeywords()).map((keyword) => + this.normalizeKeyword(keyword), + ), ); this.broadKeywordEntries.set( this.uniqueKeywordEntries(keywords.broad_keywords, seenKeywords), @@ -572,8 +577,93 @@ export class KeywordsSearchComponent { ); } + onViewToggleChange(value: KeywordView): void { + if (this.keywordView() !== value) { + this.keywordView.set(value); + } + this.updateQueryParams(); + } + + onSubfieldLegendVisibleChange(visible: boolean): void { + this.subfieldLegendVisible.set(visible); + this.updateQueryParams(); + } + + onSubfieldLegendExpandedChange(expanded: boolean): void { + this.subfieldLegendExpanded.set(expanded); + this.updateQueryParams(); + } + + // Use this instead of directly binding keyword.topic_mapping?.topic?.display_name + getChipLabel(keyword: KeywordEntryWithTopic): string { + if (this.keywordView() == 'llm') { + return keyword.llm_keyword?.keyword ?? ''; + } + return ( + keyword.topic_mapping?.topic?.display_name ?? + keyword.llm_keyword?.keyword ?? + '' + ); + } private getKeywordLabel(item: KeywordEntryWithTopic): string { - return item.llm_keyword.keyword.trim(); + return item.llm_keyword.keyword; + } + + private getKeywordLabels(items: KeywordEntryWithTopic[]): string[] { + return items.map((item) => this.getKeywordLabel(item)); + } + + private getTopic(item: KeywordEntryWithTopic) { + return item.topic_mapping?.topic ?? null; + } + + getChipDescription(item: KeywordEntryWithTopic): string | null { + return this.getTopic(item)?.description ?? null; + } + + getChipSubfieldName(item: KeywordEntryWithTopic): string | null { + return this.getTopic(item)?.subfield?.display_name ?? null; + } + + getChipFieldName(item: KeywordEntryWithTopic): string | null { + return this.getTopic(item)?.field?.display_name ?? null; + } + + getChipDomainName(item: KeywordEntryWithTopic): string | null { + return this.getTopic(item)?.domain?.display_name ?? null; + } + + getChipCount(item: KeywordEntryWithTopic): number | null { + const topic = this.getTopic(item); + return topic?.works_count ?? null; + } + + private toTopicLegendTopic(topic: Topic): TopicLegendTopic { + return { + id: topic.id ?? topic.display_name ?? '', + name: topic.display_name ?? '', + field_id: topic.field?.id ?? null, + field_name: topic.field?.display_name ?? null, + field_description: null, + domain_id: topic.domain?.id ?? null, + domain_name: topic.domain?.display_name ?? null, + domain_description: null, + subfield_id: topic.subfield?.id ?? null, + subfield_name: topic.subfield?.display_name ?? null, + subfield_description: null, + }; + } + + getTopicColor(topic: Topic | undefined | null): string { + const topicInput: TopicHierarchyColorInput = { + id: topic?.id ?? null, + name: topic?.display_name ?? null, + field_id: topic?.field?.id ?? null, + field_name: topic?.field?.display_name ?? null, + domain_id: topic?.domain?.id ?? null, + domain_name: topic?.domain?.display_name ?? null, + }; + return topicHierarchyColor(topicInput); } private keywordEntriesFromStrings( @@ -621,6 +711,9 @@ export class KeywordsSearchComponent { const manual = this.parseKeywordList(queryParams.get('manual')); const selected = this.parseKeywordList(queryParams.get('selected')); const source = queryParams.get('source') ?? ''; + const view = queryParams.get('view') ?? 'llm'; + const legend = queryParams.get('legend') ?? 'on'; + const legendExpanded = queryParams.get('legendExpanded') ?? 'off'; this.isRestoringState = true; @@ -628,7 +721,9 @@ export class KeywordsSearchComponent { { selectedInputType: mode, urlInput, textInput }, { emitEvent: false }, ); - + this.keywordView.set(view as KeywordView); + this.subfieldLegendVisible.set(legend === 'on'); + this.subfieldLegendExpanded.set(legendExpanded === 'on'); this.extractionSource.set(source as InputMode); this.restoreSourceFromSession(); @@ -649,16 +744,24 @@ export class KeywordsSearchComponent { // clean up the selection to only include keywords that actually exist in const manualKeywordSet = new Set( - this.manualKeywords().map((k) => this.normalizeKeyword(k)), + this.getKeywordLabels(this.manualKeywords()).map((k) => + this.normalizeKeyword(k), + ), ); const broadKeywordSet = new Set( - this.broadKeywords().map((k) => this.normalizeKeyword(k)), + this.getKeywordLabels(this.broadKeywords()).map((k) => + this.normalizeKeyword(k), + ), ); const coarseKeywordSet = new Set( - this.coarseKeywords().map((k) => this.normalizeKeyword(k)), + this.getKeywordLabels(this.coarseKeywords()).map((k) => + this.normalizeKeyword(k), + ), ); const fineKeywordSet = new Set( - this.fineKeywords().map((k) => this.normalizeKeyword(k)), + this.getKeywordLabels(this.fineKeywords()).map((k) => + this.normalizeKeyword(k), + ), ); const validSelected = selected.filter( (k) => @@ -684,10 +787,19 @@ export class KeywordsSearchComponent { mode: this.form.controls.selectedInputType.value, url: this.toNullableParam(this.form.controls.urlInput.value), text: this.toNullableParam(this.form.controls.textInput.value), - broad: this.serializeKeywords(this.broadKeywords()), - coarse: this.serializeKeywords(this.coarseKeywords()), - fine: this.serializeKeywords(this.fineKeywords()), - manual: this.serializeKeywords(this.manualKeywords()), + view: this.keywordView(), + legend: this.subfieldLegendVisible() ? 'on' : 'off', + legendExpanded: this.subfieldLegendExpanded() ? 'on' : 'off', + broad: this.serializeKeywords( + this.getKeywordLabels(this.broadKeywords()), + ), + coarse: this.serializeKeywords( + this.getKeywordLabels(this.coarseKeywords()), + ), + fine: this.serializeKeywords(this.getKeywordLabels(this.fineKeywords())), + manual: this.serializeKeywords( + this.getKeywordLabels(this.manualKeywords()), + ), selected: this.serializeKeywords(this.selectedKeywords()), }; @@ -806,7 +918,6 @@ export class KeywordsSearchComponent { seenKeywords.add(normalized); uniqueValues.push(value.trim()); } - return uniqueValues; } From 0e80cc3fc36e631b7f6942ed98287184593ab9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 5 Jul 2026 15:59:34 +0200 Subject: [PATCH 76/92] feat(auth): completed auth restructure --- .../main/inse/account_management/router.py | 48 +- .../main/inse/account_management/service.py | 18 +- service/src/main/inse/auth/model.py | 67 +- service/src/main/inse/auth/router.py | 18 +- service/src/main/inse/auth/service.py | 372 ++--- .../src/main/inse/auth/test_auth_service.py | 229 +-- .../inse/organization_management/router.py | 10 +- .../inse/organization_management/service.py | 12 +- webapp/src/app/api/.openapi-generator/FILES | 3 +- webapp/src/app/api/api/api.ts | 17 +- webapp/src/app/api/api/auth.service.ts | 96 +- webapp/src/app/api/api/iNSEService.service.ts | 498 +++--- .../src/app/api/api/organization.service.ts | 36 +- webapp/src/app/api/api/patents.service.ts | 955 ++++-------- webapp/src/app/api/api/topics.service.ts | 1339 ++++++----------- webapp/src/app/api/api/works.service.ts | 980 ++++-------- webapp/src/app/api/configuration.ts | 368 +++-- webapp/src/app/api/model/accessResponse.ts | 5 - webapp/src/app/api/model/accessToken.ts | 18 +- webapp/src/app/api/model/accountProfile.ts | 1 + webapp/src/app/api/model/bodyRequestOtk.ts | 22 +- .../api/model/createOrganizationRequest.ts | 10 +- .../api/model/extractedKeywordsResponse.ts | 30 +- .../model/{idToken.ts => idTokenMetadata.ts} | 16 +- ...countManagementModelOrganizationProfile.ts | 12 +- ...ationManagementModelOrganizationProfile.ts | 16 +- webapp/src/app/api/model/keywordTopicMatch.ts | 10 +- .../app/api/model/keywordsTopicsRequest.ts | 14 +- .../app/api/model/keywordsTopicsResponse.ts | 14 +- webapp/src/app/api/model/loginResponse.ts | 16 +- webapp/src/app/api/model/matchedAuthor.ts | 10 +- webapp/src/app/api/model/models.ts | 3 +- webapp/src/app/api/model/refreshToken.ts | 55 - webapp/src/app/api/model/tokenType.ts | 6 +- .../src/app/api/model/updateAccountRequest.ts | 1 + .../api/model/updateOrganizationRequest.ts | 12 +- .../modules/app-login/app-login.component.ts | 104 +- .../authentication.interceptor.ts | 151 +- .../app/shared/services/credential.service.ts | 462 +++--- .../ui/app-layout/app-layout.component.ts | 5 +- .../shared/ui/app-menu/app-menu.component.ts | 8 +- 41 files changed, 2434 insertions(+), 3633 deletions(-) rename webapp/src/app/api/model/{idToken.ts => idTokenMetadata.ts} (72%) delete mode 100644 webapp/src/app/api/model/refreshToken.ts diff --git a/service/src/main/inse/account_management/router.py b/service/src/main/inse/account_management/router.py index 82781fb0..81b22593 100644 --- a/service/src/main/inse/account_management/router.py +++ b/service/src/main/inse/account_management/router.py @@ -1,12 +1,11 @@ import uuid -from typing import Optional +from typing import Annotated, Optional -from fastapi import APIRouter, Depends, Query, Response, status -from sqlmodel import Session +from fastapi import APIRouter, Query, Response, status from inse.auth import service as auth_service -from inse.auth.model import AccessToken -from inse.database import get_session +from inse.auth.model import AccessTokenMetadata +from inse.database import SessionDep from inse.tags import Tags from . import service @@ -24,11 +23,10 @@ router = APIRouter(prefix="/api/accounts", tags=[Tags.AUTH]) @router.get( "/me", operation_id="getCurrentAccount", - response_model=AccountProfile, ) async def get_current_account( - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> AccountProfile: return service.get_current_account(session=session, access_token=access_token) @@ -36,16 +34,15 @@ async def get_current_account( @router.get( "", operation_id="listAccounts", - response_model=AccountPage, ) async def list_accounts( - page: int = Query(default=0, ge=0), - page_size: int = Query(default=25, ge=1, le=100), - offset: Optional[int] = Query(default=None, ge=0), - search: Optional[str] = Query(default=None), - organization_id: Optional[uuid.UUID] = Query(default=None), - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + page: Annotated[int, Query(ge=0)] = 0, + page_size: Annotated[int, Query(ge=1, le=100)] = 10, + offset: Annotated[int, Query(ge=0)] = 0, + search: Annotated[Optional[str], Query()] = None, + organization_id: Annotated[Optional[uuid.UUID], Query()] = None, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> AccountPage: return service.list_accounts( session=session, @@ -61,13 +58,12 @@ async def list_accounts( @router.post( "", operation_id="createAccount", - response_model=AccountProfile, status_code=status.HTTP_201_CREATED, ) async def create_account( payload: CreateAccountRequest, - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> AccountProfile: return service.create_account( session=session, @@ -79,11 +75,10 @@ async def create_account( @router.get( "/organizations", operation_id="listAccountOrganizations", - response_model=list[OrganizationProfile], ) async def list_organizations( - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> list[OrganizationProfile]: return service.list_organizations(session=session, access_token=access_token) @@ -91,13 +86,12 @@ async def list_organizations( @router.put( "/{account_id}", operation_id="updateAccount", - response_model=AccountProfile, ) async def update_account( account_id: uuid.UUID, payload: UpdateAccountRequest, - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> AccountProfile: return service.update_account( session=session, @@ -114,8 +108,8 @@ async def update_account( ) async def delete_account( account_id: uuid.UUID, - session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> Response: service.delete_account( session=session, diff --git a/service/src/main/inse/account_management/service.py b/service/src/main/inse/account_management/service.py index 9e0362ad..b9d9dfda 100644 --- a/service/src/main/inse/account_management/service.py +++ b/service/src/main/inse/account_management/service.py @@ -5,7 +5,7 @@ from fastapi import HTTPException, status from sqlmodel import Session, func, or_, select from inse.auth import service as auth_service -from inse.auth.model import AccessToken, Account, Organization, UserRole +from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole from .model import ( AccountPage, @@ -28,7 +28,7 @@ def _role_allowed_for_editor(editor_role: UserRole, role: UserRole) -> bool: return False -def _account_to_profile(account: Account, token: AccessToken) -> AccountProfile: +def _account_to_profile(account: Account, token: AccessTokenMetadata) -> AccountProfile: organization_name = account.organization.name if account.organization else "" return AccountProfile( id=account.id, @@ -55,7 +55,7 @@ def _get_account_or_404(session: Session, account_id: uuid.UUID) -> Account: return account -def _ensure_account_in_editor_scope(account: Account, token: AccessToken) -> None: +def _ensure_account_in_editor_scope(account: Account, token: AccessTokenMetadata) -> None: if token.effective_role == UserRole.SUPER_ADMIN: return if ( @@ -95,14 +95,14 @@ def _ensure_email_available( ) -def get_current_account(session: Session, access_token: AccessToken) -> AccountProfile: +def get_current_account(session: Session, access_token: AccessTokenMetadata) -> AccountProfile: account = _get_account_or_404(session, access_token.effective_account_id) return _account_to_profile(account, access_token) def list_accounts( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, page: int, page_size: int, offset: Optional[int] = None, @@ -157,7 +157,7 @@ def list_accounts( def create_account( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, payload: CreateAccountRequest, ) -> AccountProfile: if not _is_admin(access_token.effective_role): @@ -207,7 +207,7 @@ def create_account( def list_organizations( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, ) -> list[OrganizationProfile]: if access_token.effective_role == UserRole.SUPER_ADMIN: organizations = session.exec( @@ -233,7 +233,7 @@ def list_organizations( def update_account( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, account_id: uuid.UUID, payload: UpdateAccountRequest, ) -> AccountProfile: @@ -307,7 +307,7 @@ def update_account( def delete_account( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, account_id: uuid.UUID, ) -> None: account = _get_account_or_404(session, account_id) diff --git a/service/src/main/inse/auth/model.py b/service/src/main/inse/auth/model.py index 30888c03..fdd687a2 100644 --- a/service/src/main/inse/auth/model.py +++ b/service/src/main/inse/auth/model.py @@ -15,9 +15,9 @@ class UserRole(StrEnum): class TokenType(StrEnum): - ID_TOKEN = "ID" - REFRESH_TOKEN = "REFRESH" - ACCESS_TOKEN = "ACCESS" + ID_TOKEN = "ID_TOKEN" + REFRESH_TOKEN = "REFRESH_TOKEN" + ACCESS_TOKEN = "ACCESS_TOKEN" class Durable(SQLModel): @@ -129,37 +129,20 @@ class Secret(SQLModel, table=True): ) -class Token(BaseModel): - token_type: TokenType = Field( - description="The type of the token (ID, Refresh, or Access).", - ) +class BaseTokenData(BaseModel): real_account_id: uuid.UUID = Field( - nullable=False, description="The unique identifier of the real account associated with this token.", ) expires_at: datetime = Field( - index=True, - nullable=False, description="The timestamp indicating when the token will expire.", ) epoch: int = Field( default=0, - nullable=False, description="The epoch value for the token. Used for versioning of tokens.", ) - user_fingerprint_hash: str = Field( - index=True, - nullable=False, - description="A hash of the user's fingerprint to ensure the token is used by the same user.", - ) - raw_token: str = Field( - index=False, - nullable=False, - description="The raw token string.", - ) -class IdToken(Token): +class IdTokenMetadata(BaseTokenData): token_type: TokenType = Field( default=TokenType.ID_TOKEN, const=True, @@ -167,24 +150,23 @@ class IdToken(Token): ) -class AccessToken(Token): +class AccessTokenMetadata(BaseTokenData): token_type: TokenType = Field( default=TokenType.ACCESS_TOKEN, const=True, description="The type of the token, which is always ACCESS_TOKEN for this class.", ) + user_fingerprint_hash: str = Field( + description="A unique fingerprint of the user, used for additional security checks.", + ) effective_account_id: uuid.UUID = Field( - nullable=False, description="The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.", ) effective_role: UserRole = Field( default=UserRole.USER, - index=True, - nullable=False, description="The specific role this access token grants within its organization.", ) effective_organization_id: uuid.UUID = Field( - nullable=False, description="The unique identifier of the organization associated with this access token.", ) @@ -197,25 +179,46 @@ class AccessToken(Token): return self.effective_account_id != self.real_account_id -class RefreshToken(AccessToken): +class AccessToken(AccessTokenMetadata): + raw_token: str = Field( + description="The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes.", + ) + + +class RefreshTokenMetadata(BaseTokenData): token_type: TokenType = Field( default=TokenType.REFRESH_TOKEN, const=True, description="The type of the token, which is always REFRESH_TOKEN for this class.", ) + effective_account_id: uuid.UUID = Field( + description="The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.", + ) + effective_role: UserRole = Field( + default=UserRole.USER, + description="The specific role this access token grants within its organization.", + ) + effective_organization_id: uuid.UUID = Field( + description="The unique identifier of the organization associated with this access token.", + ) + + +class RefreshToken(RefreshTokenMetadata): + raw_token: str = Field( + description="The raw string representation of the refresh token. This is the actual token that can be used to obtain new access tokens.", + ) class LoginResponse(BaseModel): - id_token: IdToken = Field(description="The ID token issued upon successful login.") + id_token: IdTokenMetadata = Field( + description="The ID token issued upon successful login." + ) class AccessResponse(BaseModel): access_token: AccessToken = Field( description="The access token issued upon successful authentication." ) - refresh_token: RefreshToken = Field( - description="The refresh token issued alongside the access token for obtaining new access tokens." - ) class OtkResponse(BaseModel): diff --git a/service/src/main/inse/auth/router.py b/service/src/main/inse/auth/router.py index e80612bb..9c15079f 100644 --- a/service/src/main/inse/auth/router.py +++ b/service/src/main/inse/auth/router.py @@ -12,10 +12,11 @@ from inse.database import SessionDep, get_session from inse.auth.model import ( AccessResponse, AccessToken, - IdToken, + AccessTokenMetadata, + IdTokenMetadata, LoginResponse, OtkResponse, - RefreshToken, + RefreshTokenMetadata, ) logger = logging.getLogger(__name__) @@ -81,7 +82,7 @@ async def get_action_tokens( effective_account_id: Annotated[ uuid.UUID, Body(description="Effective account ID for the access token") ], - id_token: Annotated[IdToken, auth_service.CurrentUserIdTokenPayloadDep], + id_token: Annotated[IdTokenMetadata, auth_service.CurrentUserIdTokenPayloadDep], ) -> AccessResponse: logger.debug( "Generating access token for real_account_id=%s, effective_account_id=%s, id_token=%s", @@ -109,11 +110,14 @@ async def get_action_tokens( }, ) async def refresh_access_token( + response: Response, refresh_token: Annotated[ - RefreshToken, auth_service.CurrentUserRefreshTokenPayloadDep + RefreshTokenMetadata, auth_service.CurrentUserRefreshTokenPayloadDep ], ) -> AccessToken: - return auth_service.refresh_access_token(refresh_token=refresh_token) + return auth_service.refresh_access_token( + response=response, refresh_token=refresh_token + ) @router.post( @@ -126,7 +130,7 @@ async def refresh_access_token( async def logout( session: Annotated[Session, Depends(get_session)], access_token: Annotated[ - AccessToken, + AccessTokenMetadata, auth_service.CurrentUserAccessTokenPayloadDep, ], ): @@ -151,7 +155,7 @@ async def change_password( Body(description="New password", min_length=8), ], access_token: Annotated[ - AccessToken, + AccessTokenMetadata, auth_service.CurrentUserAccessTokenPayloadDep, ], ): diff --git a/service/src/main/inse/auth/service.py b/service/src/main/inse/auth/service.py index 7ea4737f..604085ab 100644 --- a/service/src/main/inse/auth/service.py +++ b/service/src/main/inse/auth/service.py @@ -4,22 +4,23 @@ import json import logging import secrets import uuid -from typing import Annotated, Any, Dict, Literal, Optional +from typing import Annotated, Any, Dict, Optional import jwt from argon2 import PasswordHasher from argon2.exceptions import InvalidHashError, VerificationError, VerifyMismatchError -from fastapi import Depends, HTTPException, Request, Response, status +from fastapi import Cookie, Depends, HTTPException, Response, status from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from inse.auth.model import ( AccessResponse, AccessToken, + AccessTokenMetadata, Account, - IdToken, + IdTokenMetadata, LoginResponse, Organization, OtkResponse, - RefreshToken, + RefreshTokenMetadata, Secret, TokenType, UserRole, @@ -29,9 +30,9 @@ from inse.database import get_session from sqlmodel import Session, select, func from inse.auth.email_service import send_email -ID_TOKEN_EXPIRATION_MINUTES = 60 * 24 * 30 # 30 days -REFRESH_TOKEN_EXPIRATION_MINUTES = 15 # 15 minutes -ACCESS_TOKEN_EXPIRATION_MINUTES = 5 # 5 minutes +ID_TOKEN_EXPIRATION_MINUTES = 30 * 24 * 60 # 30 days +REFRESH_TOKEN_EXPIRATION_MINUTES = 1 * 24 * 60 # 1 day +ACCESS_TOKEN_EXPIRATION_MINUTES = 30 # 30 minutes OTK_EXPIRATION_MINUTES = 15 # 15 minutes @@ -42,8 +43,11 @@ EFFECTIVE_ORGANIZATION_ID_KEY = "effective_organization_id" EPOCH_KEY = "epoch" USER_FINGERPRINT_HASH_KEY = "user_fingerprint_hash" -ID_FP_COOKIE_KEY = "_Secure-Fgp-ID" -ACT_FP_COOKIE_KEY = "_Secure-Fgp-Act" + +ACCESS_FP_COOKIE_KEY = "_Secure-Fgp-Acc" +ID_TOKEN_COOKIE_KEY = "id_token" +REFRESH_TOKEN_COOKIE_KEY = "refresh_token" + settings = get_settings() @@ -181,11 +185,7 @@ def request_otk(session: Session, email: str, password: str) -> OtkResponse: logger.debug("OTK request for email %s: account found: %s", email, account) - if ( - account is None - or account.deleted - or account.id is None - ): + if account is None or account.deleted or account.id is None: logger.warning("OTK request failed for email %s: account not found", email) raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, @@ -332,9 +332,9 @@ def login( def _get_current_user_access_token_payload( session: Annotated[Session, Depends(get_session)], - request: Request, credentials: Annotated[HTTPAuthorizationCredentials, Depends(security_scheme)], -) -> AccessToken: + secure_fgp: Annotated[str | None, Cookie(alias=ACCESS_FP_COOKIE_KEY)] = None, +) -> AccessTokenMetadata: """Extracts and verifies the current user's access token payload from the request, ensuring that the token's fingerprint matches the one stored in the cookies. Args: @@ -345,18 +345,22 @@ def _get_current_user_access_token_payload( Returns: AccessToken: The verified access token payload. """ + if secure_fgp is None: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Access fingerprint cookie is missing", + ) token = credentials.credentials - access_token_payload = _verify_fp_token( - request=request, - cookie_key=ACT_FP_COOKIE_KEY, - token=token, + access_token_payload = _verify_access_token_fp( + secure_fgp=secure_fgp, + raw_access_token=token, session=session, ) # If reaches here, the access token is valid and the fingerprint matches - return AccessToken( + return AccessTokenMetadata( real_account_id=uuid.UUID(access_token_payload[REAL_ACCOUNT_ID_KEY]), effective_account_id=uuid.UUID(access_token_payload[EFFECTIVE_ACCOUNT_ID_KEY]), expires_at=datetime.datetime.fromtimestamp( @@ -368,15 +372,13 @@ def _get_current_user_access_token_payload( access_token_payload[EFFECTIVE_ORGANIZATION_ID_KEY] ), user_fingerprint_hash=access_token_payload[USER_FINGERPRINT_HASH_KEY], - raw_token=token, ) def _get_current_user_refresh_token_payload( session: Annotated[Session, Depends(get_session)], - request: Request, - credentials: Annotated[HTTPAuthorizationCredentials, Depends(security_scheme)], -) -> RefreshToken: + token: Annotated[str | None, Cookie(alias=REFRESH_TOKEN_COOKIE_KEY)] = None, +) -> RefreshTokenMetadata: """Extracts and verifies the current user's refresh token payload from the request, ensuring that the token's fingerprint matches the one stored in the cookies. Args: @@ -385,18 +387,20 @@ def _get_current_user_refresh_token_payload( credentials (Annotated[HTTPAuthorizationCredentials, Depends): The HTTP authorization credentials containing the refresh token. Returns: - RefreshToken: The verified refresh token payload. + RefreshTokenData: The verified refresh token payload. """ - token = credentials.credentials + if token is None: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Refresh token cookie is missing", + ) - refresh_token_payload = _verify_fp_token( - request=request, - cookie_key=ACT_FP_COOKIE_KEY, - token=token, + refresh_token_payload = _verify_refresh_token( + raw_refresh_token=token, session=session, ) # If reaches here, the refresh token is valid and the fingerprint matches - refresh_token = RefreshToken( + refresh_token = RefreshTokenMetadata( real_account_id=uuid.UUID(refresh_token_payload[REAL_ACCOUNT_ID_KEY]), effective_account_id=uuid.UUID(refresh_token_payload[EFFECTIVE_ACCOUNT_ID_KEY]), expires_at=datetime.datetime.fromtimestamp( @@ -407,8 +411,6 @@ def _get_current_user_refresh_token_payload( effective_organization_id=uuid.UUID( refresh_token_payload[EFFECTIVE_ORGANIZATION_ID_KEY] ), - user_fingerprint_hash=refresh_token_payload[USER_FINGERPRINT_HASH_KEY], - raw_token=token, ) logger.debug("Extracted refresh token payload: %s", refresh_token) @@ -418,9 +420,8 @@ def _get_current_user_refresh_token_payload( def _get_current_user_id_token_payload( session: Annotated[Session, Depends(get_session)], - request: Request, - credentials: Annotated[HTTPAuthorizationCredentials, Depends(security_scheme)], -) -> IdToken: + token: Annotated[str | None, Cookie(alias=ID_TOKEN_COOKIE_KEY)] = None, +) -> IdTokenMetadata: """Extracts and verifies the current user's ID token payload from the request, ensuring that the token's fingerprint matches the one stored in the cookies. Args: @@ -431,30 +432,24 @@ def _get_current_user_id_token_payload( Returns: IdToken: The verified ID token payload. """ - logger.debug( - "Verifying ID token for request %s with credentials %s", - request.url, - credentials, - ) - token = credentials.credentials - logger.debug("Verifying ID token for request %s with token %s", request.url, token) + if token is None: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="ID token cookie is missing", + ) - id_token_payload = _verify_fp_token( - request=request, - cookie_key=ID_FP_COOKIE_KEY, - token=token, + id_token_payload = _verify_id_token( + raw_id_token=token, session=session, ) # If reaches here, the ID token is valid and the fingerprint matches - return IdToken( + return IdTokenMetadata( real_account_id=uuid.UUID(id_token_payload[REAL_ACCOUNT_ID_KEY]), expires_at=datetime.datetime.fromtimestamp( id_token_payload["exp"], tz=datetime.timezone.utc ), epoch=id_token_payload[EPOCH_KEY], - user_fingerprint_hash=id_token_payload[USER_FINGERPRINT_HASH_KEY], - raw_token=token, ) @@ -583,26 +578,10 @@ def _is_valid_impersonation( def get_access_token( response: Response, session: Session, - id_token: IdToken, + id_token: IdTokenMetadata, real_account_id: uuid.UUID, effective_account_id: Optional[uuid.UUID] = None, ) -> AccessResponse: - """Generates access and refresh tokens for the specified real and effective account IDs, verifying the provided ID token and ensuring that the fingerprint matches the one stored in the cookies. - - Args: - request (Request): The FastAPI request object containing the cookies. - response (Response): The FastAPI response object to which the cookies will be added. - id_token (str): The ID token to verify. - real_account_id (uuid.UUID): The unique identifier of the real account associated with this token. - effective_account_id (Optional[uuid.UUID], optional): The unique identifier of the effective account associated with this token. If not provided, it defaults to the real account ID. - - Raises: - HTTPException: If the ID token is invalid, expired, or does not match the real account ID. - HTTPException: If impersonation is not allowed. - - Returns: - AccessResponse: An object containing the generated access and refresh tokens. - """ # IMPORTANT: The ID token has already been verified by the dependency injection system, so we can trust its payload here. if real_account_id != id_token.real_account_id: @@ -617,16 +596,15 @@ def get_access_token( if effective_account_id is None: effective_account_id = real_account_id - elif effective_account_id != real_account_id: - if not _is_valid_impersonation( - session=session, - real_account_id=real_account_id, - effective_account_id=effective_account_id, - ): - raise HTTPException( - status_code=status.HTTP_403_FORBIDDEN, - detail="Impersonation not allowed", - ) + elif effective_account_id != real_account_id and not _is_valid_impersonation( + session=session, + real_account_id=real_account_id, + effective_account_id=effective_account_id, + ): + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail="Impersonation not allowed", + ) role = _get_account_role(session=session, account_id=effective_account_id) epoch = _get_account_epoch(account_id=effective_account_id, session=session) @@ -634,7 +612,7 @@ def get_access_token( session=session, account_id=effective_account_id ) - user_fingerprint_hash = _set_act_fp_cookie(response=response) + user_fingerprint_hash = _set_access_fp_cookie(response=response) access_token = _build_access_token( real_account_id=real_account_id, @@ -644,77 +622,96 @@ def get_access_token( epoch=epoch, user_fingerprint_hash=user_fingerprint_hash, ) - refresh_token = _build_refresh_token( + _set_refresh_token( + response=response, real_account_id=real_account_id, effective_account_id=effective_account_id, effective_role=role, effective_organization_id=organization_id, epoch=epoch, - user_fingerprint_hash=user_fingerprint_hash, ) return AccessResponse( access_token=access_token, - refresh_token=refresh_token, ) -def _set_id_fp_cookie(response: Response) -> str: - """Sets a secure fingerprint cookie for ID tokens and returns the hashed value of the fingerprint. +def _set_id_token_cookie(response: Response, raw_id_token: str) -> None: + """Sets a secure cookie for the ID token. Args: response (Response): The FastAPI response object to which the cookie will be added. - - Returns: - str: The hashed value of the fingerprint. + raw_id_token (str): The raw string representation of the ID token. """ - return _set_fingerprint_cookie( - response, ID_FP_COOKIE_KEY, max_age=ID_TOKEN_EXPIRATION_MINUTES * 60 + _set_token_cookie( + response=response, + cookie_name=ID_TOKEN_COOKIE_KEY, + token=raw_id_token, + max_age=ID_TOKEN_EXPIRATION_MINUTES * 60, ) -def _set_act_fp_cookie(response: Response) -> str: +def _set_refresh_token_cookie(response: Response, raw_refresh_token: str) -> None: + """Sets a secure cookie for the refresh token. + + Args: + response (Response): The FastAPI response object to which the cookie will be added. + raw_refresh_token (str): The raw string representation of the refresh token. + """ + _set_token_cookie( + response=response, + cookie_name=REFRESH_TOKEN_COOKIE_KEY, + token=raw_refresh_token, + max_age=REFRESH_TOKEN_EXPIRATION_MINUTES * 60, + ) + + +def _set_token_cookie( + response: Response, cookie_name: str, token: str, max_age: int +) -> None: + """Sets a secure cookie for the specified token. + + Args: + response (Response): The FastAPI response object to which the cookie will be added. + cookie_name (str): The name of the cookie to set. + token (str): The raw string representation of the token. + max_age (int): The maximum age of the cookie in seconds. + """ + secure = False if settings.environment == "dev" else True + response.set_cookie( + key=cookie_name, + value=token, + httponly=True, + secure=secure, + samesite="strict", + max_age=max_age, + ) + + +def _set_access_fp_cookie(response: Response) -> str: """Sets a secure fingerprint cookie for access tokens and returns the hashed value of the fingerprint. Args: response (Response): The FastAPI response object to which the cookie will be added. - Returns: - str: The hashed value of the fingerprint. - """ - return _set_fingerprint_cookie( - response, ACT_FP_COOKIE_KEY - ) # Setting no max age to make it a session cookie, which will be deleted when the browser is closed. - - -def _set_fingerprint_cookie( - response: Response, - key: Literal["__Secure-Fgp-ID", "__Secure-Fgp-Act"], - max_age: Optional[int] = None, -) -> str: - """Sets a secure fingerprint cookie and returns the hashed value of the fingerprint. - - Args: - response (Response): The FastAPI response object to which the cookie will be added. - key (Literal["__Secure-Fgp-ID", "__Secure-Fgp-Act"]): The name of the cookie to set. - max_age (Optional[int], optional): The maximum age of the cookie in seconds. Defaults to None. - Returns: str: The hashed value of the fingerprint. """ user_fingerprint = secrets.token_hex(50) secure = False if settings.environment == "dev" else True response.set_cookie( - key=key, + key=ACCESS_FP_COOKIE_KEY, value=user_fingerprint, httponly=True, secure=secure, samesite="strict", - max_age=max_age, + max_age=None, # Setting no max age to make it a session cookie, which will be deleted when the browser is closed. ) return hashlib.sha256(user_fingerprint.encode("utf-8")).hexdigest() -def refresh_access_token(refresh_token: RefreshToken) -> AccessToken: +def refresh_access_token( + response: Response, refresh_token: RefreshTokenMetadata +) -> AccessToken: """Refreshes the access token using the provided refresh token and verifies the fingerprint from the request cookies. Args: @@ -727,25 +724,7 @@ def refresh_access_token(refresh_token: RefreshToken) -> AccessToken: """ # IMPORTANT: The refresh token has already been verified by the dependency injection system, so we can trust its payload here. - return _refresh_access_token( - refresh_token=refresh_token, - ) - - -def _refresh_access_token( - refresh_token: RefreshToken, -) -> AccessToken: - """Refreshes the access token using the provided refresh token and verifies the fingerprint from the request cookies. - - Args: - request (Request): The FastAPI request object containing the cookies. - refresh_token (RefreshToken): The refresh token to verify. - current_user_epoch (int): The epoch value for the tokens. - - Returns: - AccessToken: The refreshed access token. - """ - # IMPORTANT: The refresh token has already been verified by the dependency injection system, so we can trust its payload here. + user_fingerprint_hash = _set_access_fp_cookie(response=response) return _build_access_token( real_account_id=refresh_token.real_account_id, @@ -753,7 +732,7 @@ def _refresh_access_token( effective_role=refresh_token.effective_role, effective_organization_id=refresh_token.effective_organization_id, epoch=refresh_token.epoch, - user_fingerprint_hash=refresh_token.user_fingerprint_hash, + user_fingerprint_hash=user_fingerprint_hash, ) @@ -761,7 +740,7 @@ def _build_id_token( response: Response, real_account_id: uuid.UUID, epoch: int, -) -> IdToken: +) -> IdTokenMetadata: """Builds an ID token for the specified real account ID, expiration time, and epoch, and sets the appropriate fingerprint cookie. Args: @@ -776,34 +755,31 @@ def _build_id_token( expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta( minutes=ID_TOKEN_EXPIRATION_MINUTES ) - user_fingerprint_hash = _set_id_fp_cookie(response) payload = { REAL_ACCOUNT_ID_KEY: str(real_account_id), EPOCH_KEY: epoch, - USER_FINGERPRINT_HASH_KEY: user_fingerprint_hash, } raw_token = _build_token( payload=payload, expiration_datetime=expires_at, token_type=TokenType.ID_TOKEN, ) - return IdToken( + _set_id_token_cookie(response=response, raw_id_token=raw_token) + return IdTokenMetadata( real_account_id=real_account_id, expires_at=expires_at, epoch=epoch, - user_fingerprint_hash=user_fingerprint_hash, - raw_token=raw_token, ) -def _build_refresh_token( +def _set_refresh_token( + response: Response, real_account_id: uuid.UUID, effective_account_id: uuid.UUID, effective_role: UserRole, effective_organization_id: uuid.UUID, epoch: int, - user_fingerprint_hash: str, -) -> RefreshToken: +) -> RefreshTokenMetadata: """Builds a refresh token for the specified account IDs, role, organization ID, epoch, and fingerprint hash. Args: @@ -816,7 +792,7 @@ def _build_refresh_token( user_fingerprint_hash (str): The hashed value of the user's fingerprint. Returns: - RefreshToken: The generated refresh token object. + RefreshTokenMetadata: The generated refresh token object. """ expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta( minutes=REFRESH_TOKEN_EXPIRATION_MINUTES @@ -827,7 +803,6 @@ def _build_refresh_token( EFFECTIVE_ROLE_KEY: effective_role.value, EFFECTIVE_ORGANIZATION_ID_KEY: str(effective_organization_id), EPOCH_KEY: epoch, - USER_FINGERPRINT_HASH_KEY: user_fingerprint_hash, } raw_token = _build_token( @@ -835,16 +810,14 @@ def _build_refresh_token( expiration_datetime=expires_at, token_type=TokenType.REFRESH_TOKEN, ) - - return RefreshToken( + _set_refresh_token_cookie(response=response, raw_refresh_token=raw_token) + return RefreshTokenMetadata( real_account_id=real_account_id, effective_account_id=effective_account_id, expires_at=expires_at, epoch=epoch, effective_role=effective_role, effective_organization_id=effective_organization_id, - user_fingerprint_hash=user_fingerprint_hash, - raw_token=raw_token, ) @@ -931,18 +904,57 @@ def _build_token( return token -def _verify_fp_token( - request: Request, - cookie_key: str, - token: str, - session: Session, -) -> Dict[str, Any]: - """Verifies the provided token against the fingerprint stored in the specified cookie and returns the decoded payload if valid. +def _verify_id_token(raw_id_token: str, session: Session) -> Dict[str, Any]: + """Verifies the provided ID token and returns the decoded payload if valid. Args: - request (Request): The FastAPI request object containing the cookies. - cookie_key (str): The name of the cookie that contains the fingerprint. - token (str): The JWT token to verify. + raw_id_token (str): The JWT ID token to verify. + session (Session): The database session. + + Raises: + ValueError: If the token HMAC key is not set in the configuration. + HTTPException: If the token has expired. + HTTPException: If the token is invalid. + HTTPException: If the token's epoch does not match the current user epoch. + + Returns: + Dict[str, Any]: The decoded payload of the JWT ID token if verification is successful. + """ + payload = _extract_valid_token_payload(session, raw_id_token) + return payload + + +def _verify_refresh_token(raw_refresh_token: str, session: Session) -> Dict[str, Any]: + """Verifies the provided refresh token and returns the decoded payload if valid. + + Args: + raw_refresh_token (str): The JWT refresh token to verify. + session (Session): The database session. + + Raises: + ValueError: If the token HMAC key is not set in the configuration. + HTTPException: If the token has expired. + HTTPException: If the token is invalid. + HTTPException: If the token's epoch does not match the current user epoch. + + Returns: + Dict[str, Any]: The decoded payload of the JWT refresh token if verification is successful. + """ + payload = _extract_valid_token_payload(session, raw_refresh_token) + return payload + + +def _verify_access_token_fp( + secure_fgp: str, + raw_access_token: str, + session: Session, +) -> Dict[str, Any]: + """Verifies the provided accesstoken against the fingerprint stored in the specified cookie and returns the decoded payload if valid. + + Args: + secure_fgp (str): The secure fingerprint value. + raw_access_token (str): The JWT token to verify. + session (Session): The database session. Raises: ValueError: If the token HMAC key is not set in the configuration. @@ -954,19 +966,29 @@ def _verify_fp_token( Returns: Dict[str, Any]: The decoded payload of the JWT token if verification is successful. """ - if not settings.token_hmac_key: - raise ValueError("Token HMAC key is not set in the configuration.") - - secure_fgp = request.cookies.get(cookie_key) - if not secure_fgp: - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Fingerprint cookie missing", - ) fingerprint_bytes = secure_fgp.encode("utf-8") expected_fingerprint_hash = hashlib.sha256(fingerprint_bytes).hexdigest() + payload = _extract_valid_token_payload(session, raw_access_token) + + token_fingerprint_hash = payload.get(USER_FINGERPRINT_HASH_KEY) + if ( + not token_fingerprint_hash + or token_fingerprint_hash != expected_fingerprint_hash + ): + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Invalid context fingerprint", + ) + + return payload + + +def _extract_valid_token_payload(session: Session, token: str): + if not settings.token_hmac_key: + raise ValueError("Token HMAC key is not set in the configuration.") + try: payload = jwt.decode( token, @@ -975,23 +997,12 @@ def _verify_fp_token( issuer=settings.token_issuer_id, ) - token_fingerprint_hash = payload.get(USER_FINGERPRINT_HASH_KEY) - if ( - not token_fingerprint_hash - or token_fingerprint_hash != expected_fingerprint_hash - ): - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Invalid context fingerprint", - ) - real_account_id = payload.get(REAL_ACCOUNT_ID_KEY) if not real_account_id: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Token missing real account ID", ) - epoch_account_id = uuid.UUID(real_account_id) effective_account_id = payload.get(EFFECTIVE_ACCOUNT_ID_KEY) @@ -1014,7 +1025,6 @@ def _verify_fp_token( ) return payload - except jwt.ExpiredSignatureError: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, @@ -1056,7 +1066,7 @@ def _get_active_account(session: Session, account_id: uuid.UUID) -> Account: return account -def logout(session: Session, access_token: AccessToken) -> Dict[str, str]: +def logout(session: Session, access_token: AccessTokenMetadata) -> Dict[str, str]: """Logout the user by incrementing the epoch of the account associated with the provided access token, effectively invalidating all existing tokens for that account. Args: @@ -1080,7 +1090,7 @@ def logout(session: Session, access_token: AccessToken) -> Dict[str, str]: def change_password( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, current_password: str, new_password: str, ) -> Dict[str, str]: diff --git a/service/src/main/inse/auth/test_auth_service.py b/service/src/main/inse/auth/test_auth_service.py index 0e61130c..728a61ee 100644 --- a/service/src/main/inse/auth/test_auth_service.py +++ b/service/src/main/inse/auth/test_auth_service.py @@ -14,9 +14,10 @@ from inse.auth.model import ( Account, Organization, Secret, - IdToken, AccessToken, - RefreshToken, + IdTokenMetadata, + AccessTokenMetadata, + RefreshTokenMetadata, UserRole, ) @@ -61,6 +62,19 @@ def create_org_and_account( return org, acc +def _get_cookie_value(response: Response, cookie_name: str) -> str: + for header_name, header_value in getattr(response, "raw_headers", []): + if header_name.lower() == b"set-cookie": + cookie_header = header_value.decode("latin-1") + if cookie_header.startswith(f"{cookie_name}="): + return cookie_header.split(";", 1)[0].split("=", 1)[1] + + header = response.headers.get("set-cookie") + assert header is not None + assert header.startswith(f"{cookie_name}=") + return header.split(";", 1)[0].split("=", 1)[1] + + def test_hash_and_verify_password(): pw = "s3cret-password" h = auth_service._hash_password(pw) @@ -80,8 +94,8 @@ def test_request_otk_and_login_flow(in_memory_session, settings_backup): assert acc.id is not None resp = auth_service.request_otk(in_memory_session, email, password) - assert resp["status"] == "ok" - assert resp["account_id"] == str(acc.id) + assert resp.status == "success" + assert resp.account_id == acc.id secret = in_memory_session.exec( select(Secret).where(Secret.account_id == acc.id) @@ -93,9 +107,12 @@ def test_request_otk_and_login_flow(in_memory_session, settings_backup): login_result = auth_service.login( in_memory_session, response, acc.id, secret.secret_value ) - assert isinstance(login_result.id_token, IdToken) + assert isinstance(login_result.id_token, IdTokenMetadata) assert login_result.id_token.real_account_id == acc.id - assert login_result.id_token.user_fingerprint_hash is not None + + raw_id_token = _get_cookie_value(response, auth_service.ID_TOKEN_COOKIE_KEY) + payload = auth_service._verify_id_token(raw_id_token=raw_id_token, session=in_memory_session) + assert payload[auth_service.REAL_ACCOUNT_ID_KEY] == str(acc.id) def test_token_build_verify_and_fp_checks(in_memory_session, settings_backup): @@ -108,35 +125,29 @@ def test_token_build_verify_and_fp_checks(in_memory_session, settings_backup): assert acc.id is not None response = Response() - id_token = auth_service._build_id_token(response, acc.id, acc.epoch) - assert isinstance(id_token, IdToken) + secure_fgp_hash = auth_service._set_access_fp_cookie(response) + secure_fgp = _get_cookie_value(response, auth_service.ACCESS_FP_COOKIE_KEY) + access_token = auth_service._build_access_token( + real_account_id=acc.id, + effective_account_id=acc.id, + effective_role=acc.role, + effective_organization_id=acc.organization_id, + epoch=acc.epoch, + user_fingerprint_hash=secure_fgp_hash, + ) + assert isinstance(access_token, AccessToken) - cookie_header = None - for header, value in response.headers.items(): - if header.lower() == "set-cookie": - cookie_header = value - break - assert cookie_header is not None - cookie_value = cookie_header.split("=")[1].split(";")[0] - - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies - - req = DummyReq({auth_service.ID_FP_COOKIE_KEY: cookie_value}) - payload = auth_service._verify_fp_token( - request=req, - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=id_token.raw_token, + payload = auth_service._verify_access_token_fp( + secure_fgp=secure_fgp, + raw_access_token=access_token.raw_token, session=in_memory_session, ) assert payload[auth_service.REAL_ACCOUNT_ID_KEY] == str(acc.id) with pytest.raises(Exception): - auth_service._verify_fp_token( - request=DummyReq({}), - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=id_token.raw_token, + auth_service._verify_access_token_fp( + secure_fgp="bad-fingerprint", + raw_access_token=access_token.raw_token, session=in_memory_session, ) @@ -158,11 +169,30 @@ def test_access_and_refresh_token_flow(in_memory_session, settings_backup): access_response = auth_service.get_access_token( response, in_memory_session, id_token, acc.id ) - assert isinstance(access_response.access_token, AccessToken) - assert isinstance(access_response.refresh_token, RefreshToken) + assert isinstance(access_response.access_token, AccessTokenMetadata) - refreshed = auth_service.refresh_access_token(access_response.refresh_token) - assert isinstance(refreshed, AccessToken) + raw_refresh_token = _get_cookie_value(response, auth_service.REFRESH_TOKEN_COOKIE_KEY) + refresh_payload = auth_service._verify_refresh_token( + raw_refresh_token=raw_refresh_token, + session=in_memory_session, + ) + refresh_token = RefreshTokenMetadata( + real_account_id=uuid.UUID(refresh_payload[auth_service.REAL_ACCOUNT_ID_KEY]), + effective_account_id=uuid.UUID( + refresh_payload[auth_service.EFFECTIVE_ACCOUNT_ID_KEY] + ), + expires_at=_dt.datetime.fromtimestamp( + refresh_payload["exp"], tz=_dt.timezone.utc + ), + epoch=refresh_payload[auth_service.EPOCH_KEY], + effective_role=UserRole(refresh_payload[auth_service.EFFECTIVE_ROLE_KEY]), + effective_organization_id=uuid.UUID( + refresh_payload[auth_service.EFFECTIVE_ORGANIZATION_ID_KEY] + ), + ) + + refreshed = auth_service.refresh_access_token(Response(), refresh_token) + assert isinstance(refreshed, AccessTokenMetadata) assert refreshed.real_account_id == access_response.access_token.real_account_id @@ -233,6 +263,7 @@ def test_deactivated_account_is_rejected_by_active_account_lookup(in_memory_sess in_memory_session.add(account) in_memory_session.commit() + assert account.id is not None with pytest.raises(HTTPException) as error: auth_service._get_active_account(in_memory_session, account.id) @@ -268,24 +299,20 @@ def test_verify_fp_token_cookie_mismatch(in_memory_session, settings_backup): assert acc.id is not None response = Response() - id_token = auth_service._build_id_token(response, acc.id, acc.epoch) - - cookie_header = None - for header, value in response.headers.items(): - if header.lower() == "set-cookie": - cookie_header = value - break - cookie_value = cookie_header.split("=")[1].split(";")[0] # type: ignore - - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies + secure_fgp_hash = auth_service._set_access_fp_cookie(response) + access_token = auth_service._build_access_token( + real_account_id=acc.id, + effective_account_id=acc.id, + effective_role=acc.role, + effective_organization_id=acc.organization_id, + epoch=acc.epoch, + user_fingerprint_hash=secure_fgp_hash, + ) with pytest.raises(HTTPException): - auth_service._verify_fp_token( - request=DummyReq({auth_service.ID_FP_COOKIE_KEY: "badcookie"}), # type: ignore - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=id_token.raw_token, + auth_service._verify_access_token_fp( + secure_fgp="badcookie", + raw_access_token=access_token.raw_token, session=in_memory_session, ) @@ -300,28 +327,25 @@ def test_token_epoch_mismatch(in_memory_session, settings_backup): assert acc.id is not None response = Response() - id_token = auth_service._build_id_token(response, acc.id, acc.epoch) - - cookie_header = None - for header, value in response.headers.items(): - if header.lower() == "set-cookie": - cookie_header = value - break - cookie_value = cookie_header.split("=")[1].split(";")[0] # type: ignore - - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies + secure_fgp_hash = auth_service._set_access_fp_cookie(response) + secure_fgp = _get_cookie_value(response, auth_service.ACCESS_FP_COOKIE_KEY) + access_token = auth_service._build_access_token( + real_account_id=acc.id, + effective_account_id=acc.id, + effective_role=acc.role, + effective_organization_id=acc.organization_id, + epoch=acc.epoch, + user_fingerprint_hash=secure_fgp_hash, + ) acc.epoch += 1 in_memory_session.add(acc) in_memory_session.commit() with pytest.raises(HTTPException): - auth_service._verify_fp_token( - request=DummyReq({auth_service.ID_FP_COOKIE_KEY: cookie_value}), # type: ignore - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=id_token.raw_token, + auth_service._verify_access_token_fp( + secure_fgp=secure_fgp, + raw_access_token=access_token.raw_token, session=in_memory_session, ) @@ -336,25 +360,21 @@ def test_invalid_token_signature_raises(in_memory_session, settings_backup): assert acc.id is not None response = Response() - id_token = auth_service._build_id_token(response, acc.id, acc.epoch) + secure_fgp = auth_service._set_access_fp_cookie(response) + access_token = auth_service._build_access_token( + real_account_id=acc.id, + effective_account_id=acc.id, + effective_role=acc.role, + effective_organization_id=acc.organization_id, + epoch=acc.epoch, + user_fingerprint_hash=secure_fgp, + ) - cookie_header = None - for header, value in response.headers.items(): - if header.lower() == "set-cookie": - cookie_header = value - break - cookie_value = cookie_header.split("=")[1].split(";")[0] # type: ignore - - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies - - bad_token = id_token.raw_token + "x" + bad_token = access_token.raw_token + "x" with pytest.raises(HTTPException): - auth_service._verify_fp_token( - request=DummyReq({auth_service.ID_FP_COOKIE_KEY: cookie_value}), # type: ignore - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=bad_token, + auth_service._verify_access_token_fp( + secure_fgp=secure_fgp, + raw_access_token=bad_token, session=in_memory_session, ) @@ -391,7 +411,7 @@ def test_impersonation_rules(in_memory_session, settings_backup): real_acc.id, effective_account_id=eff_acc.id, ) - assert isinstance(access_resp.access_token, AccessToken) + assert isinstance(access_resp.access_token, AccessTokenMetadata) def test_otk_regeneration_and_reuse(in_memory_session, settings_backup): @@ -425,7 +445,7 @@ def test_otk_regeneration_and_reuse(in_memory_session, settings_backup): login_res = auth_service.login( in_memory_session, Response(), acc.id, secret2.secret_value ) - assert isinstance(login_res.id_token, IdToken) + assert isinstance(login_res.id_token, IdTokenMetadata) def test_otk_deleted_after_login(in_memory_session, settings_backup): @@ -461,7 +481,7 @@ def test_access_token_fp_mismatch(in_memory_session, settings_backup): assert acc.id is not None response = Response() - raw = auth_service._set_act_fp_cookie(response) + raw_hash = auth_service._set_access_fp_cookie(response) access_token = auth_service._build_access_token( real_account_id=acc.id, @@ -469,18 +489,13 @@ def test_access_token_fp_mismatch(in_memory_session, settings_backup): effective_role=acc.role, effective_organization_id=acc.organization_id, epoch=acc.epoch, - user_fingerprint_hash=raw, + user_fingerprint_hash=raw_hash, ) - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies - with pytest.raises(HTTPException): - auth_service._verify_fp_token( - request=DummyReq({auth_service.ACT_FP_COOKIE_KEY: "wrongcookie"}), # type: ignore - cookie_key=auth_service.ACT_FP_COOKIE_KEY, - token=access_token.raw_token, + auth_service._verify_access_token_fp( + secure_fgp="wrongcookie", + raw_access_token=access_token.raw_token, session=in_memory_session, ) @@ -495,34 +510,26 @@ def test_expired_jwt_token_raises(in_memory_session, settings_backup): assert acc.id is not None response = Response() - cookie_raw = auth_service._set_id_fp_cookie(response) past = _dt.datetime.now(_dt.timezone.utc) - timedelta(minutes=5) + access_fingerprint_hash = auth_service._set_access_fp_cookie(response) payload = { auth_service.REAL_ACCOUNT_ID_KEY: str(acc.id), + auth_service.EFFECTIVE_ACCOUNT_ID_KEY: str(acc.id), + auth_service.EFFECTIVE_ROLE_KEY: acc.role.value, + auth_service.EFFECTIVE_ORGANIZATION_ID_KEY: str(acc.organization_id), auth_service.EPOCH_KEY: acc.epoch, - auth_service.USER_FINGERPRINT_HASH_KEY: cookie_raw, + auth_service.USER_FINGERPRINT_HASH_KEY: access_fingerprint_hash, } bad_token = auth_service._build_token( payload=payload, expiration_datetime=past, - token_type=auth_service.TokenType.ID_TOKEN, + token_type=auth_service.TokenType.ACCESS_TOKEN, ) - class DummyReq: - def __init__(self, cookies): - self.cookies = cookies - with pytest.raises(HTTPException): - auth_service._verify_fp_token( - request=DummyReq( - { - auth_service.ID_FP_COOKIE_KEY: response.headers["set-cookie"] - .split("=")[1] - .split(";")[0] - } - ), # type: ignore - cookie_key=auth_service.ID_FP_COOKIE_KEY, - token=bad_token, + auth_service._verify_access_token_fp( + secure_fgp=_get_cookie_value(response, auth_service.ACCESS_FP_COOKIE_KEY), + raw_access_token=bad_token, session=in_memory_session, ) diff --git a/service/src/main/inse/organization_management/router.py b/service/src/main/inse/organization_management/router.py index 0a8b82ca..5a2db2bd 100644 --- a/service/src/main/inse/organization_management/router.py +++ b/service/src/main/inse/organization_management/router.py @@ -5,7 +5,7 @@ from fastapi import APIRouter, Depends, Query, Response, status from sqlmodel import Session from inse.auth import service as auth_service -from inse.auth.model import AccessToken +from inse.auth.model import AccessTokenMetadata from inse.database import get_session from inse.tags import Tags @@ -26,7 +26,7 @@ async def get_organizations( page_size: int = Query(default=25, ge=1, le=100), offset: Optional[int] = Query(default=None, ge=0), session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> OrganizationPage: return service.get_organizations( session=session, @@ -46,7 +46,7 @@ async def get_organizations( async def create_organization( payload: CreateOrganizationRequest, session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> OrganizationProfile: return service.create_organization(session, access_token, payload) @@ -60,7 +60,7 @@ async def update_organization( organization_id: uuid.UUID, payload: UpdateOrganizationRequest, session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> OrganizationProfile: return service.update_organization( session, access_token, organization_id, payload @@ -75,7 +75,7 @@ async def update_organization( async def delete_organization( organization_id: uuid.UUID, session: Session = Depends(get_session), - access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, ) -> Response: service.delete_organization(session, access_token, organization_id) return Response(status_code=status.HTTP_204_NO_CONTENT) diff --git a/service/src/main/inse/organization_management/service.py b/service/src/main/inse/organization_management/service.py index 80dd88c9..528bcf35 100644 --- a/service/src/main/inse/organization_management/service.py +++ b/service/src/main/inse/organization_management/service.py @@ -4,7 +4,7 @@ from typing import Optional from fastapi import HTTPException, status from sqlmodel import Session, func, select -from inse.auth.model import AccessToken, Account, Organization, UserRole +from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole from .model import ( CreateOrganizationRequest, @@ -14,7 +14,7 @@ from .model import ( ) -def _require_super_admin(access_token: AccessToken) -> None: +def _require_super_admin(access_token: AccessTokenMetadata) -> None: if access_token.effective_role != UserRole.SUPER_ADMIN: raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, @@ -109,7 +109,7 @@ def _deactivate_organization_accounts( def get_organizations( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, page: int, page_size: int, offset: Optional[int] = None, @@ -145,7 +145,7 @@ def get_organizations( def create_organization( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, payload: CreateOrganizationRequest, ) -> OrganizationProfile: _require_super_admin(access_token) @@ -164,7 +164,7 @@ def create_organization( def update_organization( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, organization_id: uuid.UUID, payload: UpdateOrganizationRequest, ) -> OrganizationProfile: @@ -191,7 +191,7 @@ def update_organization( def delete_organization( session: Session, - access_token: AccessToken, + access_token: AccessTokenMetadata, organization_id: uuid.UUID, ) -> None: _require_super_admin(access_token) diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index e59c1083..f9ac2e32 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -113,7 +113,7 @@ model/hEUReportSummary.ts model/hEUTopic.ts model/hEUWebLink.ts model/hTTPValidationError.ts -model/idToken.ts +model/idTokenMetadata.ts model/inseAccountManagementModelOrganizationProfile.ts model/inseOrganizationManagementModelOrganizationProfile.ts model/institution.ts @@ -161,7 +161,6 @@ model/publicationDetailByFunder.ts model/publicationIdsByAuthorPosition.ts model/publicationsByAuthorResponse.ts model/rankingResponse.ts -model/refreshToken.ts model/score.ts model/sortDirection.ts model/tokenType.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 8ea55e0b..817a3a65 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -26,19 +26,4 @@ export * from './topics.service'; import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; -export const APIS = [ - AuthService, - CompanyConnectionsService, - FundingService, - INSEServiceService, - InstitutionsService, - KeywordsService, - NewsService, - OrganizationService, - PatentsService, - PersonNetworkService, - PersonsService, - ProjectsService, - TopicsService, - WorksService, -]; +export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/auth.service.ts b/webapp/src/app/api/api/auth.service.ts index ef111294..086a0e47 100644 --- a/webapp/src/app/api/api/auth.service.ts +++ b/webapp/src/app/api/api/auth.service.ts @@ -66,13 +66,14 @@ export class AuthService extends BaseService { * Change the user\'s password and invalidate existing tokens. * @endpoint post /api/auth/v2/change-password * @param bodyChangePassword + * @param secureFgpAcc * @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 changePassword(bodyChangePassword: BodyChangePassword, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public changePassword(bodyChangePassword: BodyChangePassword, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public changePassword(bodyChangePassword: BodyChangePassword, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public changePassword(bodyChangePassword: BodyChangePassword, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (bodyChangePassword === null || bodyChangePassword === undefined) { throw new Error('Required parameter bodyChangePassword was null or undefined when calling changePassword.'); } @@ -134,13 +135,14 @@ export class AuthService extends BaseService { * Create Account * @endpoint post /api/accounts * @param createAccountRequest + * @param secureFgpAcc * @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 createAccount(createAccountRequest: CreateAccountRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public createAccount(createAccountRequest: CreateAccountRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public createAccount(createAccountRequest: CreateAccountRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public createAccount(createAccountRequest: CreateAccountRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (createAccountRequest === null || createAccountRequest === undefined) { throw new Error('Required parameter createAccountRequest was null or undefined when calling createAccount.'); } @@ -202,13 +204,14 @@ export class AuthService extends BaseService { * Delete Account * @endpoint delete /api/accounts/{account_id} * @param accountId + * @param secureFgpAcc * @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 deleteAccount(accountId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public deleteAccount(accountId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteAccount(accountId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteAccount(accountId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling deleteAccount.'); } @@ -261,22 +264,20 @@ export class AuthService extends BaseService { * Retrieve an access token for the authenticated user. * @endpoint post /api/auth/v2/access * @param bodyGetAccessToken + * @param idToken * @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 getAccessToken(bodyGetAccessToken: BodyGetAccessToken, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (bodyGetAccessToken === null || bodyGetAccessToken === undefined) { throw new Error('Required parameter bodyGetAccessToken was null or undefined when calling getAccessToken.'); } let localVarHeaders = this.defaultHeaders; - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ 'application/json' ]); @@ -328,13 +329,14 @@ export class AuthService extends BaseService { /** * Get Current Account * @endpoint get /api/accounts/me + * @param secureFgpAcc * @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 getCurrentAccount(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getCurrentAccount(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getCurrentAccount(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getCurrentAccount(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public getCurrentAccount(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCurrentAccount(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCurrentAccount(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCurrentAccount(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarHeaders = this.defaultHeaders; @@ -433,13 +435,14 @@ export class AuthService extends BaseService { /** * List Organizations * @endpoint get /api/accounts/organizations + * @param secureFgpAcc * @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 listAccountOrganizations(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listAccountOrganizations(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; - public listAccountOrganizations(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; - public listAccountOrganizations(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public listAccountOrganizations(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccountOrganizations(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarHeaders = this.defaultHeaders; @@ -492,13 +495,14 @@ export class AuthService extends BaseService { * @param offset * @param search * @param organizationId + * @param secureFgpAcc * @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 listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, @@ -626,13 +630,14 @@ export class AuthService extends BaseService { * Logout * Logout the authenticated user. * @endpoint post /api/auth/v2/logout + * @param secureFgpAcc * @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 logout(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public logout(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public logout(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public logout(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public logout(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public logout(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public logout(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public logout(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarHeaders = this.defaultHeaders; @@ -681,19 +686,17 @@ export class AuthService extends BaseService { * Refresh Access Token * Refresh the access token using a valid refresh token. * @endpoint post /api/auth/v2/refresh + * @param refreshToken * @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 refreshAccessToken(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public refreshAccessToken(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public refreshAccessToken(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public refreshAccessToken(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public refreshAccessToken(refreshToken?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public refreshAccessToken(refreshToken?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public refreshAccessToken(refreshToken?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public refreshAccessToken(refreshToken?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarHeaders = this.defaultHeaders; - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ 'application/json' ]); @@ -803,13 +806,14 @@ export class AuthService extends BaseService { * @endpoint put /api/accounts/{account_id} * @param accountId * @param updateAccountRequest + * @param secureFgpAcc * @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 updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling updateAccount.'); } diff --git a/webapp/src/app/api/api/iNSEService.service.ts b/webapp/src/app/api/api/iNSEService.service.ts index da26fff7..1149c309 100644 --- a/webapp/src/app/api/api/iNSEService.service.ts +++ b/webapp/src/app/api/api/iNSEService.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,355 +9,205 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class INSEServiceService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @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 buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - saveJson, - 'save_json', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Builds the topic hierarchy cache. + * @endpoint get /api/inse-service/topics/cache + * @param pageSize Page size for each search page. + * @param saveJson Persist cache JSON to data folder. + * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + saveJson, 'save_json'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + let localVarHeaders = this.defaultHeaders; - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @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 countTopicHierarchy( - topic: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public countTopicHierarchy( - topic: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topic === null || topic === undefined) { - throw new Error( - 'Required parameter topic was null or undefined when calling countTopicHierarchy.', - ); - } + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/hierarchy`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/hierarchy`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/organization.service.ts b/webapp/src/app/api/api/organization.service.ts index 2af0ed8b..14fb942d 100644 --- a/webapp/src/app/api/api/organization.service.ts +++ b/webapp/src/app/api/api/organization.service.ts @@ -47,13 +47,14 @@ export class OrganizationService extends BaseService { * Create Organization * @endpoint post /api/organizations * @param createOrganizationRequest + * @param secureFgpAcc * @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 createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (createOrganizationRequest === null || createOrganizationRequest === undefined) { throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.'); } @@ -115,13 +116,14 @@ export class OrganizationService extends BaseService { * Delete Organization * @endpoint delete /api/organizations/{organization_id} * @param organizationId + * @param secureFgpAcc * @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 deleteOrganisation(organizationId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public deleteOrganisation(organizationId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteOrganisation(organizationId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteOrganisation(organizationId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (organizationId === null || organizationId === undefined) { throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.'); } @@ -175,13 +177,14 @@ export class OrganizationService extends BaseService { * @param page * @param pageSize * @param offset + * @param secureFgpAcc * @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 getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getOrganisations(page?: number, pageSize?: number, offset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, @@ -240,13 +243,14 @@ export class OrganizationService extends BaseService { * @endpoint put /api/organizations/{organization_id} * @param organizationId * @param updateOrganizationRequest + * @param secureFgpAcc * @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 updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (organizationId === null || organizationId === undefined) { throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.'); } diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 904279c3..669a7496 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AllPatentsResponse } from '../model/allPatentsResponse'; @@ -36,657 +30,338 @@ import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class PatentsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get all patents with pagination and search. - * @endpoint get /api/inse-service/patents - * @param page - * @param size - * @param search - * @param source - * @param sortBy - * @param sortDirection - * @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 getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - source, - 'source', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortDirection, - 'sort_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get all patents with pagination and search. + * @endpoint get /api/inse-service/patents + * @param page + * @param size + * @param search + * @param source + * @param sortBy + * @param sortDirection + * @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 getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/patents`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Get pre-indexed org patents for an institution. + * @endpoint get /api/inse-service/institutions/{id}/org-patents + * @param id + * @param matchType Filter patents by match type. + * @param page + * @param size + * @param source + * @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 getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getOrgPatentsByInstitution.'); + } - /** - * Get pre-indexed org patents for an institution. - * @endpoint get /api/inse-service/institutions/{id}/org-patents - * @param id - * @param matchType Filter patents by match type. - * @param page - * @param size - * @param source - * @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 getOrgPatentsByInstitution( - id: string, - matchType?: 'institution' | 'name' | 'both' | 'all', - page?: number, - size?: number, - source?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getOrgPatentsByInstitution( - id: string, - matchType?: 'institution' | 'name' | 'both' | 'all', - page?: number, - size?: number, - source?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getOrgPatentsByInstitution( - id: string, - matchType?: 'institution' | 'name' | 'both' | 'all', - page?: number, - size?: number, - source?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getOrgPatentsByInstitution( - id: string, - matchType?: 'institution' | 'name' | 'both' | 'all', - page?: number, - size?: number, - source?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getOrgPatentsByInstitution.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + matchType, 'match_type'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/org-patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - matchType, - 'match_type', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - source, - 'source', - ); + /** + * Returns one publication by OpenAlex ID or DOI. + * @endpoint get /api/inse-service/patents/{identifier} + * @param identifier + * @param prefix Application Prefix (EP or US) + * @param title Do we want to fallback to title search if ID and DOI dont work? + * @param fillingDate Filling date in YYYY-MM-DD format + * @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 getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (identifier === null || identifier === undefined) { + throw new Error('Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + prefix, 'prefix'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fillingDate, 'filling_date'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents/${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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get patents matched to an author by name. + * @endpoint get /api/inse-service/authors/{author_id}/patents + * @param authorId + * @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 getPatentsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPatentsByAuthor.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/org-patents`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Get patents matched to an institution by assignee name. + * @endpoint get /api/inse-service/institutions/{id}/patents + * @param id + * @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 getPatentsByInstitution(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByInstitution(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPatentsByInstitution.'); + } - /** - * Returns one publication by OpenAlex ID or DOI. - * @endpoint get /api/inse-service/patents/{identifier} - * @param identifier - * @param prefix Application Prefix (EP or US) - * @param title Do we want to fallback to title search if ID and DOI dont work? - * @param fillingDate Filling date in YYYY-MM-DD format - * @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 getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (identifier === null || identifier === undefined) { - throw new Error( - 'Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.', - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - prefix, - 'prefix', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - title, - 'title', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - fillingDate, - 'filling_date', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/patents/${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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get patents matched to an author by name. - * @endpoint get /api/inse-service/authors/{author_id}/patents - * @param authorId - * @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 getPatentsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPatentsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPatentsByAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get patents matched to an institution by assignee name. - * @endpoint get /api/inse-service/institutions/{id}/patents - * @param id - * @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 getPatentsByInstitution( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPatentsByInstitution( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentsByInstitution( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentsByInstitution( - id: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (id === null || id === undefined) { - throw new Error( - 'Required parameter id was null or undefined when calling getPatentsByInstitution.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 5a51e233..ef7b0c7f 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -34,929 +28,484 @@ import { KeywordsTopicsResponse } from '../model/keywordsTopicsResponse'; import { TopicsListResponse } from '../model/topicsListResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class TopicsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns topic options for autocomplete inputs. - * @endpoint get /api/topics/autocomplete - * @param query Topic search text, for example \'machine learning\'. - * @param domainId Optional OpenAlex domain id filter. - * @param fieldId Optional OpenAlex field id filter. - * @param subfieldId Optional OpenAlex subfield id filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling autocompleteTopics.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - domainId, - 'domainId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - fieldId, - 'fieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - subfieldId, - 'subfieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); + /** + * Returns topic options for autocomplete inputs. + * @endpoint get /api/topics/autocomplete + * @param query Topic search text, for example \'machine learning\'. + * @param domainId Optional OpenAlex domain id filter. + * @param fieldId Optional OpenAlex field id filter. + * @param subfieldId Optional OpenAlex subfield id filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + domainId, 'domainId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fieldId, 'fieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + subfieldId, 'subfieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + let localVarHeaders = this.defaultHeaders; - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarPath = `/api/topics/autocomplete`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @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 buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - saveJson, - 'save_json', - ); + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @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 countTopicHierarchy( - topic: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public countTopicHierarchy( - topic: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public countTopicHierarchy( - topic: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topic === null || topic === undefined) { - throw new Error( - 'Required parameter topic was null or undefined when calling countTopicHierarchy.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + let localVarPath = `/api/topics/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * Builds the topic hierarchy cache. + * @endpoint get /api/inse-service/topics/cache + * @param pageSize Page size for each search page. + * @param saveJson Persist cache JSON to data folder. + * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + saveJson, 'save_json'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/hierarchy`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a list of OpenAlex topics. + * @endpoint get /api/topics + * @param search Full-text search, for example \'machine learning\'. + * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'domain.id\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filter, 'filter'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + groupBy, 'group_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + perPage, 'per_page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + cursor, 'cursor'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sample, 'sample'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + select, 'select'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/topics/hierarchy`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Semantic / vector search for topics using a keyword/sentence. + * @endpoint get /api/topics/vector-search + * @param query Word or sentence to search by similarity. + * @param limit Maximum number of topics to return. + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling vectorSearchTopics.'); + } - /** - * Returns a list of OpenAlex topics. - * @endpoint get /api/topics - * @param search Full-text search, for example \'machine learning\'. - * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'domain.id\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filter, - 'filter', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sort, - 'sort', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - groupBy, - 'group_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - perPage, - 'per_page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - cursor, - 'cursor', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sample, - 'sample', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - select, - 'select', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + searchType, 'searchType'); - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics/vector-search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Batch semantic / vector search for multiple keywords. + * @endpoint post /api/topics/vector-search/batch + * @param keywordsTopicsRequest + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopicsBatch(keywordsTopicsRequest: KeywordsTopicsRequest, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public vectorSearchTopicsBatch(keywordsTopicsRequest: KeywordsTopicsRequest, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopicsBatch(keywordsTopicsRequest: KeywordsTopicsRequest, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopicsBatch(keywordsTopicsRequest: KeywordsTopicsRequest, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (keywordsTopicsRequest === null || keywordsTopicsRequest === undefined) { + throw new Error('Required parameter keywordsTopicsRequest was null or undefined when calling vectorSearchTopicsBatch.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + searchType, 'searchType'); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/topics/vector-search/batch`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsTopicsRequest, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/topics`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Semantic / vector search for topics using a keyword/sentence. - * @endpoint get /api/topics/vector-search - * @param query Word or sentence to search by similarity. - * @param limit Maximum number of topics to return. - * @param searchType Search approach: \'hybrid\' or \'semantic\'. - * @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 vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling vectorSearchTopics.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - searchType, - 'searchType', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics/vector-search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Batch semantic / vector search for multiple keywords. - * @endpoint post /api/topics/vector-search/batch - * @param keywordsTopicsRequest - * @param searchType Search approach: \'hybrid\' or \'semantic\'. - * @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 vectorSearchTopicsBatch( - keywordsTopicsRequest: KeywordsTopicsRequest, - searchType?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public vectorSearchTopicsBatch( - keywordsTopicsRequest: KeywordsTopicsRequest, - searchType?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopicsBatch( - keywordsTopicsRequest: KeywordsTopicsRequest, - searchType?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopicsBatch( - keywordsTopicsRequest: KeywordsTopicsRequest, - searchType?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (keywordsTopicsRequest === null || keywordsTopicsRequest === undefined) { - throw new Error( - 'Required parameter keywordsTopicsRequest was null or undefined when calling vectorSearchTopicsBatch.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - searchType, - 'searchType', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = - this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Content-Type', - httpContentTypeSelected, - ); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/topics/vector-search/batch`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: keywordsTopicsRequest, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index ca494a80..09641dde 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -36,664 +30,356 @@ import { WorkPage } from '../model/workPage'; import { WorksListResponse } from '../model/worksListResponse'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class WorksService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns all works for an author. - * @endpoint get /api/works/{author_id}/all - * @param authorId The author id, for example A5023888391. - * @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 getAllAuthorWorks( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAllAuthorWorks( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllAuthorWorks( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllAuthorWorks( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getAllAuthorWorks.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns all works for an author. + * @endpoint get /api/works/{author_id}/all + * @param authorId The author id, for example A5023888391. + * @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 getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + let localVarHeaders = this.defaultHeaders; - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/all`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - /** - * Returns a page of works for an author. - * @endpoint get /api/works/{author_id} - * @param authorId The author id, for example A5023888391. - * @param page The page number. - * @param size The page size. - * @param publicationYear Filter by publication year. Can be repeated. - * @param type Filter by publication type. Can be repeated. - * @param language Filter by language code. Can be repeated. - * @param institutionId Filter by OpenAlex institution id. Can be repeated. - * @param topicId Filter by OpenAlex topic id. Can be repeated. - * @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 getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAuthorWorks( - authorId: string, - page?: number, - size?: number, - publicationYear?: Array, - type?: Array, - language?: Array, - institutionId?: Array, - topicId?: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getAuthorWorks.', - ); - } + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - if (publicationYear) { - publicationYear.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'publication_year', + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/all`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (type) { - type.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'type', + + /** + * Returns a page of works for an author. + * @endpoint get /api/works/{author_id} + * @param authorId The author id, for example A5023888391. + * @param page The page number. + * @param size The page size. + * @param publicationYear Filter by publication year. Can be repeated. + * @param type Filter by publication type. Can be repeated. + * @param language Filter by language code. Can be repeated. + * @param institutionId Filter by OpenAlex institution id. Can be repeated. + * @param topicId Filter by OpenAlex topic id. Can be repeated. + * @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 getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, institutionId?: Array, topicId?: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAuthorWorks.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + if (publicationYear) { + publicationYear.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'publication_year'); + }) + } + if (type) { + type.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'type'); + }) + } + if (language) { + language.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'language'); + }) + } + if (institutionId) { + institutionId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'institution_id'); + }) + } + if (topicId) { + topicId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic_id'); + }) + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (language) { - language.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'language', + + /** + * Returns work counts per primary topic for an author. + * @endpoint get /api/works/{author_id}/primary-topic-counts + * @param authorId The author id, for example A5023888391. + * @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 getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPrimaryTopicCountsByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/primary-topic-counts`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (institutionId) { - institutionId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'institution_id', + + /** + * Returns topics grouped by publication year for an author. + * @endpoint get /api/works/{author_id}/topics-by-time + * @param authorId The author id, for example A5023888391. + * @param maxTopicsPerYear The maximum number of topics per year. + * @param targetPublications Target number of publications used for the timeline. Complete years are always included. + * @param includeAll If true, all publications are used for the timeline. + * @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 getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + maxTopicsPerYear, 'max_topics_per_year'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + targetPublications, 'target_publications'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + includeAll, 'include_all'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/topics-by-time`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (topicId) { - topicId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic_id', + + /** + * 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(identifier: string, title?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getWork(identifier: string, title?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (identifier === null || identifier === undefined) { + throw new Error('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; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + 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, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns work counts per primary topic for an author. - * @endpoint get /api/works/{author_id}/primary-topic-counts - * @param authorId The author id, for example A5023888391. - * @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 getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPrimaryTopicCountsByAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/primary-topic-counts`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request>( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns topics grouped by publication year for an author. - * @endpoint get /api/works/{author_id}/topics-by-time - * @param authorId The author id, for example A5023888391. - * @param maxTopicsPerYear The maximum number of topics per year. - * @param targetPublications Target number of publications used for the timeline. Complete years are always included. - * @param includeAll If true, all publications are used for the timeline. - * @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 getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - maxTopicsPerYear, - 'max_topics_per_year', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - targetPublications, - 'target_publications', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - includeAll, - 'include_all', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/topics-by-time`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * 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( - identifier: string, - title?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getWork( - identifier: string, - title?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (identifier === null || identifier === undefined) { - throw new Error( - '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; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - 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, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } } diff --git a/webapp/src/app/api/configuration.ts b/webapp/src/app/api/configuration.ts index 17a7070e..2b8c80f7 100644 --- a/webapp/src/app/api/configuration.ts +++ b/webapp/src/app/api/configuration.ts @@ -1,219 +1,193 @@ -import { - HttpHeaders, - HttpParams, - HttpParameterCodec, -} from '@angular/common/http'; +import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Override the default method for encoding path parameters in various + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam?: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials?: {[ key: string ]: string | (() => string | undefined)}; } export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Encoding of various path parameter + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor({ - accessToken, - apiKeys, - basePath, - credentials, - encodeParam, - encoder, - password, - username, - withCredentials, - }: ConfigurationParameters = {}) { - if (apiKeys) { - this.apiKeys = apiKeys; - } - if (username !== undefined) { - this.username = username; - } - if (password !== undefined) { - this.password = password; - } - if (accessToken !== undefined) { - this.accessToken = accessToken; - } - if (basePath !== undefined) { - this.basePath = basePath; - } - if (withCredentials !== undefined) { - this.withCredentials = withCredentials; - } - if (encoder) { - this.encoder = encoder; - } - this.encodeParam = - encodeParam ?? ((param) => this.defaultEncodeParam(param)); - this.credentials = credentials ?? {}; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; + } + if (username !== undefined) { + this.username = username; + } + if (password !== undefined) { + this.password = password; + } + if (accessToken !== undefined) { + this.accessToken = accessToken; + } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; - // init default HTTPBearer credential - if (!this.credentials['HTTPBearer']) { - this.credentials['HTTPBearer'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType(contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; + // init default HTTPBearer credential + if (!this.credentials['HTTPBearer']) { + this.credentials['HTTPBearer'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } } - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; + const type = contentTypes.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; } - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } + + const type = accepts.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; } - return type; - } - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp( - '^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', - 'i', - ); - return ( - mime !== null && - (jsonMime.test(mime) || - mime.toLowerCase() === 'application/json-patch+json') - ); - } + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' ? value() : value; - } + public lookupCredential(key: string): string | undefined { + const value = this.credentials[key]; + return typeof value === 'function' + ? value() + : value; + } - public addCredentialToHeaders( - credentialKey: string, - headerName: string, - headers: HttpHeaders, - prefix?: string, - ): HttpHeaders { - const value = this.lookupCredential(credentialKey); - return value ? headers.set(headerName, (prefix ?? '') + value) : headers; - } + public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders { + const value = this.lookupCredential(credentialKey); + return value + ? headers.set(headerName, (prefix ?? '') + value) + : headers; + } - public addCredentialToQuery( - credentialKey: string, - paramName: string, - query: HttpParams, - ): HttpParams { - const value = this.lookupCredential(credentialKey); - return value ? query.set(paramName, value) : query; - } + public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + const value = this.lookupCredential(credentialKey); + return value + ? query.set(paramName, value) + : query; + } - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! + private defaultEncodeParam(param: Param): string { + // This implementation exists as fallback for missing configuration + // and for backwards compatibility to older typescript-angular generator versions. + // It only works for the 'simple' parameter style. + // Date-handling only works for the 'date-time' format. + // All other styles and Date-formats are probably handled incorrectly. + // + // But: if that's all you need (i.e.: the most common use-case): no need for customization! - const value = - param.dataFormat === 'date-time' && param.value instanceof Date - ? (param.value as Date).toISOString() - : param.value; + const value = param.dataFormat === 'date-time' && param.value instanceof Date + ? (param.value as Date).toISOString() + : param.value; - return encodeURIComponent(String(value)); - } + return encodeURIComponent(String(value)); + } } diff --git a/webapp/src/app/api/model/accessResponse.ts b/webapp/src/app/api/model/accessResponse.ts index f1610895..6a36e872 100644 --- a/webapp/src/app/api/model/accessResponse.ts +++ b/webapp/src/app/api/model/accessResponse.ts @@ -7,7 +7,6 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { RefreshToken } from './refreshToken'; import { AccessToken } from './accessToken'; @@ -16,9 +15,5 @@ export interface AccessResponse { * The access token issued upon successful authentication. */ access_token: AccessToken; - /** - * The refresh token issued alongside the access token for obtaining new access tokens. - */ - refresh_token: RefreshToken; } diff --git a/webapp/src/app/api/model/accessToken.ts b/webapp/src/app/api/model/accessToken.ts index ce3ea930..2c470009 100644 --- a/webapp/src/app/api/model/accessToken.ts +++ b/webapp/src/app/api/model/accessToken.ts @@ -12,10 +12,6 @@ import { UserRole } from './userRole'; export interface AccessToken { - /** - * The type of the token, which is always ACCESS_TOKEN for this class. - */ - token_type?: TokenType; /** * The unique identifier of the real account associated with this token. */ @@ -29,13 +25,13 @@ export interface AccessToken { */ epoch?: number; /** - * A hash of the user\'s fingerprint to ensure the token is used by the same user. + * The type of the token, which is always ACCESS_TOKEN for this class. + */ + token_type?: TokenType; + /** + * A unique fingerprint of the user, used for additional security checks. */ user_fingerprint_hash: string; - /** - * The raw token string. - */ - raw_token: string; /** * The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation. */ @@ -48,6 +44,10 @@ export interface AccessToken { * The unique identifier of the organization associated with this access token. */ effective_organization_id: string; + /** + * The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes. + */ + raw_token: string; } export namespace AccessToken { } diff --git a/webapp/src/app/api/model/accountProfile.ts b/webapp/src/app/api/model/accountProfile.ts index 52a9f7e6..58adefb8 100644 --- a/webapp/src/app/api/model/accountProfile.ts +++ b/webapp/src/app/api/model/accountProfile.ts @@ -26,3 +26,4 @@ export interface AccountProfile { export namespace AccountProfile { } + diff --git a/webapp/src/app/api/model/bodyRequestOtk.ts b/webapp/src/app/api/model/bodyRequestOtk.ts index 1600a002..ba1a396d 100644 --- a/webapp/src/app/api/model/bodyRequestOtk.ts +++ b/webapp/src/app/api/model/bodyRequestOtk.ts @@ -1,20 +1,22 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface BodyRequestOtk { - /** - * User\'s email address - */ - email: string; - /** - * User\'s password - */ - password: string; + +export interface BodyRequestOtk { + /** + * User\'s email address + */ + email: string; + /** + * User\'s password + */ + password: string; } + diff --git a/webapp/src/app/api/model/createOrganizationRequest.ts b/webapp/src/app/api/model/createOrganizationRequest.ts index 94aacb80..fffb5457 100644 --- a/webapp/src/app/api/model/createOrganizationRequest.ts +++ b/webapp/src/app/api/model/createOrganizationRequest.ts @@ -1,14 +1,16 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface CreateOrganizationRequest { - name: string; - other_inst_id?: string | null; + +export interface CreateOrganizationRequest { + name: string; + other_inst_id?: string | null; } + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts index 8fe10a5f..43731b7c 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -10,17 +10,19 @@ import { ExtractedKeywordsLLM } from './extractedKeywordsLLM'; import { ExtractedKeywords } from './extractedKeywords'; -export interface ExtractedKeywordsResponse { - results_llm?: ExtractedKeywordsLLM | null; - results?: ExtractedKeywords | null; - /** - * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. - */ - source: string; - source_url?: string | null; - /** - * The actual content from which keywords were extracted. - */ - source_content: string; - duration?: number | null; + +export interface ExtractedKeywordsResponse { + results_llm?: ExtractedKeywordsLLM | null; + results?: ExtractedKeywords | null; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; + duration?: number | null; } + diff --git a/webapp/src/app/api/model/idToken.ts b/webapp/src/app/api/model/idTokenMetadata.ts similarity index 72% rename from webapp/src/app/api/model/idToken.ts rename to webapp/src/app/api/model/idTokenMetadata.ts index e6a88cd3..5398083d 100644 --- a/webapp/src/app/api/model/idToken.ts +++ b/webapp/src/app/api/model/idTokenMetadata.ts @@ -10,11 +10,7 @@ import { TokenType } from './tokenType'; -export interface IdToken { - /** - * The type of the token, which is always ID_TOKEN for this class. - */ - token_type?: TokenType; +export interface IdTokenMetadata { /** * The unique identifier of the real account associated with this token. */ @@ -28,15 +24,11 @@ export interface IdToken { */ epoch?: number; /** - * A hash of the user\'s fingerprint to ensure the token is used by the same user. + * The type of the token, which is always ID_TOKEN for this class. */ - user_fingerprint_hash: string; - /** - * The raw token string. - */ - raw_token: string; + token_type?: TokenType; } -export namespace IdToken { +export namespace IdTokenMetadata { } diff --git a/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts index 47235351..c67acc71 100644 --- a/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts +++ b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts @@ -1,15 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface InseAccountManagementModelOrganizationProfile { - id: string; - name: string; - openalex_institution_id?: string | null; + +export interface InseAccountManagementModelOrganizationProfile { + id: string; + name: string; + openalex_institution_id?: string | null; } + diff --git a/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts index 8f9f0e6b..404df0f9 100644 --- a/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts +++ b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface InseOrganizationManagementModelOrganizationProfile { - id: string; - name: string; - other_inst_id?: string | null; - deleted: boolean; - member_count: number; + +export interface InseOrganizationManagementModelOrganizationProfile { + id: string; + name: string; + other_inst_id?: string | null; + deleted: boolean; + member_count: number; } + diff --git a/webapp/src/app/api/model/keywordTopicMatch.ts b/webapp/src/app/api/model/keywordTopicMatch.ts index ee4c8326..f9c2ab49 100644 --- a/webapp/src/app/api/model/keywordTopicMatch.ts +++ b/webapp/src/app/api/model/keywordTopicMatch.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,7 +9,9 @@ */ import { Topic } from './topic'; -export interface KeywordTopicMatch { - keyword: string; - topic?: Topic | null; + +export interface KeywordTopicMatch { + keyword: string; + topic?: Topic | null; } + diff --git a/webapp/src/app/api/model/keywordsTopicsRequest.ts b/webapp/src/app/api/model/keywordsTopicsRequest.ts index 883ed079..8810bf5f 100644 --- a/webapp/src/app/api/model/keywordsTopicsRequest.ts +++ b/webapp/src/app/api/model/keywordsTopicsRequest.ts @@ -1,16 +1,18 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface KeywordsTopicsRequest { - /** - * List of keywords/sentences to query by similarity. - */ - keywords: Array; + +export interface KeywordsTopicsRequest { + /** + * List of keywords/sentences to query by similarity. + */ + keywords: Array; } + diff --git a/webapp/src/app/api/model/keywordsTopicsResponse.ts b/webapp/src/app/api/model/keywordsTopicsResponse.ts index 78a2f9d2..4aee622f 100644 --- a/webapp/src/app/api/model/keywordsTopicsResponse.ts +++ b/webapp/src/app/api/model/keywordsTopicsResponse.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -9,9 +9,11 @@ */ import { KeywordTopicMatch } from './keywordTopicMatch'; -export interface KeywordsTopicsResponse { - /** - * Top matching topics for each keyword in the requested list. - */ - results: Array; + +export interface KeywordsTopicsResponse { + /** + * Top matching topics for each keyword in the requested list. + */ + results: Array; } + diff --git a/webapp/src/app/api/model/loginResponse.ts b/webapp/src/app/api/model/loginResponse.ts index 216d0fb0..c91eb493 100644 --- a/webapp/src/app/api/model/loginResponse.ts +++ b/webapp/src/app/api/model/loginResponse.ts @@ -1,17 +1,19 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -import { IdToken } from './idToken'; +import { IdTokenMetadata } from './idTokenMetadata'; -export interface LoginResponse { - /** - * The ID token issued upon successful login. - */ - id_token: IdToken; + +export interface LoginResponse { + /** + * The ID token issued upon successful login. + */ + id_token: IdTokenMetadata; } + diff --git a/webapp/src/app/api/model/matchedAuthor.ts b/webapp/src/app/api/model/matchedAuthor.ts index 311e2184..6194df94 100644 --- a/webapp/src/app/api/model/matchedAuthor.ts +++ b/webapp/src/app/api/model/matchedAuthor.ts @@ -1,14 +1,16 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface MatchedAuthor { - openalex_author_id: string; - author_name: string; + +export interface MatchedAuthor { + openalex_author_id: string; + author_name: string; } + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 7868aabe..3bf537d5 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -89,7 +89,7 @@ export * from './hEUReportSummary'; export * from './hEUTopic'; export * from './hEUWebLink'; export * from './hTTPValidationError'; -export * from './idToken'; +export * from './idTokenMetadata'; export * from './inseAccountManagementModelOrganizationProfile'; export * from './inseOrganizationManagementModelOrganizationProfile'; export * from './institution'; @@ -136,7 +136,6 @@ export * from './publicationDetailByFunder'; export * from './publicationIdsByAuthorPosition'; export * from './publicationsByAuthorResponse'; export * from './rankingResponse'; -export * from './refreshToken'; export * from './score'; export * from './sortDirection'; export * from './tokenType'; diff --git a/webapp/src/app/api/model/refreshToken.ts b/webapp/src/app/api/model/refreshToken.ts deleted file mode 100644 index 89506b70..00000000 --- a/webapp/src/app/api/model/refreshToken.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { TokenType } from './tokenType'; -import { UserRole } from './userRole'; - - -export interface RefreshToken { - /** - * The type of the token, which is always REFRESH_TOKEN for this class. - */ - token_type?: TokenType; - /** - * The unique identifier of the real account associated with this token. - */ - real_account_id: string; - /** - * The timestamp indicating when the token will expire. - */ - expires_at: string; - /** - * The epoch value for the token. Used for versioning of tokens. - */ - epoch?: number; - /** - * A hash of the user\'s fingerprint to ensure the token is used by the same user. - */ - user_fingerprint_hash: string; - /** - * The raw token string. - */ - raw_token: string; - /** - * The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation. - */ - effective_account_id: string; - /** - * The specific role this access token grants within its organization. - */ - effective_role?: UserRole; - /** - * The unique identifier of the organization associated with this access token. - */ - effective_organization_id: string; -} -export namespace RefreshToken { -} - - diff --git a/webapp/src/app/api/model/tokenType.ts b/webapp/src/app/api/model/tokenType.ts index 06231c11..a0efdc46 100644 --- a/webapp/src/app/api/model/tokenType.ts +++ b/webapp/src/app/api/model/tokenType.ts @@ -10,9 +10,9 @@ export const TokenType = { - Id: 'ID', - Refresh: 'REFRESH', - Access: 'ACCESS' + IdToken: 'ID_TOKEN', + RefreshToken: 'REFRESH_TOKEN', + AccessToken: 'ACCESS_TOKEN' } as const; export type TokenType = typeof TokenType[keyof typeof TokenType]; diff --git a/webapp/src/app/api/model/updateAccountRequest.ts b/webapp/src/app/api/model/updateAccountRequest.ts index 1d4389f7..efc4cea6 100644 --- a/webapp/src/app/api/model/updateAccountRequest.ts +++ b/webapp/src/app/api/model/updateAccountRequest.ts @@ -23,3 +23,4 @@ export interface UpdateAccountRequest { export namespace UpdateAccountRequest { } + diff --git a/webapp/src/app/api/model/updateOrganizationRequest.ts b/webapp/src/app/api/model/updateOrganizationRequest.ts index a56b51e7..e12063b6 100644 --- a/webapp/src/app/api/model/updateOrganizationRequest.ts +++ b/webapp/src/app/api/model/updateOrganizationRequest.ts @@ -1,15 +1,17 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -export interface UpdateOrganizationRequest { - name?: string | null; - other_inst_id?: string | null; - deleted?: boolean | null; + +export interface UpdateOrganizationRequest { + name?: string | null; + other_inst_id?: string | null; + deleted?: boolean | null; } + diff --git a/webapp/src/app/modules/app-login/app-login.component.ts b/webapp/src/app/modules/app-login/app-login.component.ts index db6739c5..a8bd7fea 100644 --- a/webapp/src/app/modules/app-login/app-login.component.ts +++ b/webapp/src/app/modules/app-login/app-login.component.ts @@ -91,7 +91,7 @@ export class AppLoginComponent implements OnDestroy { this.stopCountdown(); } - async requestOtk() { + requestOtk() { if (this.credentialsForm.invalid || this.isSubmitting) { this.credentialsForm.markAllAsTouched(); return; @@ -103,36 +103,35 @@ export class AppLoginComponent implements OnDestroy { const email = this.credentialsForm.controls.email.value ?? ''; const password = this.credentialsForm.controls.password.value ?? ''; - try { - const otkResponse = await this.credentialService.requestOtk( - email, - password, - ); - const accountId = otkResponse.account_id; - this.accountId = accountId; - this.currentStep = 'otk'; - this.otkForm.reset(); - this.startCountdown(); - this.snackBar.open( - 'OTK-Code wurde an die E-Mail-Adresse gesendet.', - 'OK', - { - duration: 4000, - }, - ); - } catch (error: unknown) { - this.credentialService.clearLocalAuthState(); - this.snackBar.open( - this.getLoginErrorMessage(error as HttpErrorResponse), - 'OK', - { - duration: 5000, - }, - ); - } finally { - this.isSubmitting = false; - this.credentialsForm.enable(); - } + this.credentialService.requestOtk(email, password).subscribe({ + next: (otkResponse) => { + const accountId = otkResponse.account_id; + this.accountId = accountId; + this.currentStep = 'otk'; + this.otkForm.reset(); + this.startCountdown(); + this.snackBar.open( + 'OTK-Code wurde an die E-Mail-Adresse gesendet.', + 'OK', + { + duration: 4000, + }, + ); + }, + error: (error: unknown) => { + this.snackBar.open( + this.getLoginErrorMessage(error as HttpErrorResponse), + 'OK', + { + duration: 5000, + }, + ); + }, + complete: () => { + this.isSubmitting = false; + this.credentialsForm.enable(); + }, + }); } resendCode() { @@ -143,7 +142,7 @@ export class AppLoginComponent implements OnDestroy { this.requestOtk(); } - async login() { + login() { if (this.otkForm.invalid || this.isSubmitting) { this.otkForm.markAllAsTouched(); return; @@ -170,23 +169,30 @@ export class AppLoginComponent implements OnDestroy { const code = this.otkForm.controls.code.value ?? ''; - try { - await this.credentialService.loginWithOtk(this.accountId, code); - this.stopCountdown(); - this.router.navigate(['/dashboard']); - } catch (error: unknown) { - this.credentialService.clearLocalAuthState(); - this.snackBar.open( - this.getLoginErrorMessage(error as HttpErrorResponse), - 'OK', - { - duration: 5000, - }, - ); - } finally { - this.isSubmitting = false; - this.otkForm.enable(); - } + this.credentialService.loginWithOtk(this.accountId, code).subscribe({ + next: () => { + this.credentialService.reauthenticateViaIdToken().subscribe({ + next: () => { + this.checkEnter(); + this.stopCountdown(); + this.router.navigate(['/dashboard']); + }, + }); + }, + error: (error: unknown) => { + this.snackBar.open( + this.getLoginErrorMessage(error as HttpErrorResponse), + 'OK', + { + duration: 5000, + }, + ); + }, + complete: () => { + this.isSubmitting = false; + this.otkForm.enable(); + }, + }); } editCredentials() { diff --git a/webapp/src/app/shared/interceptors/authentication.interceptor.ts b/webapp/src/app/shared/interceptors/authentication.interceptor.ts index 194799a2..08113260 100644 --- a/webapp/src/app/shared/interceptors/authentication.interceptor.ts +++ b/webapp/src/app/shared/interceptors/authentication.interceptor.ts @@ -5,69 +5,100 @@ import { } from '@angular/common/http'; import { inject } from '@angular/core'; import { Router } from '@angular/router'; -import { catchError, throwError } from 'rxjs'; -import { CredentialService } from '../services/credential.service'; +import { catchError, switchMap, throwError } from 'rxjs'; +import { + CredentialService, + clearStoredAuthState, + REQUIRED_TOKEN_TYPE, + TOKEN_TYPE, +} from '../services/credential.service'; -const UNAUTHENTICATED_POST_ENDPOINTS = [ - '/api/auth/v2/request-otk', - '/api/auth/v2/login', - '/institutions/autocomplete', -]; - -const isUnauthenticatedPostRequest = (req: any) => { - const url = req.url.split('?')[0]; - return ( - req.method === 'POST' && - UNAUTHENTICATED_POST_ENDPOINTS.some((endpoint) => url.endsWith(endpoint)) - ); -}; - -export const authenticationInterceptor: HttpInterceptorFn = (req, next) => { - const url = req.url.split('?')[0]; - - if (isUnauthenticatedPostRequest(req)) { - return next(req); - } - - const credentialService = inject(CredentialService); - const router = inject(Router); - - if (!credentialService.isActiveIdentityToken()) { - void router.navigate(['/login']); - return throwError(() => new Error('No valid identity token')); - } - const idToken = credentialService.identityToken(); - let bearerToken: string; - if (url.endsWith('/api/auth/v2/access')) { - bearerToken = idToken?.raw_token ?? ''; - } else { - if (!credentialService.isActiveAccessToken()) { - credentialService.refreshAccessToken(idToken!); - } - const accessToken = credentialService.accessToken(); - if (!accessToken) { - void router.navigate(['/login']); - return throwError(() => new Error('No valid access token')); - } - return next(attachToken(req, accessToken.raw_token)); - } - const authorizedRequest = req.clone({ - headers: req.headers.set('Authorization', 'Bearer ' + bearerToken), - }); - - return next(authorizedRequest).pipe( - catchError((error: HttpErrorResponse) => { - console.error('Authentication error:', error); - return throwError(() => error); - }), - ); -}; - -const attachToken = ( - req: HttpRequest, +const attachBearer = ( + req: HttpRequest, token: string, -): HttpRequest => { +): HttpRequest => { + if (!token) { + return req; + } return req.clone({ headers: req.headers.set('Authorization', 'Bearer ' + token), }); }; + +const handleAccessTokenError = ( + error: unknown, + req: HttpRequest, + next: Parameters[1], + credentialService: CredentialService, + router: Router, +) => { + if (!(error instanceof HttpErrorResponse) || error.status !== 401) { + return throwError(() => error); + } + + if (!credentialService.getRawAccessToken()) { + credentialService.logout(); + router.navigate(['/login'], { replaceUrl: true }); + return throwError(() => error); + } + + return credentialService.refreshAccessToken().pipe( + switchMap((accessToken) => next(attachBearer(req, accessToken.raw_token))), + catchError((refreshError) => { + credentialService.logout(); + router.navigate(['/login'], { replaceUrl: true }); + return throwError(() => refreshError); + }), + ); +}; + +export const authenticationInterceptor: HttpInterceptorFn = (req, next) => { + const router = inject(Router); + + const requiredType = req.context.get(REQUIRED_TOKEN_TYPE); + + if (requiredType === TOKEN_TYPE.NONE) { + return next(req); + } + + if (requiredType === TOKEN_TYPE.ID_TOKEN_COOKIE) { + return next(req.clone({ withCredentials: true })).pipe( + catchError((err) => { + if (err instanceof HttpErrorResponse && err.status === 401) { + clearStoredAuthState(); + router.navigate(['/login'], { replaceUrl: true }); + } + return throwError(() => err); + }), + ); + } + + if (requiredType === TOKEN_TYPE.REFRESH_TOKEN_COOKIE) { + return next(req.clone({ withCredentials: true })); + } + + const credentialService = inject(CredentialService); + + const rawAccessToken = credentialService.getRawAccessToken(); + + if (rawAccessToken && credentialService.accessTokenIsExpired()) { + return credentialService.refreshAccessToken().pipe( + switchMap((accessToken) => + next(attachBearer(req, accessToken.raw_token)), + ), + catchError(() => { + credentialService.logout(); + router.navigate(['/login'], { replaceUrl: true }); + return throwError( + () => new Error('Sitzung abgelaufen. Bitte erneut anmelden.'), + ); + }), + ); + } + + return next(rawAccessToken ? attachBearer(req, rawAccessToken) : req).pipe( + catchError((err) => + handleAccessTokenError(err, req, next, credentialService, router), + ), + ); +}; diff --git a/webapp/src/app/shared/services/credential.service.ts b/webapp/src/app/shared/services/credential.service.ts index be87cb65..e70311a2 100644 --- a/webapp/src/app/shared/services/credential.service.ts +++ b/webapp/src/app/shared/services/credential.service.ts @@ -1,17 +1,55 @@ import { Injectable, computed, effect, inject, signal } from '@angular/core'; import { toObservable, toSignal } from '@angular/core/rxjs-interop'; -import { firstValueFrom, Observable, of, switchMap, throwError } from 'rxjs'; +import { + catchError, + finalize, + firstValueFrom, + map, + Observable, + of, + shareReplay, + switchMap, + tap, + throwError, +} from 'rxjs'; import { AccessResponse, - AccessToken, AuthService, - IdToken, AccountProfile, - RefreshToken, OtkResponse, + IdTokenMetadata, + AccessToken, + LoginResponse, } from '../../api'; import { Router } from '@angular/router'; +import { HttpContext, HttpContextToken } from '@angular/common/http'; + +export const TOKEN_TYPE = { + ACCESS_TOKEN: 'ACCESS_TOKEN', + ID_TOKEN_COOKIE: 'ID_TOKEN_COOKIE', + REFRESH_TOKEN_COOKIE: 'REFRESH_TOKEN_COOKIE', + NONE: 'NONE', +} as const; + +export type TokenContextType = (typeof TOKEN_TYPE)[keyof typeof TOKEN_TYPE]; + +export const REQUIRED_TOKEN_TYPE = new HttpContextToken( + () => TOKEN_TYPE.ACCESS_TOKEN, +); + +const STORAGE_KEY = 'auth_state'; + +export const clearStoredAuthState = (): void => { + localStorage.removeItem(STORAGE_KEY); +}; + +export interface StoredAuthState { + idTokenMetadata: IdTokenMetadata | null; + accessToken: AccessToken | null; +} + +const EXPIRY_SKEW_MS = 10 * 1000; // 10 seconds @Injectable({ providedIn: 'root', @@ -19,10 +57,6 @@ import { Router } from '@angular/router'; export class CredentialService { private readonly authService = inject(AuthService); - private static readonly KEY_IDENTITY_TOKEN = 'identity_token'; - private static readonly KEY_REFRESH_TOKEN = 'refresh_token'; - private static readonly KEY_ACCESS_TOKEN = 'access_token'; - public readonly isValidating = signal(false); public readonly isAuthenticated = computed( () => this.accessToken() !== undefined, @@ -59,18 +93,8 @@ export class CredentialService { () => this.realAccountId() !== this.effectiveAccountId(), ); - public readonly identityToken = signal(undefined); - public readonly refreshToken = signal(undefined); public readonly accessToken = signal(undefined); - public readonly isActiveIdentityToken = computed(() => { - const idToken = this.identityToken(); - return ( - idToken !== undefined && - new Date(idToken.expires_at).getTime() >= Date.now() - ); - }); - public readonly isActiveAccessToken = computed(() => { const accessToken = this.accessToken(); return ( @@ -80,9 +104,9 @@ export class CredentialService { }); public readonly accountProfile = toSignal( - toObservable(this.isAuthenticated).pipe( - switchMap((isAuthenticated) => - isAuthenticated + toObservable(this.accessToken).pipe( + switchMap((accessToken) => + accessToken ? this.authService.getCurrentAccount() : of(undefined), ), @@ -90,216 +114,262 @@ export class CredentialService { { initialValue: undefined }, ); + private refreshInFlight$: Observable | null = null; + private request = 0; - loadTokensFromStorage(): void { - const idTokenData = localStorage.getItem( - CredentialService.KEY_IDENTITY_TOKEN, - ); - const refreshTokenData = localStorage.getItem( - CredentialService.KEY_REFRESH_TOKEN, - ); - const accessTokenData = localStorage.getItem( - CredentialService.KEY_ACCESS_TOKEN, - ); - - if (idTokenData) { - this.identityToken.set(JSON.parse(idTokenData) as IdToken); - } - if (refreshTokenData) { - this.refreshToken.set(JSON.parse(refreshTokenData) as RefreshToken); - } - if (accessTokenData) { - this.accessToken.set(JSON.parse(accessTokenData) as AccessToken); - } - } - - storeIdentityToken(idToken: IdToken): void { - this.identityToken.set(idToken); - localStorage.setItem( - CredentialService.KEY_IDENTITY_TOKEN, - JSON.stringify(idToken), - ); - } - - storeRefreshToken(refreshToken: RefreshToken): void { - this.refreshToken.set(refreshToken); - localStorage.setItem( - CredentialService.KEY_REFRESH_TOKEN, - JSON.stringify(refreshToken), - ); - } - - storeAccessToken(accessToken: AccessToken): void { - this.accessToken.set(accessToken); - localStorage.setItem( - CredentialService.KEY_ACCESS_TOKEN, - JSON.stringify(accessToken), - ); - } - - clearTokensFromStorage(): void { - localStorage.removeItem(CredentialService.KEY_IDENTITY_TOKEN); - localStorage.removeItem(CredentialService.KEY_REFRESH_TOKEN); - localStorage.removeItem(CredentialService.KEY_ACCESS_TOKEN); - } - constructor(private readonly router: Router) { - this.loadTokensFromStorage(); + this.restoreAuthState(); + effect(() => { - console.log('IdToken', this.identityToken()); - console.log('RefreshToken', this.refreshToken()); - console.log('AccessToken', this.accessToken()); + console.log('Access token changed:', this.accessToken()); }); - const id = this.identityToken(); - if (id && new Date(id.expires_at).getTime() >= Date.now()) { - this.isValidating.set(true); - setTimeout(() => this.refreshAccessToken(id), 0); + + const storedAccessToken = this.getStoredAccessToken(); + if (storedAccessToken && this.isExpired(storedAccessToken)) { + this.refreshAccessToken().subscribe({ + error: (err) => { + console.error('Error refreshing access token on init:', err); + this.logout(); + this.router.navigate(['/login'], { replaceUrl: true }); + }, + }); } } - public async requestOtk( - email: string, - password: string, - ): Promise { - this.isValidating.set(true); - this.identityToken.set(undefined); - this.accessToken.set(undefined); - - const otkResponse: OtkResponse = await firstValueFrom( - this.authService.requestOtk({ - email: email.trim().toLowerCase(), - password, - }), - ); - - this.isValidating.set(false); - return otkResponse; + private restoreAuthState(): void { + this.accessToken.set(this.getStoredAccessToken() ?? undefined); } - public async loginWithOtk( + private readAuthState(): StoredAuthState { + const raw = localStorage.getItem(STORAGE_KEY); + if (!raw) { + return { idTokenMetadata: null, accessToken: null }; + } + try { + return JSON.parse(raw) as StoredAuthState; + } catch { + return { idTokenMetadata: null, accessToken: null }; + } + } + + private writeAuthState(patch: Partial): void { + const next: StoredAuthState = { + ...this.readAuthState(), + ...patch, + }; + localStorage.setItem(STORAGE_KEY, JSON.stringify(next)); + } + + private persistAccessToken(accessToken: AccessToken | null): void { + this.writeAuthState({ accessToken }); + this.accessToken.set(accessToken ?? undefined); + } + + private getStoredIdTokenMetadata(): IdTokenMetadata | null { + return this.readAuthState().idTokenMetadata; + } + + private getStoredAccessToken(): AccessToken | null { + return this.readAuthState().accessToken; + } + + private isExpired(token: { expires_at: string }): boolean { + return new Date(token.expires_at).getTime() < Date.now() + EXPIRY_SKEW_MS; + } + + public accessTokenIsExpired(): boolean { + const accessToken = this.getStoredAccessToken(); + return !accessToken || this.isExpired(accessToken); + } + + public logout() { + clearStoredAuthState(); + this.accessToken.set(undefined); + this.refreshInFlight$ = null; + } + + public requestOtk(email: string, password: string): Observable { + return this.authService.requestOtk( + { + email: email.trim(), + password: password.trim(), + }, + undefined, + undefined, + { context: new HttpContext().set(REQUIRED_TOKEN_TYPE, TOKEN_TYPE.NONE) }, + ); + } + + public loginWithOtk( accountId: string, emailCode: string, - ): Promise { - const request = ++this.request; - this.isValidating.set(true); + ): Observable { + return this.authService + .login( + { + account_id: accountId, + email_code: emailCode.trim(), + }, + undefined, + undefined, + { + context: new HttpContext().set(REQUIRED_TOKEN_TYPE, TOKEN_TYPE.NONE), + }, + ) + .pipe( + tap(({ id_token }) => + this.writeAuthState({ idTokenMetadata: id_token }), + ), + ); + } - const loginResponse = await firstValueFrom( - this.authService.login({ - account_id: accountId, - email_code: emailCode.trim(), + public requestAccess( + realAccountId: string, + effectiveAccountId?: string, + ): Observable { + return this.authService + .getAccessToken( + { + real_account_id: realAccountId, + effective_account_id: effectiveAccountId ?? realAccountId, + }, + undefined, + 'body', + undefined, + { + context: new HttpContext().set( + REQUIRED_TOKEN_TYPE, + TOKEN_TYPE.ID_TOKEN_COOKIE, + ), + }, + ) + .pipe( + tap(({ access_token }) => { + this.persistAccessToken(access_token); + }), + ); + } + + public changePassword( + currentPassword: string, + newPassword: string, + ): Observable { + this.isValidating.set(true); + return this.authService + .changePassword({ + current_password: currentPassword, + new_password: newPassword, + }) + .pipe( + tap(() => this.isValidating.set(false)), + catchError((err) => { + this.isValidating.set(false); + return throwError(() => err); + }), + ); + } + + public refreshAccessToken(): Observable { + if (this.refreshInFlight$) { + return this.refreshInFlight$; + } + + this.refreshInFlight$ = this.authService + .refreshAccessToken(undefined, 'body', undefined, { + context: new HttpContext().set( + REQUIRED_TOKEN_TYPE, + TOKEN_TYPE.REFRESH_TOKEN_COOKIE, // 'REFRESH_TOKEN_COOKIE' and NOT 'REFRESH_COOKIE', + 30 Minutes debugging this shit, changed to types + ), + }) + .pipe( + tap((accessToken) => { + this.persistAccessToken(accessToken); + }), + catchError(() => this.reauthenticateViaIdToken()), + finalize(() => { + this.refreshInFlight$ = null; + }), + shareReplay(1), + ); + + return this.refreshInFlight$; + } + + reauthenticateViaIdToken(): Observable { + const idTokenMetadata = this.getStoredIdTokenMetadata(); + + if (!idTokenMetadata || this.isExpired(idTokenMetadata)) { + this.logout(); + return throwError( + () => new Error('No valid ID token metadata available.'), + ); + } + + return this.requestAccess( + idTokenMetadata.real_account_id, + idTokenMetadata.real_account_id, + ).pipe( + map(({ access_token }) => access_token), + catchError((err) => { + console.error('Error reauthenticating via ID token:', err); + this.logout(); + return throwError(() => err); }), ); - - const idToken = loginResponse.id_token; - this.identityToken.set(idToken); - this.storeIdentityToken(idToken); - - this.isValidating.set(false); - await this.getAccessToken(idToken, request); } - public async refreshAccessToken(identityToken: IdToken) { - const request = ++this.request; - this.isValidating.set(true); - this.accessToken.set(undefined); - - await this.getAccessToken(identityToken, request).catch((err) => { - if (this.request === request) { - this.clearLocalAuthState(); - } - throw err; - }); - - this.isValidating.set(false); + public getRawAccessToken(): string | undefined { + return this.getStoredAccessToken()?.raw_token; } - public async impersonateAccount(accountId: string): Promise { - const idToken = this.identityToken(); - - if (!idToken) { - throw new Error('No identity token available.'); + public async impersonateAccount(effectiveAccountId: string): Promise { + const realAccountId = this.getStoredIdTokenMetadata()?.real_account_id; + if (!realAccountId) { + throw new Error('No real account ID available.'); } const request = ++this.request; this.isValidating.set(true); - this.accessToken.set(undefined); - await this.getAccessToken(idToken, request, accountId).catch((err) => { - if (this.request === request) { - this.clearLocalAuthState(); + + try { + await firstValueFrom( + this.requestAccess(realAccountId, effectiveAccountId), + ); + } finally { + if (request === this.request) { + this.isValidating.set(false); } - throw err; - }); - this.isValidating.set(false); + } } public async stopImpersonating(): Promise { - const idToken = this.identityToken(); + this.isValidating.set(true); - if (!idToken) { - throw new Error('No identity token available.'); + const realAccountId = this.getStoredIdTokenMetadata()?.real_account_id; + if (!realAccountId) { + throw new Error('No real account ID available.'); } - const request = ++this.request; - this.isValidating.set(true); - this.accessToken.set(undefined); - await this.getAccessToken(idToken, request); - this.isValidating.set(false); + try { + await firstValueFrom(this.requestAccess(realAccountId, realAccountId)); + } finally { + this.isValidating.set(false); + } } - public async logoutAccount() { - await firstValueFrom(this.authService.logout()); - this.clearLocalAuthState(); - } - - public clearLocalAuthState(): void { - this.request += 1; - this.clearTokensFromStorage(); - this.identityToken.set(undefined); - this.accessToken.set(undefined); - this.isValidating.set(false); - this.router.navigate(['/login'], { replaceUrl: true }); - } - - public async changePassword( - currentPassword: string, - newPassword: string, - ): Promise { - this.isValidating.set(true); - await firstValueFrom( - this.authService.changePassword({ - current_password: currentPassword, - new_password: newPassword, - }), - ); - this.clearLocalAuthState(); - this.isValidating.set(false); + public async logoutAccount(): Promise { + try { + await firstValueFrom(this.authService.logout()); + } catch (err) { + console.error('Error logging out on the server:', err); + } finally { + this.logout(); + await this.router.navigate(['/login'], { replaceUrl: true }); + } } public registerAccount(_data: unknown): Observable { return throwError(() => new Error('Registration is temporarily disabled.')); } - - private async getAccessToken( - idToken: IdToken, - request: number, - effectiveAccountId?: string, - ): Promise { - if (this.request !== request) { - return; - } - - const realAccountId = idToken.real_account_id; - - const result: AccessResponse = await firstValueFrom( - this.authService.getAccessToken({ - real_account_id: realAccountId, - effective_account_id: effectiveAccountId ?? realAccountId, - }), - ); - - this.accessToken.set(result.access_token); - this.refreshToken.set(result.refresh_token); - this.isValidating.set(false); - } } diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts index bee7ed7c..abd2f2ec 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts @@ -105,12 +105,11 @@ export class AppLayoutComponent implements OnInit, OnDestroy { async logout() { const isImpersonating = this.credentialService.isImpersonating(); - await this.credentialService.stopImpersonating(); - if (isImpersonating) { + await this.credentialService.stopImpersonating(); this.router.navigate(['/accounts']); } else { - this.router.navigate(['/login']); + await this.credentialService.logoutAccount(); } } diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index 9ce28c8d..f39ff565 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -142,9 +142,7 @@ export class AppMenuComponent { label: 'Navigation', items: this.navItems.filter( (item) => - !item.adminOnly && - !item.superAdminOnly && - !item.managerOrAdminOnly, + !item.adminOnly && !item.superAdminOnly && !item.managerOrAdminOnly, ), }, { @@ -181,9 +179,7 @@ export class AppMenuComponent { }); dialogRef.componentInstance.confirmDelete.subscribe(() => { - this.credentialService.logoutAccount().then(() => { - this.router.navigate(['/login']); - }); + void this.credentialService.logoutAccount(); }); } } From b2d965d60457b8e4c54849b29c7ce05a40dbdd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 5 Jul 2026 16:15:41 +0200 Subject: [PATCH 77/92] fix(frontend): added label to some query param selectors --- .../institutions/institutions.component.html | 6 ++++-- .../institutions/institutions.component.scss | 2 +- .../src/app/modules/patents/patents.component.html | 13 +++++-------- webapp/src/app/modules/patents/patents.component.ts | 11 +++++++++++ .../app/modules/projects/projects.component.html | 6 ++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/webapp/src/app/modules/institutions/institutions.component.html b/webapp/src/app/modules/institutions/institutions.component.html index 0ec24397..5edb4c3c 100644 --- a/webapp/src/app/modules/institutions/institutions.component.html +++ b/webapp/src/app/modules/institutions/institutions.component.html @@ -12,11 +12,13 @@
+ [queryParamKey]="'sort_by'" + label="Sortieren nach" /> + [queryParamKey]="'sorting_order'" + label="Sortierreihenfolge" />
diff --git a/webapp/src/app/modules/institutions/institutions.component.scss b/webapp/src/app/modules/institutions/institutions.component.scss index 7303fdd7..8edbecef 100644 --- a/webapp/src/app/modules/institutions/institutions.component.scss +++ b/webapp/src/app/modules/institutions/institutions.component.scss @@ -25,7 +25,7 @@ .cards { display: grid; gap: 1.5rem; - grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(550px, 1fr)); padding: 0 1rem; } diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 14a37666..60086f40 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -26,14 +26,11 @@ USPTO -
- -
+ diff --git a/webapp/src/app/modules/patents/patents.component.ts b/webapp/src/app/modules/patents/patents.component.ts index adfd23e2..0eb946dc 100644 --- a/webapp/src/app/modules/patents/patents.component.ts +++ b/webapp/src/app/modules/patents/patents.component.ts @@ -15,6 +15,10 @@ import { debounceTime, distinctUntilChanged, Subject } from 'rxjs'; import { PatentsService } from '../../api/api/patents.service'; import { PatentEntry } from '../../api/model/patentEntry'; import { IpcClassification } from '../../api'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../../shared/ui/query-param-selector/query-param-selector.component'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; type ClassificationSystem = 'IPC' | 'CPC'; @@ -44,6 +48,7 @@ const DESCRIPTION_PREVIEW_LENGTH = 140; MatProgressSpinnerModule, MatChipsModule, MatDividerModule, + QueryParamSelectorComponent, ], templateUrl: './patents.component.html', styleUrl: './patents.component.scss', @@ -71,6 +76,12 @@ export class PatentsComponent implements OnInit { private searchSubject = new Subject(); + sortingDirectionOptions: SelectorOption[] = [ + { value: '', display_name: '' }, + { value: 'asc', display_name: 'Aufsteigend' }, + { value: 'desc', display_name: 'Absteigend' }, + ]; + constructor() { this.searchSubject .pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed()) diff --git a/webapp/src/app/modules/projects/projects.component.html b/webapp/src/app/modules/projects/projects.component.html index 706f34fb..b2bcbddf 100644 --- a/webapp/src/app/modules/projects/projects.component.html +++ b/webapp/src/app/modules/projects/projects.component.html @@ -28,11 +28,13 @@
+ queryParamKey="sort_by" + label="Sortieren nach" /> + queryParamKey="sorting_order" + label="Sortierreihenfolge" />
From 04eb0f0185f272f0d594ca4162cb2706e8b28727 Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 18:01:10 +0200 Subject: [PATCH 78/92] fixed bug with no url content --- service/src/main/inse/keywords/logic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index 81ba9f57..e329fb56 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -140,7 +140,11 @@ async def extract_keywords_stream_enriched( if mode == "url": await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump()) text = await _get_text_content(query) - await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) + if text: + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) + else: + await emit(KeywordsWsEvent(type="error", message=f"Fehler beim Abrufen des Inhalts von {query}").model_dump()) + raise RuntimeError(f"Failed to fetch content from {query}") system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query From 0c3db967b04530108507d85527e5b5c7ad65309e Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 18:01:54 +0200 Subject: [PATCH 79/92] added handling autocomplete topics ( no extra backend call anymore) --- .../topic-autocomplete.component.html | 4 +- .../topic-autocomplete.component.ts | 59 +++++++++++++------ 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html index d23c2dc0..5be3be18 100644 --- a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html @@ -45,7 +45,9 @@ } @for (topic of topics(); track topic) { - {{ topic }} + {{ + topic.display_name + }} } @if ( diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts index 6b14edd7..9dbb3796 100644 --- a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts @@ -19,6 +19,7 @@ import { of, switchMap, } from 'rxjs'; +import { Topic } from '../../../api'; @Component({ selector: 'app-topic-autocomplete', @@ -42,10 +43,10 @@ export class TopicAutocompleteComponent { readonly minCharacters = input(2); readonly limit = input(12); - readonly topicSelected = output(); + readonly topicSelected = output(); readonly searchControl = new FormControl('', { nonNullable: true }); - readonly topics = signal([]); + readonly topics = signal([]); readonly loading = signal(false); constructor( @@ -60,12 +61,12 @@ export class TopicAutocompleteComponent { const normalizedQuery = query.trim(); if (normalizedQuery.length < this.minCharacters()) { this.loading.set(false); - return of([] as string[]); + return of([]); } this.loading.set(true); return this.topicsService - .autocompleteTopics( + .listTopics( normalizedQuery, undefined, undefined, @@ -73,21 +74,19 @@ export class TopicAutocompleteComponent { this.limit(), ) .pipe( - map((response) => - Array.from( - new Set( - (response.results ?? []) - .map((topic) => topic.display_name?.trim() ?? '') - .filter((topic) => !!topic), - ), - ), - ), + map(({ results }) => { + const seen = new Map(); + for (const topic of results ?? []) { + if (topic?.id != null) seen.set(String(topic.id), topic); + } + return Array.from(seen.values()); + }), catchError((error) => { console.error( 'Error fetching topic autocomplete options:', error, ); - return of([] as string[]); + return of([] as Topic[]); }), finalize(() => this.loading.set(false)), ); @@ -101,19 +100,45 @@ export class TopicAutocompleteComponent { selectTopic(topic: string): void { this.searchControl.setValue('', { emitEvent: false }); + const selectedTopic = this.getTopicByDisplayName(topic); this.topics.set([]); - this.topicSelected.emit(topic); + if (selectedTopic) { + this.topicSelected.emit(selectedTopic); + } else { + const newTopic: Topic = { + display_name: topic, + id: null, + }; + this.topicSelected.emit(newTopic); + } } onKeydownTab(event: KeyboardEvent): void { event.preventDefault(); - this.searchControl.setValue(this.topics()[0], { emitEvent: false }); + const first = this.topics()[0]; + if (!first) return; + this.searchControl.setValue(first.display_name ?? '', { emitEvent: false }); + } + getTopicByDisplayName(displayName: string): Topic | undefined { + const normalized = displayName.trim().toLowerCase(); + return this.topics().find( + (topic) => topic.display_name?.trim().toLowerCase() === normalized, + ); } submitCurrentValue(): void { const topic = this.searchControl.value.trim(); if (!topic) return; this.searchControl.setValue('', { emitEvent: false }); this.topics.set([]); - this.topicSelected.emit(topic); + const selectedTopic = this.getTopicByDisplayName(topic); + if (selectedTopic) { + this.topicSelected.emit(selectedTopic); + } else { + const newTopic: Topic = { + display_name: topic, + id: null, + }; + this.topicSelected.emit(newTopic); + } } clear(): void { From 1eaf8f8c8ffe4df6a7d14faf2ff6aea41cf1c1f8 Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 18:09:59 +0200 Subject: [PATCH 80/92] responsivness adjusted --- .../keywords-search.component.html | 381 ++++++++------- .../keywords-search.component.scss | 434 ++++++++---------- .../keywords-search.component.ts | 119 +++-- 3 files changed, 479 insertions(+), 455 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 5f4f27b9..e1de98d3 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -71,27 +71,29 @@ (expandedChange)="onSubfieldLegendExpandedChange($event)"> } - @if (extractedKeywordsExist()) { -
+ + +
+ @if (keywordsExist()) {
-
- @if (areAllExtractedSelected()) { +
+ @if (areAllSelected()) { } @else { }
@@ -126,170 +128,216 @@
-
- -
+ } @else { + +
+ } + +
+
+
+
+ + + + @if (keywords.length > 0) { +
+ @for (keyword of keywords; track keyword.llm_keyword.keyword) { + + + } +
+ } @else { +

{{ emptyText }}

} - - -
- -
-
Breite Keywords
-
Coarse Keywords
-
- Fine Keywords -
-
Eigene Keywords
+ + + +
+ @if (manualKeywords().length > 0) { + @for ( + keyword of manualKeywords(); + track keyword.llm_keyword.keyword + ) { +
+ + + +
+ } + } @else if (loadingNewKeyword()) { +
+ + +
+ } @else { +

Nichts hinzugefügt

+ }
+
- -
-
- @if (broadKeywords().length > 0) { -
- - @for ( - keyword of broadKeywords(); - track keyword.llm_keyword.keyword - ) { - - - } -
- } @else { -

Nichts extrahiert

- } + + @if (!isMobile()) { +
+
+
Breite Keywords
+
Coarse Keywords
+
+ Fine Keywords +
+
Eigene Keywords
-
- @if (coarseKeywords().length > 0) { -
- @for ( - keyword of coarseKeywords(); - track keyword.llm_keyword.keyword - ) { - - - } -
- } @else { -

Nichts extrahiert

- } -
+
+
+ +
-
- @if (fineKeywords().length > 0) { -
- @for ( - keyword of fineKeywords(); - track keyword.llm_keyword.keyword - ) { - - - } -
- } @else { -

Nichts extrahiert

- } -
-
-
- @if (manualKeywords().length > 0) { - @for ( - keyword of manualKeywords(); - track keyword.llm_keyword.keyword - ) { -
- - - -
- } - } @else if (loadingNewKeyword()) { -
- - -
- } @else { -

Nichts hinzugefügt

- } +
+ +
+ +
+ +
+ +
+
-
+ } @else { + + + + + Breit + {{ broadKeywords().length }} + +
+ +
+
+ + + + Coarse + {{ coarseKeywords().length }} + +
+ +
+
+ + + + Fine + {{ fineKeywords().length }} + +
+ +
+
+ + + + Eigene + {{ manualKeywords().length }} + +
+ +
+
+
+ } @if (isExtracting()) {
@@ -300,14 +348,13 @@
{{ statusMessage() }}
- } @else if ( - !extractedKeywordsExist() && manualKeywords().length === 0 - ) { + } @else if (!keywordsExist()) {

- Keine Keywords vorhanden. Extrahiere Keywords oder füge eigene - hinzu. + Noch keine Keywords vorhanden. Extrahiere Keywords aus URL/Text + oder füge oben eigene Keywords hinzu.

} + @if (sourceContent().length > 0) { diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index d92e54be..cfa3f8b9 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -1,8 +1,21 @@ +/* ============================================================ + DESIGN TOKENS / LOCAL VARIABLES + ============================================================ */ +$phone: 599px; +$tablet: 900px; +$touch-target: 44px; + +/* ============================================================ + BASE LAYOUT — container becomes the responsive anchor + ============================================================ */ .content { + container-type: inline-size; + container-name: keyword-tool; + display: flex; flex-direction: column; - gap: 0.75rem; - padding: 1rem; + gap: clamp(0.5rem, 1.5vw, 0.75rem); + padding: clamp(0.5rem, 2vw, 1rem); } .tab-content { @@ -12,12 +25,14 @@ gap: 0.5rem; align-items: start; } + .full-width { width: 100%; } .extract-btn { white-space: nowrap; + min-height: $touch-target; } .actions { @@ -25,6 +40,9 @@ justify-content: center; } +/* ============================================================ + TOOLBAR + ============================================================ */ .keywords-toolbar { display: flex; flex-direction: column; @@ -39,9 +57,9 @@ .toolbar-controls { display: flex; align-items: center; - justify-content: space-between; + justify-content: center; gap: 0.75rem; - flex-wrap: wrap; + flex-wrap: nowrap; /* fixed: was invalid "no-wrap" */ padding: 0.5rem 0.75rem; background: var(--sg-background-muted, #f4f5f7); } @@ -50,13 +68,35 @@ grid-template-columns: 3fr 1.3fr; border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); } + +.toolbar-controls--placeholder { + /* invisible spacer, preserves grid column width/position */ + visibility: hidden; + pointer-events: none; +} + +.manual-input-controls { + min-width: 0; +} + +@container keyword-tool (max-width: #{$tablet}) { + .toolbar-wrapper { + grid-template-columns: 1fr; + border-left: none; + } + + .toolbar-controls--placeholder { + display: none; /* no need for a spacer once stacked */ + } +} + .toolbar-group { display: flex; align-items: center; gap: 0.6rem; } -.toolbar-group--select button { +.toolbar-group button { display: flex; align-items: center; gap: 0.35rem; @@ -64,6 +104,7 @@ line-height: 30px; border-radius: 20px; padding: 0 14px; + min-height: $touch-target; mat-icon { font-size: 20px; @@ -76,22 +117,29 @@ width: 1px; align-self: stretch; background: var(--sg-divider, rgba(0, 0, 0, 0.12)); - display: none; -} - -@media (min-width: 640px) { - .toolbar-divider { - display: block; - } } mat-button-toggle-group { border-radius: 20px; overflow: hidden; + justify-content: space-around; + + ::ng-deep .mat-button-toggle-label-content { + line-height: $touch-target; + } + ::ng-deep mat-button-toggle { + width: 100%; + } } -/* Tablet / phone: stack the toolbar and go full-width */ -@media (max-width: 768px) { +/* Container-query driven toolbar collapse (tablet/phone) */ +@container keyword-tool (min-width: #{$phone + 1}) { + .toolbar-divider { + display: block; + } +} + +@container keyword-tool (max-width: #{$tablet}) { .toolbar-controls { flex-direction: column; align-items: stretch; @@ -101,35 +149,38 @@ mat-button-toggle-group { justify-content: center; } - .toolbar-group--select button { + .toolbar-group button { width: 100%; justify-content: center; } - .toolbar-group--view { - justify-content: center; + .toolbar-wrapper { + grid-template-columns: 1fr; + border-left: none; + } + + .toolbar-wrapper .spacer { + width: 100%; } } -/* Phone: icon-only buttons to save space */ -@media (max-width: 480px) { +/* Phone: icon-only toolbar buttons to save space */ +@container keyword-tool (max-width: #{$phone}) { .btn-label { display: none; } - .toolbar-group--select button { + .toolbar-group button { width: auto; - padding: 0 10px; + padding: 0; + min-width: $touch-target; + justify-content: center; } } -mat-button-toggle-group { - flex-wrap: wrap; -} - -.toggle-text { - margin-left: 0.35rem; -} +/* ============================================================ + EXTRACTION GRID / CARD + ============================================================ */ .extraction-grid { display: grid; grid-template-columns: 1fr; @@ -150,7 +201,9 @@ mat-button-toggle-group { } } -/* === Table-like keyword grid === */ +/* ============================================================ + DESKTOP TABLE-LIKE KEYWORD GRID + ============================================================ */ .keyword-table { display: flex; flex-direction: column; @@ -161,7 +214,6 @@ mat-button-toggle-group { padding-top: 0.5rem; display: grid; grid-template-columns: repeat(3, 1fr) 1.3fr; - grid-template-rows: auto; column-gap: 1rem; border-bottom: 2px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); padding-bottom: 0.5rem; @@ -173,91 +225,16 @@ mat-button-toggle-group { text-align: center; } -.extracted-header { - grid-column: 1 / span 3; - grid-row: 0; - font-size: 0.95rem; - font-weight: 600; - color: var(--sg-text-primary); - align-self: end; -} - .sub-cell { font-weight: 500; color: var(--sg-text-secondary); - font-size: 1rem; + font-size: clamp(0.8rem, 1.2vw, 1rem); text-transform: uppercase; letter-spacing: 0.05em; align-self: end; - grid-row: 2; text-align: center; } -.broad-sub { - grid-column: 1; -} -.coarse-sub { - grid-column: 2; -} -.fine-sub { - grid-column: 3; -} -.manual-sub { - grid-column: 4; -} - -.keyword-input-row { - margin-left: 0.5rem; - width: 100%; - display: grid; - grid-column: 1 / span 4; - display: flex; - align-items: center; - gap: 0.35rem; - - &.compact { - .small-field { - flex: 10; - ::ng-deep .mat-mdc-text-field-wrapper { - padding: 0 0.6rem; - } - ::ng-deep .mat-mdc-form-field-flex { - min-height: 8px; - align-items: center; - } - ::ng-deep .mat-mdc-form-field-infix { - min-height: 8px; - padding: 1rem 0; - } - ::ng-deep .mat-mdc-form-field-subscript-wrapper { - display: none; - } - ::ng-deep input.mat-mdc-input-element { - font-size: 0.8rem; - } - ::ng-deep .mat-mdc-form-field-label, - ::ng-deep mat-label { - font-size: 1rem; - } - } - - button.mat-mdc-icon-button { - width: 28px; - height: 28px; - padding: 0; - line-height: 28px; - flex: 1; - - .mat-icon { - font-size: 26px; - width: 26px; - height: 26px; - line-height: 26px; - } - } - } -} - .table-body { display: grid; grid-template-columns: repeat(3, 1fr) 1.3fr; @@ -265,7 +242,6 @@ mat-button-toggle-group { row-gap: 0.4rem; align-items: start; border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); - //background: var(--sg-background-muted, #f4f5f7); } .table-col { @@ -279,9 +255,6 @@ mat-button-toggle-group { &:last-child { border-right: none; } - &:nth-child(3) { - border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.1)); - } ::ng-deep app-topic-chip { width: 100%; @@ -292,9 +265,58 @@ mat-button-toggle-group { opacity: 0.4; } } + .thick-border { - border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.1)); + border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.1)) !important; } + +@container keyword-tool (max-width: #{$tablet}) { + .table-head, + .table-body { + column-gap: 0.5rem; + } + + .table-col { + padding: 0.4rem; + } +} + +/* ============================================================ + MOBILE KEYWORD TABS (structural replacement for stacked table) + ============================================================ */ +.mobile-keyword-tabs { + margin-top: 0.5rem; + + ::ng-deep .mat-mdc-tab-labels { + justify-content: stretch; + } + + ::ng-deep .mat-mdc-tab { + flex: 1; + min-height: $touch-target; + } +} + +.tab-count { + margin-left: 0.35rem; + font-size: 0.75rem; + font-weight: 600; + color: var(--sg-text-secondary); + background: var(--sg-background-muted, #eceff1); + border-radius: 10px; + padding: 0 6px; + min-width: 18px; + display: inline-block; + text-align: center; +} + +.mobile-tab-panel { + padding: 0.75rem 0.25rem; +} + +/* ============================================================ + CHIP STACKS + ============================================================ */ .keyword-chip-stack { display: flex; flex-direction: column; @@ -307,6 +329,7 @@ mat-button-toggle-group { display: flex; align-items: center; width: 100%; + gap: 0.25rem; app-topic-chip { flex: 1 1 auto; @@ -315,6 +338,8 @@ mat-button-toggle-group { button[mat-icon-button] { flex: 0 0 auto; + min-width: $touch-target; + min-height: $touch-target; } } @@ -370,12 +395,9 @@ mat-button-toggle-group { } } -::ng-deep .mat-mdc-chip-option.compact-chip { - .mat-mdc-chip-action-label { - padding: 0 4px; - } - .mat-mdc-chip-action { - padding: 0 4px; +@container keyword-tool (max-width: #{$tablet}) { + .compact-chip { + width: 100%; } } @@ -391,57 +413,44 @@ mat-button-toggle-group { } } -.select-all-container { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - justify-content: space-between; - margin-top: 0.5rem; - - button { - display: flex; - justify-content: center; - font-size: 0.75rem; - padding: 0 12px; - line-height: 30px; - mat-icon { - font-size: 26px; - width: 26px; - height: 26px; - } - } -} - +/* ============================================================ + SEARCH BUTTON (sticky on mobile — improves conversion/UX) + ============================================================ */ .search-container { display: flex; justify-content: flex-end; margin-top: 0.5rem; } -/* ============================================================ - RESPONSIVE BREAKPOINTS - ============================================================ */ +.search-btn { + min-height: $touch-target; +} -/* Tablet: soften columns, keep 4 columns but tighter */ -@media (max-width: 1024px) { - .table-head, - .table-body { - column-gap: 0.5rem; +@media (max-width: $phone) { + .search-container { + position: sticky; + bottom: 0; + z-index: 5; + background: var(--sg-background); + padding: 0.75rem 0.5rem; + box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08); } - .table-col { - padding: 0.4rem; - } - - .compact-chip { + .search-btn { width: 100%; } } -/* Small tablet / large phone: stack columns */ -@media (max-width: 768px) { - .content { - padding: 0.75rem; +/* ============================================================ + TABS (URL / Text) — stretch on smaller containers + ============================================================ */ +@container keyword-tool (max-width: #{$tablet}) { + .content ::ng-deep .mat-mdc-tab-labels { + justify-content: stretch; + } + + .content ::ng-deep .mat-mdc-tab { + flex: 1; } .tab-content { @@ -452,87 +461,13 @@ mat-button-toggle-group { width: 100%; justify-content: center; } - - .table-head, - .table-body { - grid-template-columns: 1fr; - } - - .table-head { - display: none; /* labels are redundant once stacked; see column titles below */ - } - - .table-col { - border-right: none; - border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); - padding: 0.75rem 0.25rem; - - &:nth-child(3) { - border-right: none; - border-bottom: 3px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); - } - - &:last-child { - border-bottom: none; - } - - /* Re-introduce a column label since .table-head is hidden */ - &::before { - content: attr(data-col-label); - font-weight: 500; - font-size: 0.85rem; - text-transform: uppercase; - letter-spacing: 0.05em; - color: var(--sg-text-secondary); - margin-bottom: 0.35rem; - display: block; - } - } - - .extracted-header { - grid-column: 1; - grid-row: 1; - } - - .own-header { - grid-column: 1; - grid-row: 2; - } - - .actions { - align-self: center; - justify-content: flex-start; - } - - .search-container, - .select-all-container { - justify-content: stretch; - flex-direction: column; - } - - .search-btn, - .select-all-container button { - width: 100%; - } - - .view-toggle-row { - justify-content: center; - text-align: center; - } - - mat-button-toggle-group { - width: 100%; - - ::ng-deep .mat-button-toggle { - flex: 1; - } - } } -/* Phone: tighten further, reduce chip/font sizes */ -@media (max-width: 480px) { +/* ============================================================ + PHONE-SPECIFIC FINE-TUNING + ============================================================ */ +@container keyword-tool (max-width: #{$phone}) { .content { - padding: 0.5rem; gap: 0.5rem; } @@ -540,8 +475,7 @@ mat-button-toggle-group { padding: 0.35rem; } - .sub-cell, - .toggle-text { + .sub-cell { font-size: 0.8rem; } @@ -559,7 +493,9 @@ mat-button-toggle-group { } } -/* Source expansion panel */ +/* ============================================================ + SOURCE EXPANSION PANEL + ============================================================ */ .source-expansion { margin: 0.75rem 0; background: var(--sg-background-muted, #f5f5f5); @@ -610,6 +546,9 @@ mat-button-toggle-group { } } +/* ============================================================ + PROGRESS BAR + ============================================================ */ .progress-container { margin-top: 1rem; padding: 0.5rem 0; @@ -625,10 +564,7 @@ mat-button-toggle-group { &::after { content: ''; position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; + inset: 0; pointer-events: none; background: linear-gradient( 105deg, @@ -657,3 +593,21 @@ mat-button-toggle-group { transform: translateX(100%); } } + +/* ============================================================ + ACCESSIBILITY + ============================================================ */ +@media (prefers-reduced-motion: reduce) { + .compact-chip, + .progress-container mat-progress-bar::after { + animation: none !important; + transition: none !important; + } +} + +button:focus-visible, +.mat-button-toggle:focus-visible, +::ng-deep .mat-mdc-tab:focus-visible { + outline: 2px solid var(--sg-primary, #1976d2); + outline-offset: 2px; +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index e2dcc526..1971ca12 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -1,10 +1,5 @@ -import { - Component, - computed, - signal, - Signal, - WritableSignal, -} from '@angular/core'; +import { Component, computed, signal, inject } from '@angular/core'; +import { BreakpointObserver } from '@angular/cdk/layout'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -30,6 +25,9 @@ import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/t import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component'; import { Topic } from '../../api/model/topic'; +import { NgTemplateOutlet } from '@angular/common'; +import { map } from 'rxjs/operators'; +import { toSignal } from '@angular/core/rxjs-interop'; import { MatButtonToggleModule, MatButtonToggleGroup, @@ -68,6 +66,7 @@ type KeywordView = 'llm' | 'topic'; MatButtonToggleGroup, MatTooltipModule, A11yModule, + NgTemplateOutlet, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -80,7 +79,15 @@ export class KeywordsSearchComponent { }); private readonly SESSION_KEY = 'keywords-search-source'; + // in component class: + private breakpointObserver = inject(BreakpointObserver); + isMobile = toSignal( + this.breakpointObserver + .observe('(max-width: 768px)') + .pipe(map((r) => r.matches)), + { initialValue: false }, + ); // Category signals - the full backend entries are the source of truth; // the *Keywords() computed signals below just project the label out of them. private readonly broadKeywordEntries = signal([]); @@ -98,11 +105,12 @@ export class KeywordsSearchComponent { readonly loadingNewKeyword = signal(false); readonly extractionSource = signal(null); - readonly extractedKeywordsExist = computed( + readonly keywordsExist = computed( () => this.broadKeywords().length > 0 || this.coarseKeywords().length > 0 || - this.fineKeywords().length > 0, + this.fineKeywords().length > 0 || + this.manualKeywords().length > 0, ); readonly sourceContent = signal(''); @@ -309,12 +317,8 @@ export class KeywordsSearchComponent { ...this.getKeywordLabels(this.manualKeywords()), ].some((k) => this.normalizeKeyword(k) === normalized); } - - // Add manually from Keywords tab - addKeywordFromInput(keyword: string): void { - this.loadingNewKeyword.set(true); - - const normalizedKeyword = keyword.trim(); + addKeywordFromInput(keyword: Topic): void { + const normalizedKeyword = keyword.display_name?.trim() ?? ''; if (!normalizedKeyword) return; if (this.keywordExists(normalizedKeyword)) { @@ -322,35 +326,54 @@ export class KeywordsSearchComponent { return; } - this.topicsService.vectorSearchTopics(normalizedKeyword).subscribe({ - next: ({ results }) => { - const newEntry: KeywordEntryWithTopic = { - llm_keyword: { - keyword: normalizedKeyword, - relevance_score: 1, - }, - topic_mapping: { - keyword: normalizedKeyword, - topic: results?.[0], - }, - }; + this.loadingNewKeyword.set(true); - const updated = this.uniqueKeywordEntries([ - ...this.manualKeywordEntries(), - newEntry, - ]); + if (keyword.id === null) { + console.log('Adding new keyword without topic:', normalizedKeyword); + this.topicsService.vectorSearchTopics(normalizedKeyword).subscribe({ + next: ({ results }) => { + const newEntry: KeywordEntryWithTopic = { + llm_keyword: { keyword: normalizedKeyword, relevance_score: 1 }, + topic_mapping: { keyword: normalizedKeyword, topic: results?.[0] }, + }; - this.manualKeywordEntries.set(updated); - this.selectedKeywords.set([ - ...this.selectedKeywords(), - normalizedKeyword, - ]); - this.loadingNewKeyword.set(false); - // Explicit enrichment trigger for new keywords - this.enrichManualKeywordsWithTopics([normalizedKeyword]); - this.updateQueryParams(); - }, - }); + this.manualKeywordEntries.set( + this.uniqueKeywordEntries([ + ...this.manualKeywordEntries(), + newEntry, + ]), + ); + this.selectedKeywords.set([ + ...this.selectedKeywords(), + normalizedKeyword, + ]); + this.loadingNewKeyword.set(false); + this.updateQueryParams(); // now fires after state is actually updated + }, + error: (err) => { + console.error('vectorSearchTopics failed', err); + this.loadingNewKeyword.set(false); + this.statusMessage.set( + `Fehler beim Hinzufügen von "${normalizedKeyword}".`, + ); + }, + }); + } else { + console.log('we dont search', keyword); + const newEntry: KeywordEntryWithTopic = { + llm_keyword: { keyword: normalizedKeyword, relevance_score: 1 }, + topic_mapping: { keyword: normalizedKeyword, topic: keyword }, + }; + this.manualKeywordEntries.set( + this.uniqueKeywordEntries([...this.manualKeywordEntries(), newEntry]), + ); + this.selectedKeywords.set([ + ...this.selectedKeywords(), + normalizedKeyword, + ]); + this.loadingNewKeyword.set(false); + this.updateQueryParams(); + } } removeSelectedKeyword(keyword: string): void { @@ -388,7 +411,7 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - selectAllExtracted(): void { + selectAll(): void { const all = [ ...this.getKeywordLabels(this.manualKeywords()), ...this.getKeywordLabels(this.broadKeywords()), @@ -399,10 +422,8 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - deselectAllExtracted(): void { - this.selectedKeywords.set( - this.uniqueKeywords(this.getKeywordLabels(this.manualKeywords())), - ); + deselectAll(): void { + this.selectedKeywords.set([]); this.updateQueryParams(); } @@ -410,6 +431,7 @@ export class KeywordsSearchComponent { this.broadKeywordEntries.set([]); this.coarseKeywordEntries.set([]); this.fineKeywordEntries.set([]); + this.manualKeywordEntries.set([]); this.sourceContent.set(''); this.sourceUrl.set(null); @@ -428,11 +450,12 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - areAllExtractedSelected(): boolean { + areAllSelected(): boolean { const allExtracted = [ ...this.getKeywordLabels(this.broadKeywords()), ...this.getKeywordLabels(this.coarseKeywords()), ...this.getKeywordLabels(this.fineKeywords()), + ...this.getKeywordLabels(this.manualKeywords()), ]; return allExtracted.every((k) => this.selectedKeywords().includes(k)); } From 86bed62ac0141d0655b7428cdd80b4fc8b2963ba Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 18:10:24 +0200 Subject: [PATCH 81/92] delete button removed for autocompletion field --- .../ui/topic-autocomplete/topic-autocomplete.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html index 5be3be18..91a2bdcc 100644 --- a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html @@ -23,7 +23,7 @@ } - @if (searchControl.value) { + Date: Sun, 5 Jul 2026 18:35:39 +0200 Subject: [PATCH 82/92] cleaned log outputs --- .../app/modules/keywords-search/keywords-search.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 1971ca12..26a5f014 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -200,7 +200,6 @@ export class KeywordsSearchComponent { this.handleStatusEvent(event); break; case 'keywords': - console.log(event.keywords); if (event.keywords) this.addExtractedKeyword(event.keywords); break; case 'completed': @@ -359,7 +358,7 @@ export class KeywordsSearchComponent { }, }); } else { - console.log('we dont search', keyword); + console.log('topic was already there', keyword); const newEntry: KeywordEntryWithTopic = { llm_keyword: { keyword: normalizedKeyword, relevance_score: 1 }, topic_mapping: { keyword: normalizedKeyword, topic: keyword }, From 3867540a4cdb1cc2c28a05269032ead9291648c9 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Sun, 5 Jul 2026 19:46:24 +0200 Subject: [PATCH 83/92] refactor(publications, people): unify active topic chip, add loading states --- .../person-card/person-card.component.html | 2 + .../person-card/person-card.component.scss | 8 + .../person-list/person-list.component.html | 23 +- .../person-list/person-list.component.scss | 43 +- .../person-publications.component.html | 23 +- .../person-publications.component.scss | 370 ++++++------------ webapp/src/styles.scss | 45 +++ 7 files changed, 230 insertions(+), 284 deletions(-) diff --git a/webapp/src/app/modules/person-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index 49edc9ae..946430ae 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -58,7 +58,9 @@ type="button" class="institution-tag" [class.active]="isInstitutionActive()" + [class.is-loading]="loading()" [matTooltip]="inst.display_name || ''" + [matTooltipDisabled]="loading()" matTooltipPosition="above" (click)=" institutionClick.emit(inst.display_name || ''); diff --git a/webapp/src/app/modules/person-card/person-card.component.scss b/webapp/src/app/modules/person-card/person-card.component.scss index c8b2db5a..75f0ed69 100644 --- a/webapp/src/app/modules/person-card/person-card.component.scss +++ b/webapp/src/app/modules/person-card/person-card.component.scss @@ -185,6 +185,14 @@ background: var(--sg-primary); color: #fff; } + + &.is-loading { + pointer-events: none; + background: var(--sg-surface-soft); + border-color: var(--sg-border); + color: var(--sg-text-soft); + box-shadow: none; + } } .flag-img { diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index fd360b6e..8f3b0f37 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -38,19 +38,14 @@ ) { @if (filter.category === 'topic') { - Thema: - - + + label + {{ + filter.value + }} +
+ + + + + {{ getDisplayName(institution) }} + {{ institution.geo?.city }}, + {{ institution.geo?.country }} + + + + + + + + + + + + info + Übersicht + + + article + Publikationen + + + work + Projekte + + + verified + Patente + + + + + diff --git a/webapp/src/app/modules/institutions/institutions.component.scss b/webapp/src/app/modules/institutions/institutions.component.scss index 8edbecef..ce9afb83 100644 --- a/webapp/src/app/modules/institutions/institutions.component.scss +++ b/webapp/src/app/modules/institutions/institutions.component.scss @@ -5,23 +5,6 @@ padding: 1rem; } -.sorting { - display: flex; - justify-content: flex-end; - gap: 0.5rem; -} - -.sorting select { - padding: 0.75rem; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - font-size: 1rem; -} - -.sorting select:hover { - cursor: pointer; -} - .cards { display: grid; gap: 1.5rem; @@ -71,13 +54,3 @@ mat-card-actions a { border: 1px solid var(--sg-border); border-radius: var(--sg-radius-sm); } - -.no-results { - text-align: center; - padding: 2rem; - color: var(--sg-text-secondary); -} - -.search-and-sorting { - padding: 0 1rem; -} diff --git a/webapp/src/app/modules/institutions/institutions.component.ts b/webapp/src/app/modules/institutions/institutions.component.ts index 18eea25f..48abc772 100644 --- a/webapp/src/app/modules/institutions/institutions.component.ts +++ b/webapp/src/app/modules/institutions/institutions.component.ts @@ -1,16 +1,16 @@ -import { Component, input } from '@angular/core'; +import { Component, computed, input } from '@angular/core'; import { Institution, InstitutionPage } from '../../api'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { RouterModule } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { MatDividerModule } from '@angular/material/divider'; -import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; + +import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component'; import { - QueryParamSelectorComponent, - SelectorOption, -} from '../../shared/ui/query-param-selector/query-param-selector.component'; -import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; + Page, + CardSearchComponent, +} from '../../shared/ui/card-search/card-search.component'; @Component({ selector: 'app-institutions', @@ -20,9 +20,7 @@ import { QueryParamInputComponent } from '../../shared/ui/query-param-input/quer MatIconModule, MatDividerModule, RouterModule, - QueryParamPaginatorComponent, - QueryParamSelectorComponent, - QueryParamInputComponent, + CardSearchComponent, ], templateUrl: './institutions.component.html', styleUrl: './institutions.component.scss', @@ -30,6 +28,13 @@ import { QueryParamInputComponent } from '../../shared/ui/query-param-input/quer export class InstitutionsComponent { institutionPage = input.required(); + page = computed(() => ({ + page: this.institutionPage().page || 0, + size: this.institutionPage().size || 10, + total: this.institutionPage().total || 0, + elements: this.institutionPage().elements || [], + })); + sortingOptions: SelectorOption[] = [ { value: 'relevance', display_name: 'Relevanz' }, { value: 'name', display_name: 'Name' }, diff --git a/webapp/src/app/modules/projects/projects.component.html b/webapp/src/app/modules/projects/projects.component.html index b2bcbddf..210363ec 100644 --- a/webapp/src/app/modules/projects/projects.component.html +++ b/webapp/src/app/modules/projects/projects.component.html @@ -2,98 +2,59 @@

Passende Projekte finden

- -
- - - -
- - EU - BUND - DFG - - -
- - - -
-
-
- - - - @let fundingProjectPageValue = fundingProjectPage(); - - @if ( - fundingProjectPageValue.elements && - fundingProjectPageValue.elements.length > 0 - ) { -
- @for (fundingProject of fundingProjectPageValue.elements; track $index) { - - - {{ fundingProject.title }} - {{ - fundingProject.type | uppercase - }} - - - - - - - - - - - - info - Übersicht - - - - - } -
- } @else { -
-

Keine passenden Projekte gefunden.

-
- } - - - - +
+ + + + + {{ element.title }} + {{ element.type | uppercase }} + + + + + + + + + + + + info + Übersicht + + + + + + + + + EU + BUND + DFG + + diff --git a/webapp/src/app/modules/projects/projects.component.scss b/webapp/src/app/modules/projects/projects.component.scss index 32a0f31e..55063bd0 100644 --- a/webapp/src/app/modules/projects/projects.component.scss +++ b/webapp/src/app/modules/projects/projects.component.scss @@ -5,23 +5,6 @@ padding: 1rem; } -.sorting { - display: flex; - justify-content: flex-end; - gap: 0.5rem; -} - -.sorting select { - padding: 0.75rem; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - font-size: 1rem; -} - -.sorting select:hover { - cursor: pointer; -} - .cards { display: grid; gap: 1.5rem; @@ -29,10 +12,6 @@ padding: 0 1rem; } -mat-paginator { - background-color: var(--sg-background); -} - .card { padding: 0.5rem; background-color: var(--sg-background); @@ -76,12 +55,6 @@ mat-card-actions a { border-radius: var(--sg-radius-sm); } -.no-results { - text-align: center; - padding: 2rem; - color: var(--sg-text-secondary); -} - .mat-mdc-standard-chip { border-radius: var(--sg-radius-sm); } diff --git a/webapp/src/app/modules/projects/projects.component.ts b/webapp/src/app/modules/projects/projects.component.ts index 4361c9bb..984ee116 100644 --- a/webapp/src/app/modules/projects/projects.component.ts +++ b/webapp/src/app/modules/projects/projects.component.ts @@ -1,4 +1,4 @@ -import { Component, input, signal } from '@angular/core'; +import { Component, computed, input, signal } from '@angular/core'; import { FundingProject, FundingProjectPage, ProjectType } from '../../api'; import { MatDividerModule } from '@angular/material/divider'; import { MatIconModule } from '@angular/material/icon'; @@ -8,12 +8,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatButtonModule } from '@angular/material/button'; import { DatePipe, UpperCasePipe } from '@angular/common'; import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; -import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; -import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; + +import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component'; import { - QueryParamSelectorComponent, - SelectorOption, -} from '../../shared/ui/query-param-selector/query-param-selector.component'; + CardSearchComponent, + Page, +} from '../../shared/ui/card-search/card-search.component'; @Component({ selector: 'app-projects', @@ -26,9 +26,7 @@ import { UpperCasePipe, DatePipe, MatChipsModule, - QueryParamInputComponent, - QueryParamPaginatorComponent, - QueryParamSelectorComponent, + CardSearchComponent, ], templateUrl: './projects.component.html', styleUrl: './projects.component.scss', @@ -36,6 +34,13 @@ import { export class ProjectsComponent { fundingProjectPage = input.required(); + page = computed(() => ({ + page: this.fundingProjectPage().page || 0, + size: this.fundingProjectPage().size || 10, + total: this.fundingProjectPage().total || 0, + elements: this.fundingProjectPage().elements || [], + })); + urlChips = signal(['eu', 'bund', 'dfg']); sortingOptions: SelectorOption[] = [{ value: 'title', display_name: 'Name' }]; @@ -72,13 +77,14 @@ export class ProjectsComponent { getDetaiLink(fundingProject: FundingProject): string | null { if (fundingProject.type === 'bund') { - const encodedId = encodeURIComponent(fundingProject.id) + const encodedId = encodeURIComponent(fundingProject.id); return '/projects/bund/' + encodedId; } else if (fundingProject.type === 'dfg') { return '/projects/dfg/' + fundingProject.id; } else if (fundingProject.type === 'eu') { return '/projects/eu/' + fundingProject.id; - } else + } else { return null; } + } } diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.html b/webapp/src/app/shared/ui/card-search/card-search.component.html new file mode 100644 index 00000000..c06d03a6 --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.html @@ -0,0 +1,54 @@ + diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.scss b/webapp/src/app/shared/ui/card-search/card-search.component.scss new file mode 100644 index 00000000..521dda4c --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.scss @@ -0,0 +1,31 @@ +.card-search { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.card-search-filter { + display: flex; + flex-direction: row; + gap: 1rem; + padding: 0rem 1rem; +} + +.cards { + display: grid; + gap: 1.5rem; + grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr)); + padding: 0 1rem; +} + +.pagination { + display: flex; + justify-content: end; + padding: 0rem 1rem; +} + +.no-results { + text-align: center; + padding: 2rem; + color: var(--sg-text-secondary); +} diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.ts b/webapp/src/app/shared/ui/card-search/card-search.component.ts new file mode 100644 index 00000000..0b8bcc5b --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.ts @@ -0,0 +1,50 @@ +import { Component, input, TemplateRef } from '@angular/core'; +import { QueryParamInputComponent } from '../query-param-input/query-param-input.component'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../query-param-selector/query-param-selector.component'; +import { MatDivider } from '@angular/material/divider'; +import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component'; +import { NgTemplateOutlet } from '@angular/common'; + +export type Page = { + page: number; + size: number; + total: number; + elements: any[]; +}; + +@Component({ + selector: 'app-card-search', + imports: [ + QueryParamInputComponent, + QueryParamSelectorComponent, + MatDivider, + QueryParamPaginatorComponent, + NgTemplateOutlet, + ], + templateUrl: './card-search.component.html', + styleUrl: './card-search.component.scss', +}) +export class CardSearchComponent { + cardTmp = input.required>(); + additionalFiltersTmp = input>(); + noResultsTmp = input>(); + + + cardMinWidth = input(300); + + page = input.required(); + + withSearch = input(true); + searchLabel = input('Suchen'); + searchQueryParamKey = input('search'); + + sortingOptions = input(); + sortByQueryParamKey = input('sort_by'); + sortByLabel = input('Sortieren nach'); + sortingDirectionOptions = input(); + sortingDirectionQueryParamKey = input('sorting_order'); + sortingDirectionLabel = input('Sortierreihenfolge'); +} From c38355c817f68462a7eb1f75966d46a9b6008724 Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 19:53:23 +0200 Subject: [PATCH 85/92] minor logic and layout adjustments --- .../keywords-search.component.html | 600 +++++++++--------- .../keywords-search.component.scss | 15 +- .../keywords-search.component.ts | 31 +- 3 files changed, 340 insertions(+), 306 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index e1de98d3..dbb9f941 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -43,10 +43,12 @@
@@ -54,134 +56,120 @@ + @if (isExtracting()) { +
+ + +
{{ statusMessage() }}
+
+ } -
- - - -
- @if (topicLegendGroups.length > 0) { - - - } - - -
- @if (keywordsExist()) { -
-
- @if (areAllSelected()) { - - } @else { - - } -
-
- - - - text_fields - Extrahierte Keywords - - - account_tree - Topic Mapping - - -
- -
- -
-
- } @else { - -
+ @if (keywordsExist()) { +
+ + + +
+ @if (topicLegendGroups.length > 0) { + + } -
- + +
+ @if (!isExtracting()) { +
+
+ @if (areAllSelected()) { + + } @else { + + } +
+
+ + + + text_fields + Extrahierte Keywords + + + account_tree + Topic Mapping + + +
+ +
+ +
+
+ } @else { + +
+ } + +
+ +
-
- - - @if (keywords.length > 0) { -
- @for (keyword of keywords; track keyword.llm_keyword.keyword) { - - - } -
- } @else { -

{{ emptyText }}

- } -
- - -
- @if (manualKeywords().length > 0) { - @for ( - keyword of manualKeywords(); - track keyword.llm_keyword.keyword - ) { -
+ + + @if (keywords.length > 0) { +
+ @for ( + keyword of keywords; + track keyword.llm_keyword.keyword + ) { - -
- } - } @else if (loadingNewKeyword()) { -
- - + }
} @else { -

Nichts hinzugefügt

+

{{ emptyText }}

} -
- + - - @if (!isMobile()) { -
-
-
Breite Keywords
-
Coarse Keywords
-
- Fine Keywords -
-
Eigene Keywords
+ +
+ @if (manualKeywords().length > 0) { + @for ( + keyword of manualKeywords(); + track keyword.llm_keyword.keyword + ) { +
+ + + +
+ } + } @else { +

Nichts hinzugefügt

+ } + @if (loadingNewKeyword()) { +
+ + + +
+ }
+
-
-
- + + @if (!isMobile()) { +
+
+
+ Breite Keywords +
+
+ Coarse Keywords +
+
+ Fine Keywords +
+
+ Eigene Keywords +
-
- -
+
+
+ +
-
- -
+
+ +
-
- +
+ +
+ +
+ +
-
- } @else { - - - - - Breit - {{ broadKeywords().length }} - -
- -
-
+ } @else { + + + + + Breit + {{ broadKeywords().length }} + +
+ +
+
- - - Coarse - {{ coarseKeywords().length }} - -
- -
-
+ + + Coarse + {{ coarseKeywords().length }} + +
+ +
+
- - - Fine - {{ fineKeywords().length }} - -
- -
-
+ + + Fine + {{ fineKeywords().length }} + +
+ +
+
- - - Eigene - {{ manualKeywords().length }} - -
- -
-
-
- } + + + Eigene + {{ manualKeywords().length }} + +
+ +
+
+
+ } - @if (isExtracting()) { -
- - -
{{ statusMessage() }}
-
- } @else if (!keywordsExist()) { -

- Noch keine Keywords vorhanden. Extrahiere Keywords aus URL/Text - oder füge oben eigene Keywords hinzu. -

- } + + @if (sourceContent().length > 0) { + + + + Quellentext: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ } + + +
- - @if (sourceContent().length > 0) { - - - - Quellentext: {{ sourceUrl() }} - -
{{ sourceContent() }}
-
- } - - -
- - -
- -
+ +
+ +
+ }
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index cfa3f8b9..15e6e6c5 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -19,11 +19,11 @@ $touch-target: 44px; } .tab-content { - display: grid; + display: flex; + flex-direction: column; margin-top: 0.5rem; - grid-template-columns: 5fr 1fr; gap: 0.5rem; - align-items: start; + align-items: center; } .full-width { @@ -32,6 +32,7 @@ $touch-target: 44px; .extract-btn { white-space: nowrap; + min-width: 240px; min-height: $touch-target; } @@ -418,11 +419,13 @@ mat-button-toggle-group { ============================================================ */ .search-container { display: flex; - justify-content: flex-end; + justify-content: center; margin-top: 0.5rem; } .search-btn { + min-width: 240px; + align-self: center; min-height: $touch-target; } @@ -454,6 +457,7 @@ mat-button-toggle-group { } .tab-content { + display: grid; grid-template-columns: 1fr; } @@ -461,6 +465,9 @@ mat-button-toggle-group { width: 100%; justify-content: center; } + .search-btn { + width: 100%; + } } /* ============================================================ diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 26a5f014..4870cd4b 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -409,15 +409,27 @@ export class KeywordsSearchComponent { ); this.updateQueryParams(); } + allKeywordEntries = computed(() => [ + ...this.manualKeywords(), + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ]); selectAll(): void { - const all = [ - ...this.getKeywordLabels(this.manualKeywords()), - ...this.getKeywordLabels(this.broadKeywords()), - ...this.getKeywordLabels(this.coarseKeywords()), - ...this.getKeywordLabels(this.fineKeywords()), - ]; - this.selectedKeywords.set(this.uniqueKeywords(all)); + const seen = new Set(); + const result: string[] = []; + + for (const entry of this.allKeywordEntries()) { + const label = entry.llm_keyword.keyword; + const normalized = this.normalizeKeyword(label); + if (!seen.has(normalized)) { + seen.add(normalized); + result.push(label); + } + } + + this.selectedKeywords.set(result); this.updateQueryParams(); } @@ -426,7 +438,7 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - clearExtractedKeywords(): void { + clearKeywords(): void { this.broadKeywordEntries.set([]); this.coarseKeywordEntries.set([]); this.fineKeywordEntries.set([]); @@ -502,7 +514,7 @@ export class KeywordsSearchComponent { } async extractKeywords(): Promise { - this.clearExtractedKeywords(); + this.clearKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; @@ -564,6 +576,7 @@ export class KeywordsSearchComponent { this.fineKeywordEntries.set( this.uniqueKeywordEntries(keywords.fine_grained, seenKeywords), ); + this.selectAll(); } private getSelectedExtractedKeywordEntries(): KeywordEntryWithTopic[] { From a07fadc30e8ace7746c168d25271da020cec3169 Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 5 Jul 2026 20:10:53 +0200 Subject: [PATCH 86/92] deleted unused TopicChipComponent from person-list --- webapp/src/app/modules/person-list/person-list.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index d1ad59a8..e363e90f 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -23,7 +23,6 @@ import { import { TopicsService } from '../../api/api/topics.service'; import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component'; import { PersonCardComponent } from '../person-card/person-card.component'; -import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; import { SharedStateService } from '../../shared/services/shared-state.service'; import { PaginationService } from '../../shared/services/pagination.service'; @@ -57,7 +56,6 @@ import { SkTextDirective } from '../../custom-directives/sk-text.directive'; MatRadioModule, TopicHierarchyComponent, PersonCardComponent, - TopicChipComponent, SkTextDirective, MatAutocompleteModule, ], From b5d03c84c41b494ee197bc2dc9f585f307f43cce Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 10:20:42 +0200 Subject: [PATCH 87/92] attempt to optimize backend search time and small modeltype changes --- .../src/main/inse/university_ranking/logic.py | 30 ++- .../inse/university_ranking/trend_logic.py | 182 +++++++++------ .../uni-trend-parent.component.html | 14 +- .../uni-trend-parent.component.ts | 217 +++++++++++++----- 4 files changed, 311 insertions(+), 132 deletions(-) diff --git a/service/src/main/inse/university_ranking/logic.py b/service/src/main/inse/university_ranking/logic.py index 1accf196..2f368665 100644 --- a/service/src/main/inse/university_ranking/logic.py +++ b/service/src/main/inse/university_ranking/logic.py @@ -12,7 +12,7 @@ END_YEAR = datetime.datetime.now().year - 1 async def resolve_topic(topic_query: str) -> Topic: """Resolves a topic display name or ID using Elasticsearch with source whitelisting.""" - if topic_query.startswith("http") or "/T" in topic_query: + if topic_query.startswith("https://openalex.org/"): query = {"term": {"id": topic_query}} else: query = {"match_phrase": {"display_name": topic_query}} @@ -40,12 +40,17 @@ async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> Ranking topic_obj = await resolve_topic(topic_query) topic_name = topic_obj.display_name or topic_query + if topic_obj.id: + topic_filter = {"term": {"topics.id.keyword": topic_obj.id}} + else: + topic_filter = {"match_phrase": {"topics.display_name": topic_name}} + query = { "bool": { - "must": [ + "filter": [ {"term": {"type": "education"}}, {"term": {"geo.country_code": "DE"}}, - {"match_phrase": {"topics.display_name": topic_name}} + topic_filter ] } } @@ -106,7 +111,7 @@ async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> Ranking } } - # Topic filter clause (using topic ID if resolved, otherwise matching phrase) + # Topic filter clause (using topic ID if resolved, otherwise matching display name keyword) topic_id = topic_obj.id if topic_id: topic_clause = { @@ -129,10 +134,10 @@ async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> Ranking } } - # Construct single-pass ES query on openalex-works + # Construct single-pass ES query on openalex-works in Filter Context works_query = { "bool": { - "must": [ + "filter": [ { "range": { "publication_year": { @@ -141,7 +146,17 @@ async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> Ranking } } }, - topic_clause + topic_clause, + { + "nested": { + "path": "authorships.institutions", + "query": { + "terms": { + "authorships.institutions.id": [inst["id"] for inst in top_10] + } + } + } + } ] } } @@ -175,6 +190,7 @@ async def get_ranking_data(topic_query: str, metric: DashboardMetric) -> Ranking query=works_query, body={"aggs": aggregations}, size=0, + cluster="nes" ) diff --git a/service/src/main/inse/university_ranking/trend_logic.py b/service/src/main/inse/university_ranking/trend_logic.py index 6cf70e13..8e1365d7 100644 --- a/service/src/main/inse/university_ranking/trend_logic.py +++ b/service/src/main/inse/university_ranking/trend_logic.py @@ -125,20 +125,61 @@ async def get_top_institutions_by_region( """ country_codes = [] if country: - country_codes = [country] + country_codes = [country.upper()] elif region: - country_codes = REGION_MAPPINGS.get(region, []) + try: + # Query openalex-continents index to resolve continent country codes dynamically + res = await elasticsearch.search( + index=str(ESIndex.OPENALEX_CONTINENTS), + query={ + "bool": { + "should": [ + {"term": {"wikidata_id.keyword": region}}, + {"term": {"id": f"https://openalex.org/continents/{region}"}} + ] + } + }, + size=1, + source=["countries"], + cluster="nes" + ) + hits = res.get("hits", {}).get("hits", []) + if hits: + source = hits[0]["_source"] + country_codes = [ + c["id"].split("/")[-1].upper() for c in source.get("countries", []) + ] + except Exception as e: + logger.warning("Failed to resolve continent countries in get_top_institutions_by_region: %s", e) + + # Resolve the topic to get the exact ID/display name + topic_filter = {"match_phrase": {"topics.display_name": topic}} + try: + topic_res = await elasticsearch.search( + index="openalex-topics", + query={"match_phrase": {"display_name": topic}}, + size=1, + source=["id", "display_name"], + cluster="nes" + ) + hits = topic_res.get("hits", {}).get("hits", []) + if hits: + source = hits[0]["_source"] + topic_id = source["id"] + topic_filter = {"term": {"topics.id.keyword": topic_id}} + except Exception as e: + logger.warning("Failed to resolve topic in get_top_institutions_by_region: %s", e) # Query openalex-institutions for educational entities matching country and topic must_clauses: List[Dict[str, Any]] = [ {"term": {"type": "education"}}, - {"match_phrase": {"topics.display_name": topic}} + topic_filter ] if country_codes: must_clauses.append({"terms": {"geo.country_code": country_codes}}) - query = {"bool": {"must": must_clauses}} + query = {"bool": {"filter": must_clauses}} # Fetch top 50 by overall works count to cover a good pool of institutions res = await elasticsearch.search( @@ -193,8 +234,10 @@ async def get_trend_data( if not topics: return TrendResponse(series=[], years=[]) + import asyncio + start_year = 2000 - end_year = datetime.datetime.now().year -1 + end_year = datetime.datetime.now().year - 1 years_range = list(range(start_year, end_year + 1)) # Resolve primary institution (default University of Duisburg-Essen for everyone) @@ -208,61 +251,67 @@ async def get_trend_data( if primary_inst_id not in query_institutions: query_institutions.insert(0, primary_inst_id) - # Resolve institution names and country codes from openalex-institutions - resolved_names: Dict[str, str] = {primary_inst_id: primary_inst_name} - resolved_country_codes: Dict[str, str] = {} + # Prepare lists of countries and regions dynamically + query_countries = countries or [] + query_regions = regions or [] + + clean_countries = [c.strip().upper() for c in query_countries] + clean_regions = [r.strip() for r in query_regions] ids_to_resolve = list(set(query_institutions)) - - if ids_to_resolve: + + # Define concurrent metadata lookups + async def fetch_institutions(): + names = {primary_inst_id: primary_inst_name} + codes = {} + if not ids_to_resolve: + return names, codes try: - name_res = await elasticsearch.search( + res = await elasticsearch.search( index=str(ESIndex.OPENALEX_INSTITUTIONS), query={"terms": {"id": ids_to_resolve}}, size=len(ids_to_resolve), source=["id", "display_name", "country_code"], cluster="nes" ) - for hit in name_res.get("hits", {}).get("hits", []): + for hit in res.get("hits", {}).get("hits", []): source = hit["_source"] - resolved_names[source["id"]] = source.get("display_name", source["id"]) - resolved_country_codes[source["id"]] = source.get("country_code", "") + names[source["id"]] = source.get("display_name", source["id"]) + codes[source["id"]] = source.get("country_code", "") except Exception as e: logger.warning("Failed to resolve institution details from ES: %s", e) + return names, codes - # Prepare lists of countries and regions dynamically - query_countries = countries or [] - query_regions = regions or [] - - resolved_country_names: Dict[str, str] = {} - clean_countries: List[str] = [] - if query_countries: - clean_countries = [c.split("/")[-1].upper() for c in query_countries] + async def fetch_countries(): + names = {} + if not clean_countries: + return names try: - c_res = await elasticsearch.search( + res = await elasticsearch.search( index=str(ESIndex.OPENALEX_COUNTRIES), query={"terms": {"country_code": clean_countries}}, size=len(clean_countries), source=["country_code", "display_name"], cluster="nes" ) - for hit in c_res.get("hits", {}).get("hits", []): + for hit in res.get("hits", {}).get("hits", []): source = hit["_source"] - resolved_country_names[source["country_code"]] = source["display_name"] + names[source["country_code"]] = source["display_name"] except Exception as e: logger.warning("Failed to resolve country names from ES: %s", e) + return names - resolved_continent_names: Dict[str, str] = {} - continent_country_codes: Dict[str, List[str]] = {} - location_mappings: Dict[str, List[str]] = {} - if query_regions: - clean_regions = [r.split("/")[-1] for r in query_regions] + async def fetch_continents(): + names = {} + ccodes = {} + if not clean_regions: + return names, ccodes try: - r_res = await elasticsearch.search( + res = await elasticsearch.search( index=str(ESIndex.OPENALEX_CONTINENTS), query={ "bool": { "should": [ - {"terms": {"wikidata_id": clean_regions}}, + {"terms": {"wikidata_id.keyword": clean_regions}}, {"terms": {"id": [f"https://openalex.org/continents/{r}" for r in clean_regions]}} ] } @@ -271,43 +320,47 @@ async def get_trend_data( source=["id", "display_name", "wikidata_id", "countries"], cluster="nes" ) - for hit in r_res.get("hits", {}).get("hits", []): + for hit in res.get("hits", {}).get("hits", []): source = hit["_source"] c_code = source.get("wikidata_id") or source["id"].split("/")[-1] - resolved_continent_names[c_code] = source["display_name"] - member_ccs = [ - c["id"].split("/")[-1].upper() for c in source.get("countries", []) - ] - continent_country_codes[c_code] = member_ccs - location_mappings[c_code] = member_ccs + names[c_code] = source["display_name"] + ccodes[c_code] = [c["id"].split("/")[-1].upper() for c in source.get("countries", [])] except Exception as e: logger.warning("Failed to resolve continent names from ES: %s", e) + return names, ccodes + + async def fetch_topics(): + t_ids = {} + try: + res = await elasticsearch.search( + index="openalex-topics", + query={"bool": {"should": [{"match_phrase": {"display_name": t}} for t in topics]}}, + size=len(topics) * 2, + source=["id", "display_name"], + cluster="nes" + ) + for hit in res.get("hits", {}).get("hits", []): + source = hit["_source"] + for t in topics: + if t.lower() in source["display_name"].lower(): + t_ids[t] = source["id"] + except Exception as e: + logger.warning("Failed to resolve topic IDs from ES: %s", e) + return t_ids + + # Execute all 4 queries concurrently + ( + (resolved_names, resolved_country_codes), + resolved_country_names, + (resolved_continent_names, continent_country_codes), + resolved_topic_ids + ) = await asyncio.gather(fetch_institutions(), fetch_countries(), fetch_continents(), fetch_topics()) + + location_mappings = continent_country_codes.copy() # Map of filters inside our Elasticsearch aggregation filters_map: Dict[str, Dict[str, Any]] = {} - # Resolve the topic IDs from the openalex-topics index to enable fast term queries - resolved_topic_ids: Dict[str, str] = {} - try: - topic_res = await elasticsearch.search( - index="openalex-topics", - query={ - "bool": { - "should": [ - {"match_phrase": {"display_name": t}} for t in topics - ] - } - }, - size=len(topics) * 2, - source=["id", "display_name"], - cluster="nes" - ) - for hit in topic_res.get("hits", {}).get("hits", []): - source = hit["_source"] - resolved_topic_ids[source["display_name"]] = source["id"] - except Exception as e: - logger.warning("Failed to resolve topic IDs from ES: %s", e) - # 1. Institution Filters for inst_id in query_institutions: filters_map[f"inst_{inst_id}"] = { @@ -426,7 +479,7 @@ async def get_trend_data( }) # Construct the single-pass Elasticsearch query - must_clauses = [ + filter_clauses = [ { "range": { "publication_year": { @@ -443,7 +496,7 @@ async def get_trend_data( } ] if entity_should_clauses: - must_clauses.append({ + filter_clauses.append({ "bool": { "should": entity_should_clauses, "minimum_should_match": 1 @@ -452,7 +505,7 @@ async def get_trend_data( query = { "bool": { - "must": must_clauses + "filter": filter_clauses } } @@ -600,3 +653,4 @@ async def get_trend_data( )) return TrendResponse(series=series_list, years=years_range, location_mappings=location_mappings) + diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html index a6110133..9506f9bd 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html @@ -147,9 +147,13 @@ @for (result of searchResults(); track result.id) {
  • } @@ -217,6 +221,12 @@ title="Shows total absolute publication counts."> 📊 Total Volume +
    diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index ae695357..dca2a6c2 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -12,6 +12,15 @@ import { import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; +import { forkJoin } from 'rxjs'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { UniTrendChartComponent } from '../uni-trend-chart/uni-trend-chart.component'; import { TrendResponse, @@ -20,14 +29,32 @@ import { TopInstitutionItem, AutocompleteLocationItem, AutocompleteResponse, + AutocompleteResponseResultsInner, UniversityRankingsService, InstitutionsService, } from '../../../api'; +export interface CompareItem { + id: string; + name: string; +} + @Component({ selector: 'app-uni-trend-parent', standalone: true, - imports: [CommonModule, FormsModule, UniTrendChartComponent], + imports: [ + CommonModule, + FormsModule, + UniTrendChartComponent, + MatFormFieldModule, + MatInputModule, + MatSelectModule, + MatCheckboxModule, + MatButtonModule, + MatIconModule, + MatProgressSpinnerModule, + MatAutocompleteModule, + ], templateUrl: './uni-trend-parent.component.html', styleUrl: './uni-trend-parent.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -47,19 +74,23 @@ export class UniTrendParentComponent implements OnInit { readonly primaryInstitutionName = signal( 'University of Duisburg-Essen', ); - readonly comparisonInstitutions = signal<{ id: string; name: string }[]>([]); - readonly comparisonCountries = signal<{ id: string; name: string }[]>([]); - readonly comparisonRegions = signal<{ id: string; name: string }[]>([]); - readonly startYear = signal(2015); - readonly endYear = signal(new Date().getFullYear() - 1); - readonly chartMode = signal<'normalized' | 'total'>('total'); + readonly comparisonInstitutions = signal([]); + readonly comparisonCountries = signal([ + { id: 'DE', name: 'Germany' }, + ]); + readonly comparisonRegions = signal([]); + readonly startYear = signal(2010); + readonly endYear = signal(2025); + readonly chartMode = signal<'normalized' | 'total' | 'cumulative'>( + 'normalized', + ); readonly activeChartTopic = signal(''); // Cached parameters of the last active search request to track "isDirty" readonly fetchedTopics = signal([]); - readonly fetchedInstitutions = signal<{ id: string; name: string }[]>([]); - readonly fetchedCountries = signal<{ id: string; name: string }[]>([]); - readonly fetchedRegions = signal<{ id: string; name: string }[]>([]); + readonly fetchedInstitutions = signal([]); + readonly fetchedCountries = signal([]); + readonly fetchedRegions = signal([]); // Results & Loading signals readonly rawTrendResponse = signal(null); @@ -69,7 +100,7 @@ export class UniTrendParentComponent implements OnInit { // Autocomplete UI state readonly searchQuery = signal(''); - readonly searchResults = signal([]); + readonly searchResults = signal([]); readonly locationQuery = signal(''); readonly locationSearchResults = signal([]); @@ -82,13 +113,13 @@ export class UniTrendParentComponent implements OnInit { if (!raw) return null; const currentInstIds = new Set( - this.comparisonInstitutions().map((i) => i.id.toLowerCase()), + this.comparisonInstitutions().map((i: CompareItem) => i.id.toLowerCase()), ); const currentCountryIds = new Set( - this.comparisonCountries().map((c) => c.id.toLowerCase()), + this.comparisonCountries().map((c: CompareItem) => c.id.toLowerCase()), ); const currentRegionIds = new Set( - this.comparisonRegions().map((r) => r.id.toLowerCase()), + this.comparisonRegions().map((r: CompareItem) => r.id.toLowerCase()), ); const defaultInstId = 'https://openalex.org/I62318514'.toLowerCase(); @@ -97,17 +128,9 @@ export class UniTrendParentComponent implements OnInit { if (s.entity_type === 'institution') { return id === defaultInstId || currentInstIds.has(id); } else if (s.entity_type === 'country') { - return ( - currentCountryIds.has(id) || - currentCountryIds.has('https://openalex.org/countries/' + id) || - Array.from(currentCountryIds).some((cid) => cid.endsWith('/' + id)) - ); + return currentCountryIds.has(id); } else if (s.entity_type === 'region') { - return ( - currentRegionIds.has(id) || - currentRegionIds.has('https://openalex.org/continents/' + id) || - Array.from(currentRegionIds).some((rid) => rid.endsWith('/' + id)) - ); + return currentRegionIds.has(id); } return false; }); @@ -121,31 +144,31 @@ export class UniTrendParentComponent implements OnInit { // Computed dirty state to enable "Search" button readonly isDirty = computed(() => { const fetchedInsts = this.fetchedInstitutions() - .map((i) => i.id) + .map((i: CompareItem) => i.id) .sort() .join(','); const currentInsts = this.comparisonInstitutions() - .map((i) => i.id) + .map((i: CompareItem) => i.id) .sort() .join(','); if (fetchedInsts !== currentInsts) return true; const fetchedC = this.fetchedCountries() - .map((c) => c.id) + .map((c: CompareItem) => c.id) .sort() .join(','); const currentC = this.comparisonCountries() - .map((c) => c.id) + .map((c: CompareItem) => c.id) .sort() .join(','); if (fetchedC !== currentC) return true; const fetchedR = this.fetchedRegions() - .map((r) => r.id) + .map((r: CompareItem) => r.id) .sort() .join(','); const currentR = this.comparisonRegions() - .map((r) => r.id) + .map((r: CompareItem) => r.id) .sort() .join(','); if (fetchedR !== currentR) return true; @@ -173,7 +196,7 @@ export class UniTrendParentComponent implements OnInit { if (kws.length > 0) { // Find existing selections that are still in keywords, or default to all - const validSelections = currentSelections.filter((t) => + const validSelections = currentSelections.filter((t: string) => kws.includes(t), ); if (validSelections.length > 0) { @@ -188,6 +211,12 @@ export class UniTrendParentComponent implements OnInit { if (!active || !updatedSelections.includes(active)) { this.activeChartTopic.set(updatedSelections[0] || ''); } + + // If comparison list is empty, initialize default institutions dynamically + const currentInsts = untracked(() => this.comparisonInstitutions()); + if (currentInsts.length === 0) { + untracked(() => this.initializeDefaultInstitutions()); + } } else { this.selectedTrendTopics.set([]); } @@ -202,7 +231,7 @@ export class UniTrendParentComponent implements OnInit { const insts = Array.isArray(params['institutions']) ? params['institutions'] : [params['institutions']]; - const parsed = insts.map((i) => { + const parsed = insts.map((i: string) => { const parts = i.split('|'); return { id: parts[0], name: parts[1] || parts[0] }; }); @@ -213,7 +242,7 @@ export class UniTrendParentComponent implements OnInit { const ccs = Array.isArray(params['countries']) ? params['countries'] : [params['countries']]; - const parsed = ccs.map((c) => { + const parsed = ccs.map((c: string) => { const parts = c.split('|'); return { id: parts[0], name: parts[1] || parts[0] }; }); @@ -224,7 +253,7 @@ export class UniTrendParentComponent implements OnInit { const regs = Array.isArray(params['regions']) ? params['regions'] : [params['regions']]; - const parsed = regs.map((r) => { + const parsed = regs.map((r: string) => { const parts = r.split('|'); return { id: parts[0], name: parts[1] || parts[0] }; }); @@ -243,16 +272,69 @@ export class UniTrendParentComponent implements OnInit { if (params['active_chart_topic']) { this.activeChartTopic.set(params['active_chart_topic']); } - - // Auto-trigger load once on initial page render if keywords are present - if (this.rawTrendResponse() === null && this.keywords().length > 0) { - this.fetchTrendData(); - } }); } ngOnInit() { this.loadTrendSuggestions(); + this.initializeDefaultInstitutions(); + } + + // Dynamically load top institutions to initialize comparisons using the top-institutions service + initializeDefaultInstitutions() { + const kws = this.keywords(); + if (kws.length === 0) return; + + const topic = kws[0]; + this.isSuggestionsLoading.set(true); + + forkJoin({ + deInsts: + this.apiService.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic, + undefined, + 'DE', + 2, + ), + overallInsts: + this.apiService.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( + topic, + undefined, + undefined, + 2, + ), + }).subscribe({ + next: ({ + deInsts, + overallInsts, + }: { + deInsts: Array; + overallInsts: Array; + }) => { + const uniqueInsts = new Map(); + + // Add DE ones + deInsts.forEach((inst: TopInstitutionItem) => { + if (inst.id) uniqueInsts.set(inst.id, inst.display_name || 'Unknown'); + }); + + // Add overall ones + overallInsts.forEach((inst: TopInstitutionItem) => { + if (inst.id) uniqueInsts.set(inst.id, inst.display_name || 'Unknown'); + }); + + const list = Array.from(uniqueInsts.entries()).map(([id, name]) => ({ + id, + name, + })); + this.comparisonInstitutions.set(list); + this.isSuggestionsLoading.set(false); + }, + error: (err: any) => { + console.error('Failed to load default institutions dynamically:', err); + this.isSuggestionsLoading.set(false); + }, + }); } // Fetch recommended institutions for comparison based on current topics @@ -268,11 +350,11 @@ export class UniTrendParentComponent implements OnInit { const countryFilter = this.comparisonCountries().length > 0 - ? this.comparisonCountries()[0].id.split('/').pop() + ? this.comparisonCountries()[0].id : undefined; const regionFilter = this.comparisonRegions().length > 0 - ? this.comparisonRegions()[0].name + ? this.comparisonRegions()[0].id : undefined; this.apiService @@ -283,7 +365,7 @@ export class UniTrendParentComponent implements OnInit { 6, ) .subscribe({ - next: (res) => { + next: (res: any) => { this.topSuggestions.set(res || []); this.isSuggestionsLoading.set(false); }, @@ -309,12 +391,12 @@ export class UniTrendParentComponent implements OnInit { this.apiService .getTrendApiInseServiceUniversityRankingsTrendGet( topics, - this.comparisonInstitutions().map((i) => i.id), - this.comparisonCountries().map((c) => c.id), - this.comparisonRegions().map((r) => r.id), + this.comparisonInstitutions().map((i: CompareItem) => i.id), + this.comparisonCountries().map((c: CompareItem) => c.id), + this.comparisonRegions().map((r: CompareItem) => r.id), ) .subscribe({ - next: (response) => { + next: (response: TrendResponse) => { this.rawTrendResponse.set(response); this.isTrendLoading.set(false); this.updateUrlParams(); @@ -331,15 +413,21 @@ export class UniTrendParentComponent implements OnInit { trend_topics: this.selectedTrendTopics(), institutions: this.comparisonInstitutions().length > 0 - ? this.comparisonInstitutions().map((i) => `${i.id}|${i.name}`) + ? this.comparisonInstitutions().map( + (i: CompareItem) => `${i.id}|${i.name}`, + ) : null, countries: this.comparisonCountries().length > 0 - ? this.comparisonCountries().map((c) => `${c.id}|${c.name}`) + ? this.comparisonCountries().map( + (c: CompareItem) => `${c.id}|${c.name}`, + ) : null, regions: this.comparisonRegions().length > 0 - ? this.comparisonRegions().map((r) => `${r.id}|${r.name}`) + ? this.comparisonRegions().map( + (r: CompareItem) => `${r.id}|${r.name}`, + ) : null, start_year: this.startYear(), end_year: this.endYear(), @@ -364,7 +452,9 @@ export class UniTrendParentComponent implements OnInit { updated = current.includes(topic) ? current : [...current, topic]; } else { updated = - current.length > 1 ? current.filter((t) => t !== topic) : current; + current.length > 1 + ? current.filter((t: string) => t !== topic) + : current; if (current.length === 1) { (event.target as HTMLInputElement).checked = true; } @@ -382,7 +472,10 @@ export class UniTrendParentComponent implements OnInit { // Add comparison institution addInstitution(id: string, name: string) { const current = this.comparisonInstitutions(); - if (!current.some((i) => i.id === id) && id !== this.primaryInstitution()) { + if ( + !current.some((i: CompareItem) => i.id === id) && + id !== this.primaryInstitution() + ) { this.comparisonInstitutions.set([...current, { id, name }]); } this.searchQuery.set(''); @@ -392,14 +485,16 @@ export class UniTrendParentComponent implements OnInit { // Remove comparison institution (data reuses instantly via computed) removeInstitution(id: string) { const current = this.comparisonInstitutions(); - this.comparisonInstitutions.set(current.filter((i) => i.id !== id)); + this.comparisonInstitutions.set( + current.filter((i: CompareItem) => i.id !== id), + ); } // Add country or region addLocation(loc: AutocompleteLocationItem) { if (loc.type === 'country') { const current = this.comparisonCountries(); - if (!current.some((c) => c.id === loc.id)) { + if (!current.some((c: CompareItem) => c.id === loc.id)) { this.comparisonCountries.set([ ...current, { id: loc.id, name: loc.display_name }, @@ -407,7 +502,7 @@ export class UniTrendParentComponent implements OnInit { } } else if (loc.type === 'continent') { const current = this.comparisonRegions(); - if (!current.some((r) => r.id === loc.id)) { + if (!current.some((r: CompareItem) => r.id === loc.id)) { this.comparisonRegions.set([ ...current, { id: loc.id, name: loc.display_name }, @@ -423,16 +518,20 @@ export class UniTrendParentComponent implements OnInit { removeLocation(id: string, type: 'country' | 'continent') { if (type === 'country') { const current = this.comparisonCountries(); - this.comparisonCountries.set(current.filter((c) => c.id !== id)); + this.comparisonCountries.set( + current.filter((c: CompareItem) => c.id !== id), + ); } else if (type === 'continent') { const current = this.comparisonRegions(); - this.comparisonRegions.set(current.filter((r) => r.id !== id)); + this.comparisonRegions.set( + current.filter((r: CompareItem) => r.id !== id), + ); } this.loadTrendSuggestions(); } // Scaling mode toggle (data reuses instantly) - setChartMode(mode: 'normalized' | 'total') { + setChartMode(mode: 'normalized' | 'total' | 'cumulative') { this.chartMode.set(mode); this.updateUrlParams(); } @@ -450,7 +549,7 @@ export class UniTrendParentComponent implements OnInit { this.institutionsApiService .autocompleteInstitutions(query, undefined, 'education', 10) .subscribe({ - next: (res) => { + next: (res: AutocompleteResponse) => { this.searchResults.set(res.results || []); }, error: () => { @@ -471,7 +570,7 @@ export class UniTrendParentComponent implements OnInit { query, ) .subscribe({ - next: (res) => { + next: (res: AutocompleteLocationItem[]) => { this.locationSearchResults.set(res || []); }, error: () => { From dfb1413b05aa4c98a472a3b8f74473a8de31a6d5 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 10:45:57 +0200 Subject: [PATCH 88/92] Changed trend frontend (Everything in German, stacking chart, y-axis overlap fix, tooltip information addition, recomended institutions layout change) --- .../keywords-search.component.html | 14 +- .../keywords-search.component.ts | 8 + .../uni-trend-chart.component.html | 6 +- .../uni-trend-chart.component.ts | 291 +++++++++++------- .../uni-trend-parent.component.html | 140 +++++---- .../uni-trend-parent.component.ts | 38 ++- 6 files changed, 308 insertions(+), 189 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index d30dc5f6..f9abedb9 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -218,8 +218,8 @@
    - -
    + +
    +
    - @if (selectedKeywords().length > 0) { + @if (showVisualization() && selectedKeywords().length > 0) {
    diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 52312b88..bdb253f8 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -85,6 +85,7 @@ export class KeywordsSearchComponent { readonly selectedKeywords = signal([]); readonly isExtracting = signal(false); readonly extractionSource = signal(null); + readonly showVisualization = signal(false); // Single place mapping a category name to its label signal and its // backing entries signal. Replaces four near-identical computed()s and @@ -505,6 +506,7 @@ export class KeywordsSearchComponent { } search(): void { + this.showVisualization.set(false); const payload = { extractedKeywords: this.getSelectedExtractedKeywordEntries(), manualKeywords: this.getSelectedManualKeywordEntries(), @@ -516,6 +518,10 @@ export class KeywordsSearchComponent { // this.router.navigate(['/search'], { state: payload }); } + visualize(): void { + this.showVisualization.set(true); + } + // --- Helpers -------------------------------------------------------------- private selectedInCategory(category: KeywordCategory): Signal { @@ -682,6 +688,8 @@ export class KeywordsSearchComponent { updateQueryParams(): void { if (this.isRestoringState) return; + this.showVisualization.set(false); + const queryParams = { mode: this.form.controls.selectedInputType.value, url: this.toNullableParam(this.form.controls.urlInput.value), diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html index 0ac5df9a..a908dda2 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html @@ -8,10 +8,10 @@ } @else {
    📊
    -

    No Trend Data Available

    +

    Keine Trenddaten verfügbar

    - Please select at least one topic and choose institutions or regions to - compare in the control panel. + Bitte wählen Sie mindestens ein Thema und Einrichtungen oder Regionen im + Kontrollfeld aus, um sie zu vergleichen.

    } diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts index 8f935aa8..07757b0c 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts @@ -59,11 +59,22 @@ export class UniTrendChartComponent { '#8b5cf6', // Purple '#06b6d4', // Cyan '#6366f1', // Indigo + '#ef4444', // Red + '#14b8a6', // Teal + '#f97316', // Orange + '#d946ef', // Fuchsia + '#84cc16', // Lime + '#22c55e', // Green + '#a855f7', // Purple/Fuchsia + '#eab308', // Amber/Yellow Dark + '#f43f5e', // Rose ]; + const getEntityColor = (idx: number) => + entityColors[idx % entityColors.length]; // Build series: Line in top grid, growth volume bars and S-Curve in bottom grid trendData.series.forEach((entity, entityIdx) => { - const color = entityColors[entityIdx % entityColors.length]; + const color = getEntityColor(entityIdx); const yrTopicData = entity.topic_data[selectedTopic] || []; // 1. Add line series for the currently selected topic (placed in Grid 0) @@ -76,11 +87,17 @@ export class UniTrendChartComponent { return currentMode === 'normalized' ? yrData.normalized : yrData.raw; }); + const isStacked = currentMode === 'total' || currentMode === 'cumulative'; + series.push({ name: `${entity.entity_name}`, type: 'line', xAxisIndex: 0, yAxisIndex: 0, + stack: isStacked ? 'Total' : undefined, + areaStyle: { + opacity: isStacked ? 0.3 : 0.12, + }, data: lineData, smooth: true, lineStyle: { @@ -91,6 +108,7 @@ export class UniTrendChartComponent { color: color, }, emphasis: { + focus: 'series', lineStyle: { width: 3.5 }, }, }); @@ -108,7 +126,7 @@ export class UniTrendChartComponent { }); series.push({ - name: `${entity.entity_name} (YoY Growth)`, + name: `${entity.entity_name} (YoY Wachstum)`, type: 'bar', xAxisIndex: 1, yAxisIndex: 1, @@ -116,19 +134,33 @@ export class UniTrendChartComponent { itemStyle: { color: color, // Takes the color of the institution! }, + markLine: + entityIdx === 0 + ? { + silent: true, + symbol: 'none', + label: { show: false }, + lineStyle: { + type: 'solid', + color: '#374151', + width: 1.5, + }, + data: [{ yAxis: 0 }], + } + : undefined, }); }); const yAxisName = currentMode === 'normalized' - ? 'Normalized Scale (0 - 1)' + ? 'Normierte Skala (0 - 1)' : currentMode === 'cumulative' - ? 'Cumulative Publications' - : 'Publications Volume'; + ? 'Kumulierte Publikationen' + : 'Publikationsvolumen'; return { title: { - text: `Publication Trends: ${selectedTopic}`, + text: `Publikationstrends: ${selectedTopic}`, left: 'left', textStyle: { fontSize: 16, @@ -138,24 +170,27 @@ export class UniTrendChartComponent { }, tooltip: { trigger: 'axis', - backgroundColor: 'rgba(255, 255, 255, 0.96)', + backgroundColor: 'rgba(255, 255, 255, 0.98)', borderColor: '#e5e7eb', borderWidth: 1, - padding: 0, + padding: 8, + confine: true, + extraCssText: + 'z-index: 9999; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); border-radius: 8px;', textStyle: { color: '#374151', - fontSize: 12, + fontSize: 11, }, formatter: (params: any) => { if (!params || params.length === 0) return ''; const yearNum = parseInt(params[0].name, 10); - let res = `
    `; - res += `Year: ${yearNum}
    `; - res += `
    `; + let res = `
    `; + res += `Jahr: ${yearNum}`; + res += `
    `; trendData.series.forEach((entity: TrendSeries, entityIdx: number) => { - const color = entityColors[entityIdx % entityColors.length]; + const color = getEntityColor(entityIdx); const yrTopicData = entity.topic_data[selectedTopic] || []; // Recalculate cumulative sum map for this entity @@ -167,112 +202,122 @@ export class UniTrendChartComponent { cumulativeSumMap.set(yr, runningSum); }); - res += `
    `; - res += ``; - res += `${entity.entity_name}:
    `; - const yrData = yrTopicData.find( (y: TopicYearlyData) => y.year === yearNum, ); if (yrData) { - const val = - currentMode === 'normalized' - ? yrData.normalized - : currentMode === 'cumulative' - ? cumulativeSumMap.get(yearNum) || 0 - : yrData.raw; + const rawCount = yrData.raw; + const normVal = yrData.normalized.toFixed(2); + const cumVal = cumulativeSumMap.get(yearNum) || 0; - const displayVal = - currentMode === 'normalized' - ? val.toFixed(2) - : val.toLocaleString(); + // YoY growth + const prevYrData = yrTopicData.find( + (y) => y.year === yearNum - 1, + ); + const prevRawCount = prevYrData ? prevYrData.raw : 0; + const yoyGrowth = rawCount - prevRawCount; let contributionStr = ''; - if (currentMode === 'total' || currentMode === 'cumulative') { - if (entity.entity_type === 'institution') { - const instCountryCode = entity.country_code?.toUpperCase(); + if (entity.entity_type === 'institution') { + const instCountryCode = entity.country_code?.toUpperCase(); - const parentCountry = trendData.series.find( - (s: TrendSeries) => - s.entity_type === 'country' && - s.entity_id.toUpperCase() === instCountryCode, - ); + const parentCountry = trendData.series.find( + (s: TrendSeries) => + s.entity_type === 'country' && + s.entity_id.toUpperCase() === instCountryCode, + ); - const parentContinent = trendData.series.find( - (s: TrendSeries) => { - if (s.entity_type !== 'region') return false; - const memberCountries = - trendData.location_mappings?.[s.entity_id] || []; - return memberCountries.some( - (c: string) => c.toUpperCase() === instCountryCode, + const parentContinent = trendData.series.find( + (s: TrendSeries) => { + if (s.entity_type !== 'region') return false; + const memberCountries = + trendData.location_mappings?.[s.entity_id] || []; + return memberCountries.some( + (c: string) => c.toUpperCase() === instCountryCode, + ); + }, + ); + + if (parentCountry) { + const parentYr = parentCountry.topic_data[ + selectedTopic + ]?.find((y: TopicYearlyData) => y.year === yearNum); + if (parentYr && parentYr.raw > 0) { + const parentCumulativeSum = + parentCountry.topic_data[selectedTopic] + ?.filter((y) => y.year <= yearNum) + .reduce((sum, y) => sum + y.raw, 0) || 0; + const instCumulativeSum = + cumulativeSumMap.get(yearNum) || 0; + const pct = + currentMode === 'cumulative' + ? parentCumulativeSum > 0 + ? (instCumulativeSum / parentCumulativeSum) * 100 + : 0 + : parentYr.raw > 0 + ? (yrData.raw / parentYr.raw) * 100 + : 0; + contributionStr = ` (${pct.toFixed(1)} % von ${parentCountry.entity_name})`; + } + } else if (parentContinent) { + const parentYr = parentContinent.topic_data[ + selectedTopic + ]?.find((y: TopicYearlyData) => y.year === yearNum); + if (parentYr && parentYr.raw > 0) { + const parentCumulativeSum = + parentContinent.topic_data[selectedTopic] + ?.filter((y) => y.year <= yearNum) + .reduce((sum, y) => sum + y.raw, 0) || 0; + const instCumulativeSum = + cumulativeSumMap.get(yearNum) || 0; + const pct = + currentMode === 'cumulative' + ? parentCumulativeSum > 0 + ? (instCumulativeSum / parentCumulativeSum) * 100 + : 0 + : parentYr.raw > 0 + ? (yrData.raw / parentYr.raw) * 100 + : 0; + contributionStr = ` (${pct.toFixed(1)} % von ${parentContinent.entity_name})`; + } + } else { + const sumInsts = trendData.series + .filter((s: TrendSeries) => s.entity_type === 'institution') + .reduce((sum: number, s: TrendSeries) => { + const y = s.topic_data[selectedTopic]?.find( + (yd: TopicYearlyData) => yd.year === yearNum, ); - }, - ); - - if (parentCountry) { - const parentYr = parentCountry.topic_data[ - selectedTopic - ]?.find((y: TopicYearlyData) => y.year === yearNum); - if (parentYr && parentYr.raw > 0) { - const parentCumulativeSum = - parentCountry.topic_data[selectedTopic] - ?.filter((y) => y.year <= yearNum) - .reduce((sum, y) => sum + y.raw, 0) || 0; - const instCumulativeSum = - cumulativeSumMap.get(yearNum) || 0; - const pct = - currentMode === 'cumulative' - ? parentCumulativeSum > 0 - ? (instCumulativeSum / parentCumulativeSum) * 100 - : 0 - : parentYr.raw > 0 - ? (yrData.raw / parentYr.raw) * 100 - : 0; - contributionStr = ` (${pct.toFixed(1)}% of ${parentCountry.entity_name})`; - } - } else if (parentContinent) { - const parentYr = parentContinent.topic_data[ - selectedTopic - ]?.find((y: TopicYearlyData) => y.year === yearNum); - if (parentYr && parentYr.raw > 0) { - const parentCumulativeSum = - parentContinent.topic_data[selectedTopic] - ?.filter((y) => y.year <= yearNum) - .reduce((sum, y) => sum + y.raw, 0) || 0; - const instCumulativeSum = - cumulativeSumMap.get(yearNum) || 0; - const pct = - currentMode === 'cumulative' - ? parentCumulativeSum > 0 - ? (instCumulativeSum / parentCumulativeSum) * 100 - : 0 - : parentYr.raw > 0 - ? (yrData.raw / parentYr.raw) * 100 - : 0; - contributionStr = ` (${pct.toFixed(1)}% of ${parentContinent.entity_name})`; - } - } else { - const sumInsts = trendData.series - .filter( - (s: TrendSeries) => s.entity_type === 'institution', - ) - .reduce((sum: number, s: TrendSeries) => { - const y = s.topic_data[selectedTopic]?.find( - (yd: TopicYearlyData) => yd.year === yearNum, - ); - return sum + (y ? y.raw : 0); - }, 0); - if (sumInsts > 0) { - const pct = (yrData.raw / sumInsts) * 100; - contributionStr = ` (${pct.toFixed(1)}% of compared institutions)`; - } + return sum + (y ? y.raw : 0); + }, 0); + if (sumInsts > 0) { + const pct = (yrData.raw / sumInsts) * 100; + contributionStr = ` (${pct.toFixed(1)} % der verglichenen Inst.)`; } } } - res += `• ${selectedTopic}: ${displayVal}${contributionStr}
    `; + res += `
    `; + res += `
    `; + res += ``; + res += `${entity.entity_name}`; + res += `
    `; + + res += ``; + res += ``; + res += ``; + res += ``; + + const yoySign = yoyGrowth > 0 ? '+' : ''; + const yoyColor = + yoyGrowth > 0 + ? '#10b981' + : yoyGrowth < 0 + ? '#ef4444' + : '#6b7280'; + res += ``; + res += `
    • Publikationen:${rawCount.toLocaleString()}${contributionStr}
    • Normiert (0-1):${normVal}
    • Kumuliert:${cumVal.toLocaleString()}
    • YoY Wachstum:${yoySign}${yoyGrowth.toLocaleString()}
    `; + res += `
    `; } - res += `
    `; }); res += `
    `; @@ -295,13 +340,13 @@ export class UniTrendChartComponent { }, grid: [ { - left: 60, + left: 80, right: 220, - top: 60, - height: 250, + top: 80, + height: 230, }, { - left: 60, + left: 80, right: 220, top: 360, height: 70, @@ -336,26 +381,46 @@ export class UniTrendChartComponent { { scale: true, name: yAxisName, - nameTextStyle: { color: '#4b5563', padding: [0, 0, 8, 0] }, + nameLocation: 'middle', + nameRotate: 90, + nameGap: 50, + nameTextStyle: { + color: '#4b5563', + padding: [0, 0, 8, 0], + fontWeight: 'bold', + }, axisLabel: { color: '#4b5563' }, axisLine: { lineStyle: { color: '#e5e7eb' } }, splitLine: { lineStyle: { color: '#f3f4f6' } }, }, { - scale: true, + scale: false, gridIndex: 1, splitNumber: 2, - axisLabel: { show: false }, + axisLabel: { + show: true, + color: '#6b7280', + fontSize: 9, + formatter: (value: number) => { + return value > 0 ? `+${value}` : `${value}`; + }, + }, axisLine: { show: false }, axisTick: { show: false }, - splitLine: { show: false }, + splitLine: { + show: true, + lineStyle: { + color: '#e5e7eb', + type: 'dashed', + }, + }, }, ], toolbox: { left: 'right', top: 'top', feature: { - saveAsImage: { title: 'Save' }, + saveAsImage: { title: 'Speichern' }, }, }, dataZoom: [ diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html index 9506f9bd..df4c6f45 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html @@ -1,11 +1,11 @@
    - +
    @@ -139,7 +139,7 @@
    - -
    -

    Suggested Top Institutions

    -
    - @if (isSuggestionsLoading()) { -
    Loading suggestions...
    - } @else { - @for (item of topSuggestions(); track item.id || '') { - - } - } -
    -
    - - +
    - +
    - Visualization Scale: + Visualisierungsskala:
    @@ -234,7 +204,7 @@ @if (isTrendLoading()) {
    -

    Retrieving trend data from works index...

    +

    Trenddaten werden aus dem Publikationsverzeichnis abgerufen...

    } @if (selectedTrendTopics().length > 1) { @@ -255,5 +225,53 @@ [startYear]="startYear()" [endYear]="endYear()">
    + + +
    +

    + Empfohlene Top-Einrichtungen für das Thema: {{ activeChartTopic() }} +

    +
    + @if (isSuggestionsLoading()) { +
    +
    + Empfehlungen werden geladen... +
    + } @else { + @if (topSuggestions().length === 0) { +

    + Keine Empfehlungen für dieses Thema gefunden. +

    + } @else { +
    + @for (item of topSuggestions(); track item.id || '') { + + } +
    + } + } +
    +
    diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index dca2a6c2..154437de 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -72,11 +72,11 @@ export class UniTrendParentComponent implements OnInit { readonly selectedTrendTopics = signal([]); readonly primaryInstitution = signal(null); readonly primaryInstitutionName = signal( - 'University of Duisburg-Essen', + 'Universität Duisburg-Essen', ); readonly comparisonInstitutions = signal([]); readonly comparisonCountries = signal([ - { id: 'DE', name: 'Germany' }, + { id: 'DE', name: 'Deutschland' }, ]); readonly comparisonRegions = signal([]); readonly startYear = signal(2010); @@ -224,6 +224,20 @@ export class UniTrendParentComponent implements OnInit { { allowSignalWrites: true }, ); + // Effect: load suggestions when topic or location filters change + effect( + () => { + const topic = this.activeChartTopic(); + const countries = this.comparisonCountries(); + const regions = this.comparisonRegions(); + + untracked(() => { + this.loadTrendSuggestions(); + }); + }, + { allowSignalWrites: true }, + ); + // Handle initialization and synchronization of URL state this.route.queryParams.subscribe((params) => { // Parse institutions serialized as id|name @@ -276,7 +290,6 @@ export class UniTrendParentComponent implements OnInit { } ngOnInit() { - this.loadTrendSuggestions(); this.initializeDefaultInstitutions(); } @@ -315,12 +328,14 @@ export class UniTrendParentComponent implements OnInit { // Add DE ones deInsts.forEach((inst: TopInstitutionItem) => { - if (inst.id) uniqueInsts.set(inst.id, inst.display_name || 'Unknown'); + if (inst.id) + uniqueInsts.set(inst.id, inst.display_name || 'Unbekannt'); }); // Add overall ones overallInsts.forEach((inst: TopInstitutionItem) => { - if (inst.id) uniqueInsts.set(inst.id, inst.display_name || 'Unknown'); + if (inst.id) + uniqueInsts.set(inst.id, inst.display_name || 'Unbekannt'); }); const list = Array.from(uniqueInsts.entries()).map(([id, name]) => ({ @@ -329,6 +344,11 @@ export class UniTrendParentComponent implements OnInit { })); this.comparisonInstitutions.set(list); this.isSuggestionsLoading.set(false); + + // Auto-fetch trend data on first load if we don't have it yet + if (!this.rawTrendResponse()) { + this.fetchTrendData(); + } }, error: (err: any) => { console.error('Failed to load default institutions dynamically:', err); @@ -340,13 +360,13 @@ export class UniTrendParentComponent implements OnInit { // Fetch recommended institutions for comparison based on current topics loadTrendSuggestions() { this.isSuggestionsLoading.set(true); - const topics = this.selectedTrendTopics(); const topic = - topics.length > 0 - ? topics[0] + this.activeChartTopic() || + (this.selectedTrendTopics().length > 0 + ? this.selectedTrendTopics()[0] : this.keywords().length > 0 ? this.keywords()[0] - : 'Artificial Intelligence'; + : 'Artificial Intelligence'); const countryFilter = this.comparisonCountries().length > 0 From e9ba8741030ad60f8a388aac7815c34c13a0432e Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 10:46:36 +0200 Subject: [PATCH 89/92] regenerated frontend service --- .../src/app/api/model/topInstitutionItem.ts | 1 - webapp/src/app/api/model/topicYearlyData.ts | 1 + .../uni-trend-parent.component.scss | 109 ++++++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/api/model/topInstitutionItem.ts b/webapp/src/app/api/model/topInstitutionItem.ts index 827fe6df..a98f52b8 100644 --- a/webapp/src/app/api/model/topInstitutionItem.ts +++ b/webapp/src/app/api/model/topInstitutionItem.ts @@ -16,6 +16,5 @@ export interface TopInstitutionItem { type?: string | null; lineage?: Array | null; works_count?: number | null; - image_thumbnail_url?: string | null; exact_topic_count?: number | null; } diff --git a/webapp/src/app/api/model/topicYearlyData.ts b/webapp/src/app/api/model/topicYearlyData.ts index 15e4c59a..a1fdbdc2 100644 --- a/webapp/src/app/api/model/topicYearlyData.ts +++ b/webapp/src/app/api/model/topicYearlyData.ts @@ -12,5 +12,6 @@ export interface TopicYearlyData { year: number; raw: number; normalized: number; + cumulative: number; institutions_count: number; } diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss index 7e2eda37..92d2ed52 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss @@ -447,3 +447,112 @@ box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } } + +.suggestions-below-card { + background: white; + border-radius: 10px; + padding: 1.25rem; + border: 1px solid #e5e7eb; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); + margin-top: 1rem; + + h3 { + font-size: 0.875rem; + font-weight: 600; + color: #374151; + margin: 0 0 1rem 0; + } + + .suggestions-loader { + display: flex; + align-items: center; + gap: 0.5rem; + color: #6b7280; + font-size: 0.8125rem; + padding: 1rem 0; + + .spinner-small { + width: 16px; + height: 16px; + border: 2px solid rgba(59, 130, 246, 0.1); + border-radius: 50%; + border-top-color: #3b82f6; + animation: spin 0.8s linear infinite; + } + } + + .no-suggestions-msg { + font-size: 0.8125rem; + color: #6b7280; + text-align: center; + padding: 1rem 0; + } + + .suggestions-flex { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + gap: 0.75rem; + } +} + +.suggestion-item-horizontal { + display: flex; + align-items: center; + gap: 0.75rem; + background: #f9fafb; + border: 1px solid #e5e7eb; + border-radius: 8px; + padding: 0.6rem 0.8rem; + text-align: left; + cursor: pointer; + transition: all 0.2s ease; + width: 100%; + box-sizing: border-box; + + &:hover:not([disabled]) { + border-color: #3b82f6; + background: #f0f9ff; + transform: translateY(-1px); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); + } + + &[disabled] { + opacity: 0.5; + cursor: not-allowed; + background: #f3f4f6; + } + + .add-icon { + font-size: 1.1rem; + color: #3b82f6; + font-weight: bold; + display: flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + border-radius: 50%; + background: rgba(59, 130, 246, 0.1); + flex-shrink: 0; + } + + .info { + display: flex; + flex-direction: column; + overflow: hidden; + + .name { + font-size: 0.8125rem; + color: #374151; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-weight: 600; + } + .meta { + font-size: 0.7rem; + color: #6b7280; + margin-top: 2px; + } + } +} From 4461b26270b707f49fc82bb0df0c481cf907bd8f Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:22:33 +0200 Subject: [PATCH 90/92] changed icons, to match the project icons --- .../uni-trend-chart.component.html | 7 ++- .../uni-trend-chart.component.ts | 3 +- .../uni-trend-parent.component.html | 33 +++++++------ .../uni-trend-parent.component.scss | 47 +++++++++++++++++-- 4 files changed, 70 insertions(+), 20 deletions(-) diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html index a908dda2..60e763bc 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.html @@ -7,7 +7,12 @@ class="trend-chart-render">
    } @else {
    -
    📊
    +
    + bar_chart +

    Keine Trenddaten verfügbar

    Bitte wählen Sie mindestens ein Thema und Einrichtungen oder Regionen im diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts index 07757b0c..9056e335 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts @@ -6,13 +6,14 @@ import { } from '@angular/core'; import { EChartsOption } from 'echarts'; import { NgxEchartsDirective } from 'ngx-echarts'; +import { MatIconModule } from '@angular/material/icon'; import { TrendResponse, TrendSeries, TopicYearlyData } from '../../../api'; @Component({ selector: 'app-uni-trend-chart', templateUrl: './uni-trend-chart.component.html', styleUrl: './uni-trend-chart.component.scss', - imports: [NgxEchartsDirective], + imports: [NgxEchartsDirective, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, }) export class UniTrendChartComponent { diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html index df4c6f45..6df126cd 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html @@ -52,23 +52,27 @@ ) { @for (c of comparisonCountries(); track c.id) {

    - 🏳️ {{ c.name }} + flag {{ c.name }}
    } @for (r of comparisonRegions(); track r.id) {
    - 🌍 {{ r.name }} + public {{ r.name }}
    } @@ -119,13 +123,13 @@ @for (inst of comparisonInstitutions(); track inst.id) {
    🏫 {{ inst.name }}apartment {{ inst.name }}
    } @@ -169,7 +173,8 @@ [class.dirty]="isDirty()" [disabled]="isTrendLoading() || selectedTrendTopics().length === 0" (click)="fetchTrendData()"> - 🔍 {{ isDirty() ? 'Änderungen übernehmen' : 'Trend suchen' }} + search + {{ isDirty() ? 'Änderungen übernehmen' : 'Trend suchen' }}
    @@ -183,19 +188,19 @@ [class.active]="chartMode() === 'normalized'" (click)="setChartMode('normalized')" title="Normiert das Publikationsvolumen auf [0,1], um die Form von Wachstumstrends zu vergleichen."> - 📉 Normierte Skala + trending_down Normierte Skala
    @@ -213,7 +218,7 @@ }
    @@ -255,14 +260,12 @@ ? comparisonInstitutions().some((i) => i.id === item.id) : false) || primaryInstitution() === item.id "> - + + add
    {{ item.display_name }} {{ item.country_code }} • - {{ - item.exact_topic_count?.toLocaleString() - }} + {{ item.exact_topic_count?.toLocaleString() }} Publikationen
    diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss index 92d2ed52..68ec8b97 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss @@ -87,12 +87,21 @@ padding: 0.3rem 0.5rem; .item-name { + display: inline-flex; + align-items: center; + gap: 4px; font-size: 0.75rem; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; + + mat-icon { + font-size: 14px; + width: 14px; + height: 14px; + } } .remove-btn { @@ -100,9 +109,18 @@ border: none; color: #9ca3af; cursor: pointer; - font-size: 0.7rem; padding: 1px 4px; border-radius: 3px; + display: inline-flex; + align-items: center; + justify-content: center; + + mat-icon { + font-size: 12px; + width: 12px; + height: 12px; + } + &:hover { color: #ef4444; background: #fee2e2; @@ -286,6 +304,15 @@ color: #4b5563; border-radius: 5px; cursor: pointer; + display: inline-flex; + align-items: center; + gap: 6px; + + mat-icon { + font-size: 16px; + width: 16px; + height: 16px; + } &:hover:not(.active) { color: #111827; @@ -325,6 +352,15 @@ font-weight: 500; cursor: pointer; transition: all 0.15s ease; + display: inline-flex; + align-items: center; + gap: 4px; + + mat-icon { + font-size: 14px; + width: 14px; + height: 14px; + } &:hover { border-color: #3b82f6; @@ -391,6 +427,12 @@ color: white; transition: all 0.2s ease; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + &:hover:not([disabled]) { background-color: #2563eb; border-color: #2563eb; @@ -523,9 +565,7 @@ } .add-icon { - font-size: 1.1rem; color: #3b82f6; - font-weight: bold; display: flex; align-items: center; justify-content: center; @@ -534,6 +574,7 @@ border-radius: 50%; background: rgba(59, 130, 246, 0.1); flex-shrink: 0; + font-size: 14px; } .info { From 86bced4940e80ef51aa453418cad1d870f6af08f Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:32:31 +0200 Subject: [PATCH 91/92] fixed diagramm tooltip cutoff --- .../uni-trend-chart/uni-trend-chart.component.ts | 9 ++++++--- .../uni-trend-parent/uni-trend-parent.component.html | 11 ++++++----- .../uni-trend-parent/uni-trend-parent.component.ts | 7 +++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts index 9056e335..8dfdc67b 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-chart/uni-trend-chart.component.ts @@ -171,6 +171,7 @@ export class UniTrendChartComponent { }, tooltip: { trigger: 'axis', + enterable: true, backgroundColor: 'rgba(255, 255, 255, 0.98)', borderColor: '#e5e7eb', borderWidth: 1, @@ -186,9 +187,10 @@ export class UniTrendChartComponent { if (!params || params.length === 0) return ''; const yearNum = parseInt(params[0].name, 10); - let res = `
    `; + let res = `
    `; res += `Jahr: ${yearNum}`; res += `
    `; + res += `
    `; trendData.series.forEach((entity: TrendSeries, entityIdx: number) => { const color = getEntityColor(entityIdx); @@ -303,7 +305,7 @@ export class UniTrendChartComponent { res += `${entity.entity_name}`; res += `
    `; - res += ``; + res += `
    `; res += ``; res += ``; res += ``; @@ -321,7 +323,8 @@ export class UniTrendChartComponent { } }); - res += ``; + res += ``; // closes scrollable div + res += ``; // closes main wrapper return res; }, }, diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html index 6df126cd..69c6a181 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html @@ -215,11 +215,12 @@ @if (selectedTrendTopics().length > 1) {
    @for (topic of selectedTrendTopics(); track topic) { - + + }
    } diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index 154437de..7d38908b 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -33,6 +33,8 @@ import { UniversityRankingsService, InstitutionsService, } from '../../../api'; +import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component'; +import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors'; export interface CompareItem { id: string; @@ -54,6 +56,7 @@ export interface CompareItem { MatIconModule, MatProgressSpinnerModule, MatAutocompleteModule, + TopicChipComponent, ], templateUrl: './uni-trend-parent.component.html', styleUrl: './uni-trend-parent.component.scss', @@ -98,6 +101,10 @@ export class UniTrendParentComponent implements OnInit { readonly topSuggestions = signal([]); readonly isSuggestionsLoading = signal(false); + getTopicColor(topic: string): string { + return topicHierarchyColor({ name: topic }); + } + // Autocomplete UI state readonly searchQuery = signal(''); readonly searchResults = signal([]); From 9f03c92bc1dc9a377bfef6eaa31fd871366bc108 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:35:53 +0200 Subject: [PATCH 92/92] updated old code to remove warnings --- .../keywords-search.component.ts | 16 ++-- .../uni-trend-parent.component.ts | 81 +++++++++---------- 2 files changed, 45 insertions(+), 52 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 2697f79b..a4442326 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -75,6 +75,13 @@ type KeywordView = 'llm' | 'topic'; styleUrl: './keywords-search.component.scss', }) export class KeywordsSearchComponent { + private readonly formBuilder = inject(FormBuilder); + private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); + private readonly destroyRef = inject(DestroyRef); + private readonly websocketService = inject(KeywordWebSocketService); + private readonly topicsService = inject(TopicsService); + readonly form = this.formBuilder.nonNullable.group({ selectedInputType: 'url' as InputMode, urlInput: '', @@ -150,14 +157,7 @@ export class KeywordsSearchComponent { return buildTopicLegendGroups(topics); } - constructor( - private readonly formBuilder: FormBuilder, - private readonly route: ActivatedRoute, - private readonly router: Router, - private readonly destroyRef: DestroyRef, - private readonly websocketService: KeywordWebSocketService, - private readonly topicsService: TopicsService, - ) { + constructor() { this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { if (this.isOwnNavigation) { // This emission is just the router confirming the navigation we diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts index 7d38908b..2aa8650c 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts @@ -43,7 +43,6 @@ export interface CompareItem { @Component({ selector: 'app-uni-trend-parent', - standalone: true, imports: [ CommonModule, FormsModule, @@ -195,55 +194,49 @@ export class UniTrendParentComponent implements OnInit { } // Effect: automatically sync checkboxes list whenever input keywords change - effect( - () => { - const kws = this.keywords(); - const currentSelections = untracked(() => this.selectedTrendTopics()); - const currentActive = untracked(() => this.activeChartTopic()); + effect(() => { + const kws = this.keywords(); + const currentSelections = untracked(() => this.selectedTrendTopics()); + const currentActive = untracked(() => this.activeChartTopic()); - if (kws.length > 0) { - // Find existing selections that are still in keywords, or default to all - const validSelections = currentSelections.filter((t: string) => - kws.includes(t), - ); - if (validSelections.length > 0) { - this.selectedTrendTopics.set(validSelections); - } else { - this.selectedTrendTopics.set(kws); - } - - // Initialize active chart topic to the first selected topic if empty or invalid - const active = currentActive; - const updatedSelections = untracked(() => this.selectedTrendTopics()); - if (!active || !updatedSelections.includes(active)) { - this.activeChartTopic.set(updatedSelections[0] || ''); - } - - // If comparison list is empty, initialize default institutions dynamically - const currentInsts = untracked(() => this.comparisonInstitutions()); - if (currentInsts.length === 0) { - untracked(() => this.initializeDefaultInstitutions()); - } + if (kws.length > 0) { + // Find existing selections that are still in keywords, or default to all + const validSelections = currentSelections.filter((t: string) => + kws.includes(t), + ); + if (validSelections.length > 0) { + this.selectedTrendTopics.set(validSelections); } else { - this.selectedTrendTopics.set([]); + this.selectedTrendTopics.set(kws); } - }, - { allowSignalWrites: true }, - ); + + // Initialize active chart topic to the first selected topic if empty or invalid + const active = currentActive; + const updatedSelections = untracked(() => this.selectedTrendTopics()); + if (!active || !updatedSelections.includes(active)) { + this.activeChartTopic.set(updatedSelections[0] || ''); + } + + // If comparison list is empty, initialize default institutions dynamically + const currentInsts = untracked(() => this.comparisonInstitutions()); + if (currentInsts.length === 0) { + untracked(() => this.initializeDefaultInstitutions()); + } + } else { + this.selectedTrendTopics.set([]); + } + }); // Effect: load suggestions when topic or location filters change - effect( - () => { - const topic = this.activeChartTopic(); - const countries = this.comparisonCountries(); - const regions = this.comparisonRegions(); + effect(() => { + const topic = this.activeChartTopic(); + const countries = this.comparisonCountries(); + const regions = this.comparisonRegions(); - untracked(() => { - this.loadTrendSuggestions(); - }); - }, - { allowSignalWrites: true }, - ); + untracked(() => { + this.loadTrendSuggestions(); + }); + }); // Handle initialization and synchronization of URL state this.route.queryParams.subscribe((params) => {
    • Publikationen:${rawCount.toLocaleString()}${contributionStr}
    • Normiert (0-1):${normVal}
    • Kumuliert:${cumVal.toLocaleString()}