Compare commits

...
Author SHA1 Message Date
farajollahi b753f7dd00 implement all works of author
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good
2026-05-28 15:34:36 +02:00
Marcus Handte 982e01a26a Fix case in build file.
LocationBasedServices/smartguide/pipeline/head This commit looks good
2026-05-28 11:11:24 +02:00
farajollahi 4f3a427332 Merge pull request 'ts-83-User-Publications-filters' (#92) from ts-83-User-Publications-filters into dev
aiis/pipeline/head This commit looks good
Reviewed-on: nes/smartguide#92
2026-05-28 09:39:15 +02:00
farajollahi 5399cba01a Merge branch 'dev' into ts-83-User-Publications-filters
aiis/pipeline/head This commit looks good
aiis/pipeline/pr-dev This commit looks good
2026-05-28 09:34:35 +02:00
farajollahi 4c97983f51 implement filters
aiis/pipeline/head This commit looks good
2026-05-28 09:33:32 +02:00
Kazgatari 9da982acab changed build.gradle ' ' to " " (windows problems on build), added additional modular parameter to search person
aiis/pipeline/head This commit looks good
2026-05-28 09:03:41 +02:00
farajollahi 3f6cb911a0 Merge pull request 'Add backend endpoint for author works search' (#89) from ts-83-User-Publications into dev
aiis/pipeline/head This commit looks good
Reviewed-on: nes/smartguide#89
2026-05-27 23:28:09 +02:00
farajollahi 045bc4ff6c fix publication service
aiis/pipeline/pr-dev This commit looks good
2026-05-27 23:22:54 +02:00
farajollahi e48262cfaa Merge branch 'dev' into ts-83-User-Publications
aiis/pipeline/pr-dev This commit looks good
2026-05-27 23:16:29 +02:00
farajollahi b0b59ee3d3 fix styles of publications
aiis/pipeline/pr-dev There was a failure building this commit
2026-05-27 23:14:09 +02:00
Kazgatari 7667439658 Added Topic cache, Topic Model, count and aggregate Topic hierarchy
aiis/pipeline/head This commit looks good
2026-05-27 20:49:40 +02:00
farajollahi 8f93870cec clean structure of project
aiis/pipeline/pr-dev This commit looks good
2026-05-27 20:02:33 +02:00
farajollahi 26d8caf05c config overall styles
aiis/pipeline/pr-dev This commit looks good
2026-05-27 19:43:05 +02:00
farajollahi 48c5c376bc implement openapi
aiis/pipeline/pr-dev This commit looks good
2026-05-27 19:21:05 +02:00
farajollahi 4aca320d8d feat(webapp): add publications tab and table
aiis/pipeline/pr-dev This commit looks good
2026-05-27 14:28:02 +02:00
farajollahi a3783aecd3 Add backend endpoint for author works search
aiis/pipeline/head This commit looks good
aiis/pipeline/pr-dev There was a failure building this commit
2026-05-26 20:51:28 +02:00
132 changed files with 33972 additions and 556 deletions
View File
+24 -2
View File
@@ -12,9 +12,31 @@ task test(type: Exec) {
ignoreExitValue false
}
task exportOpenApiSpec(type: Exec) {
dependsOn createImage
def openApiDir = layout.buildDirectory.dir('openapi').get().asFile
def openApiFile = new File(openApiDir, 'inse-service.openapi.json')
inputs.dir file('src/main/inse')
outputs.file openApiFile
doFirst {
openApiDir.mkdirs()
}
commandLine 'docker', 'run', '--rm',
'--platform', "${targetPlatform}",
'-w', '/home',
'-v', "${projectDir}/src/main:/home",
'-v', "${openApiDir}:/mnt/openapi",
'-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'",
'--name', "${imageName}-service-openapi",
'--entrypoint', 'python',
"${imagePrefix}-service:${imageVersion}",
'-c',
"import json; from inse.service import app; open('/mnt/openapi/inse-service.openapi.json', 'w').write(json.dumps(app.openapi(), indent=2))"
}
task runServeContainer(type: Exec) {
dependsOn createImage
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '-e', 'INSE_OPENALEX_WORKS_API_KEY', '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
}
task stopServeContainer(type: Exec) {
@@ -47,5 +69,5 @@ task serve(type: Task) {
}
build {
dependsOn createImage, test
dependsOn createImage, exportOpenApiSpec, test
}
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -19,11 +19,16 @@ class Settings(BaseSettings):
auth_disabled: bool = False
auth_standalone: bool = True
auth_secret: str = 'change-me-to-a-secure-secret-key'
# OpenAlex works search config
openalex_works_search_base_url: str = 'https://project.nes.uni-due.de/elastic'
openalex_works_search_index: str = 'openalex-works'
openalex_works_api_key: str = 'am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=='
openalex_works_search_timeout_seconds: float = 30.0
llm_api_url: str = 'https://project.nes.uni-due.de/llm2/api/generate'
llm_api_token: str = 'c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212'
llm_model: str = 'gemma4:e4b'
elasticsearch_url: str = 'https://project.nes.uni-due.de/elastic/openalex-authors/_search'
elasticsearch_url: str = 'https://project.nes.uni-due.de/elastic/'
elasticsearch_api_key: str = 'am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=='
settings = Settings()
logger.info(f"Database URL: {settings.database_url}.")
logger.info(f"Database URL: {settings.database_url}.")
+180 -10
View File
@@ -22,6 +22,7 @@ from . import model
from . import config
logger = logging.getLogger(__name__)
topic_cache_filename: str = "topic_hierarchy_cache.json"
S = TypeVar('S', bound=schema.Base)
M = TypeVar('M', bound=model.BaseModel)
@@ -59,7 +60,146 @@ def insert_element(db: Session, value: S) -> S:
db.refresh(value)
return value
def search_persons(author_id: Optional[str] = None, query: Optional[str] = None) -> model.PersonSearchResult:
def _load_topic_cache() -> dict:
"""Loads the topic hierarchy cache from a JSON file. """
try:
cache_path = "/data/" + topic_cache_filename
with open(cache_path, "r", encoding="utf-8") as f:
return json.load(f)
except Exception as exc:
logger.warning("Failed to load topic hierarchy cache: %s", exc)
return {}
def build_topic_cache(page_size: int = 200,
save_json: bool = True) -> dict:
"""
Fetch topics from the hosted OpenAlex topics index and build a lookup cache (scheduled task).
Arguments:
page_size (int): Number of topics to fetch per request (default: 200)
save_json (bool): Whether to save the cache as a JSON file (default: True)
Returns:
taxonomy_cache (dict): The topic hierarchy dictionary.
"""
output_filename: str = "topic_hierarchy_cache.json"
headers = {
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
"Content-Type": "application/json"
}
taxonomy_cache = {}
offset = 0
with httpx.Client(timeout=30.0) as client:
while True:
payload = {
"query": {"match_all": {}},
"from": offset,
"size": page_size
}
response = client.post(config.settings.elasticsearch_url + '/openalex-topics/_search', json=payload, headers=headers)
response.raise_for_status()
data = response.json()
hits = data.get("hits", {}).get("hits", [])
if not hits:
break
for hit in hits:
source = hit.get("_source", {})
topic_name = source.get("display_name") or source.get("name")
if not topic_name:
continue
taxonomy_cache[topic_name] = {
"topic_id": source.get("id") or hit.get("_id", ""),
"subfield": source.get("subfield", {}).get("display_name", ""),
"field": source.get("field", {}).get("display_name", ""),
"domain": source.get("domain", {}).get("display_name", "")
}
offset += len(hits)
logger.info("Processed %s topics total", len(taxonomy_cache))
if save_json:
data_json = json.dumps(taxonomy_cache, indent=2, ensure_ascii=True)
try:
output_path = "/data/" + output_filename
with open(output_path, "w", encoding="utf-8") as f:
f.write(data_json)
logger.info("Topic hierarchy cache written to %s", output_path)
except Exception as exc:
logger.warning("Failed to write topic hierarchy cache: %s", exc)
return taxonomy_cache
def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]:
"""
Given a list of topic names, retrieves their hierarchy information from the cache and returns a list of Topic models.
Arguments:
topic_names (List[str]): A list of topic names to retrieve.
Returns:
List[model.Topic]: A list of Topic models.
"""
cache = _load_topic_cache()
topics = []
for name in topic_names:
data = cache.get(name)
if not data:
continue
topics.append(model.Topic(
id=data.get("topic_id", ""),
name=name,
subfield=data.get("subfield", ""),
field=data.get("field", ""),
domain=data.get("domain", "")
))
return topics
def count_topic_hierarchy(topic_names: List[str]) -> dict:
"""
Given a list of topic names, counts the occurrences of each topic and their hierarchy levels (subfield, field, domain) using the cache.
Arguments:
topic_names (List[str]): A list of topic names to count.
Returns:
dict: A dictionary containing the counts of each hierarchy level.
"""
cache = _load_topic_cache()
counts = {
"topics": {},
"subfields": {},
"fields": {},
"domains": {}
}
for name in topic_names:
data = cache.get(name)
if not data:
continue
counts["topics"][name] = counts["topics"].get(name, 0) + 1
subfield = data.get("subfield", "")
if subfield:
counts["subfields"][subfield] = counts["subfields"].get(subfield, 0) + 1
field = data.get("field", "")
if field:
counts["fields"][field] = counts["fields"].get(field, 0) + 1
domain = data.get("domain", "")
if domain:
counts["domains"][domain] = counts["domains"].get(domain, 0) + 1
return counts
### persons
def search_persons(author_id: Optional[str] = None, query: Optional[str] = None,
include: Optional[set[str]] = None) -> model.PersonSearchResult:
headers = {
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
"Content-Type": "application/json"
@@ -84,10 +224,11 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None)
}
with httpx.Client() as client:
response = client.post(config.settings.elasticsearch_url, json=payload, headers=headers)
response = client.post(config.settings.elasticsearch_url + '/openalex-authors/_search', json=payload, headers=headers)
response.raise_for_status()
data = response.json()
include_set = {tag.strip().lower() for tag in include} if include else set()
persons = []
for hit in data.get("hits", {}).get("hits", []):
source = hit.get("_source", {})
@@ -102,14 +243,41 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None)
topics = [t.get("display_name", "") for t in source.get("topics", [])]
persons.append(model.Person(
id=hit.get("_id", ""),
name=source.get("display_name", ""),
works_count=source.get("works_count", 0),
cited_by_count=source.get("cited_by_count", 0),
affiliations=affiliations,
topics=topics
))
person_data = {
"id": hit.get("_id", ""),
"name": source.get("display_name", ""),
"works_count": source.get("works_count", 0),
"cited_by_count": source.get("cited_by_count", 0),
"affiliations": affiliations,
"topics": topics
}
# Include optional fields based on the include_set
if "topics_full" in include_set:
person_data["topics_full"] = source.get("topics", [])
if "topic_share" in include_set:
person_data["topic_share"] = source.get("topic_share", [])
if "summary_stats" in include_set:
person_data["summary_stats"] = source.get("summary_stats")
if "ids" in include_set:
person_data["ids"] = source.get("ids")
if "last_known_institutions" in include_set:
person_data["last_known_institutions"] = source.get("last_known_institutions", [])
if "sources" in include_set:
person_data["sources"] = source.get("sources", [])
if "counts_by_year" in include_set:
person_data["counts_by_year"] = source.get("counts_by_year", [])
if "works_api_url" in include_set:
person_data["works_api_url"] = source.get("works_api_url")
if "dates" in include_set:
person_data["dates"] = {
"created_date": source.get("created_date"),
"updated_date": source.get("updated_date")
}
if "cited_by_count_boost" in include_set:
person_data["cited_by_count_boost"] = source.get("cited_by_count_boost")
persons.append(model.Person(**person_data))
return model.PersonSearchResult(persons=persons)
@@ -141,3 +309,5 @@ def generate_person_bio(author_id: str) -> str:
response.raise_for_status()
data = response.json()
return data.get("response", "")
+20
View File
@@ -36,6 +36,13 @@ class Page(BaseModel, Generic[T]):
class ItemPage(Page[Item]):
pass
class Topic(BaseModel):
id: str = Field(description="The openalex topic id.")
name: str = Field(description="The topic name.")
subfield: str = Field(description="The subfield of the topic.")
field: str = Field(description="The field of the topic.")
domain: str = Field(description="The domain of the topic.")
class PersonBio(BaseModel):
bio: str = Field(description="The generated biography.")
@@ -50,6 +57,19 @@ class Person(BaseModel):
cited_by_count: int = Field(description="Number of citations.")
affiliations: List[Affiliation] = Field(default=[], description="Affiliations.")
topics: List[str] = Field(default=[], description="Research topics.")
# Optional detailed information
topics_full: Optional[List[dict]] = Field(default=None, description="Detailed topics with hierarchy.")
topic_share: Optional[List[dict]] = Field(default=None, description="Topic share distribution.")
summary_stats: Optional[dict] = Field(default=None, description="Summary statistics.")
ids: Optional[dict] = Field(default=None, description="External identifiers.")
last_known_institutions: Optional[List[dict]] = Field(default=None, description="Last known institutions.")
sources: Optional[List[dict]] = Field(default=None, description="Sources list.")
counts_by_year: Optional[List[dict]] = Field(default=None, description="Counts by year.")
works_api_url: Optional[str] = Field(default=None, description="Works API URL.")
dates: Optional[dict] = Field(default=None, description="Created and updated dates.")
cited_by_count_boost: Optional[int] = Field(default=None, description="Cited by count boost.")
class PersonSearchResult(BaseModel):
persons: List[Person] = Field(default=[], description="List of found persons.")
+52 -3
View File
@@ -5,7 +5,7 @@
service.
"""
import logging
from typing import Annotated
from typing import Annotated, List, Optional
from fastapi import FastAPI
from fastapi import Depends
from fastapi import Path
@@ -22,6 +22,7 @@ from . import schema
from . import database
from . import security
from . import util
from .works import service as works_service
logger = logging.getLogger(__name__)
@@ -32,6 +33,7 @@ app = FastAPI(redoc_url=None,
title='My App Service',
summary='My App Service API',
version='1.0.0')
app.include_router(works_service.router)
@app.get("/", include_in_schema=False)
async def show_api():
@@ -112,15 +114,62 @@ def delete_item(id: Annotated[int, Path(description='The item id.', ge=0)],
return Response(status_code=HTTP_200_OK)
finally:
db.commit()
### topics
# hierarchy cache (temporaray => should be called by a scheduled job, with new openalex data indexing)
@app.get('/topics/cache',
operation_id='buildTopicCache',
response_model=dict,
summary='Builds the topic hierarchy cache.',
tags=[ 'Topics' ])
def build_topic_cache(page_size: Annotated[int, Query(description='Page size for each search page.', ge=1, le=1000)] = 200,
save_json: Annotated[bool, Query(description='Persist cache JSON to data folder.')] = True):
return logic.build_topic_cache(page_size=page_size, save_json=save_json)
@app.get('/topics/count',
operation_id='countTopicHierarchy',
response_model=dict,
summary='Counts topic hierarchy occurrences from cache.',
tags=['Topics'])
def count_topic_hierarchy(
topic_names: Annotated[
List[str],
Query(
alias='topic',
description='Topic names (repeat parameter).',
example=[
"Big Data and Business Intelligence",
"Big Data and Business Intelligence",
"Topic Modeling",
"Entrepreneurship Studies and Influences",
"Complex Network Analysis Techniques",
"Semantic Web and Ontologies"
]
)
]
):
return logic.count_topic_hierarchy(topic_names)
### persons
@app.get('/persons/search',
operation_id='searchPersons',
response_model=model.PersonSearchResult,
summary='Searches for persons by ID or name.',
response_model_exclude_none=True,
tags=[ 'Persons' ])
def search_persons(author_id: Annotated[str, Query(description="OpenAlex author ID (e.g., A5093075883)")] = None,
query: Annotated[str, Query(description="Search query (e.g., Arman AND Arzani)")] = None):
return logic.search_persons(author_id, query)
query: Annotated[str, Query(description="Search query (e.g., Arman AND Arzani)")] = None,
include: Annotated[Optional[str], Query(
description=(
"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"
),
example="topics_full,topic_share"
)] = None):
include_set = {tag.strip().lower() for tag in include.split(",") if tag.strip()} if include else None
return logic.search_persons(author_id, query, include_set)
@app.get('/persons/bio',
operation_id='generatePersonBio',
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Works domain package.
"""
+160
View File
@@ -0,0 +1,160 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Business logic for publication works.
"""
import logging
import httpx
from fastapi import HTTPException
from pydantic import ValidationError
from starlette.status import HTTP_502_BAD_GATEWAY
from starlette.status import HTTP_503_SERVICE_UNAVAILABLE
from . import model
from .search_client import MissingApiKeyError
from .search_client import OpenAlexWorksSearchClient
logger = logging.getLogger(__name__)
async def get_author_works(
author_id: str,
page: int,
size: int,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
client: OpenAlexWorksSearchClient | None = None,
) -> model.WorkPage:
search_client = client or OpenAlexWorksSearchClient()
data = await _search_author_works_data(
search_client,
author_id,
page,
size,
publication_year=publication_year,
work_type=work_type,
language=language,
)
elements, total = _parse_work_search_response(data)
return model.WorkPage(elements=elements, page=page, size=size, total=total)
async def get_all_author_works(
author_id: str,
client: OpenAlexWorksSearchClient | None = None,
) -> model.WorkList:
search_client = client or OpenAlexWorksSearchClient()
page = 1
size = 100
all_elements: list[model.Work] = []
total = 0
while True:
data = await _search_author_works_data(
search_client,
author_id,
page,
size,
)
elements, total = _parse_full_work_search_response(data)
all_elements.extend(elements)
if not elements or len(all_elements) >= total:
break
page += 1
return model.WorkList(elements=all_elements, total=total)
async def _search_author_works_data(
search_client: OpenAlexWorksSearchClient,
author_id: str,
page: int,
size: int,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
) -> dict:
try:
return await search_client.search_author_works(
author_id,
page,
size,
publication_year=publication_year,
work_type=work_type,
language=language,
)
except MissingApiKeyError as exc:
logger.error("OpenAlex works Elasticsearch API key is not configured.")
raise HTTPException(
status_code=HTTP_503_SERVICE_UNAVAILABLE,
detail="OpenAlex works search is not configured.",
) from exc
except httpx.HTTPError as exc:
logger.exception("OpenAlex works search request failed.")
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex works search request failed.",
) from exc
def _parse_work_search_response(data: dict) -> tuple[list[model.WorkSummary], int]:
hits = data.get("hits", {})
total = hits.get("total", 0)
if isinstance(total, dict):
total = total.get("value", 0)
try:
elements = [
model.WorkSummary.model_validate(_to_work_summary(hit.get("_source", {})))
for hit in hits.get("hits", [])
]
except ValidationError as exc:
logger.exception("OpenAlex works search response could not be parsed.")
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex works search response could not be parsed.",
) from exc
return elements, total
def _parse_full_work_search_response(data: dict) -> tuple[list[model.Work], int]:
hits = data.get("hits", {})
total = hits.get("total", 0)
if isinstance(total, dict):
total = total.get("value", 0)
try:
elements = [
model.Work.model_validate(hit.get("_source", {}))
for hit in hits.get("hits", [])
]
except ValidationError as exc:
logger.exception("OpenAlex works search response could not be parsed.")
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex works search response could not be parsed.",
) from exc
return elements, total
def _to_work_summary(source: dict) -> dict:
return {
"doi": source.get("doi"),
"title": source.get("title") or source.get("display_name"),
"type": source.get("type"),
"language": source.get("language"),
"publication_year": source.get("publication_year"),
"cited_by_count": source.get("cited_by_count") or 0,
"topics": [
topic["display_name"]
for topic in source.get("topics") or []
if topic.get("display_name")
],
}
+218
View File
@@ -0,0 +1,218 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pydantic models for publication works.
"""
from typing import List
from typing import Optional
from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field
class OpenAlexModel(BaseModel):
model_config = ConfigDict(extra="allow")
class Source(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The source id.")
display_name: Optional[str] = Field(default=None, description="The source display name.")
issn_l: Optional[str] = Field(default=None, description="The linking ISSN.")
issn: Optional[List[str]] = Field(default=None, description="The ISSNs of the source.")
is_oa: Optional[bool] = Field(default=None, description="Whether the source is open access.")
is_in_doaj: Optional[bool] = Field(default=None, description="Whether the source is in DOAJ.")
is_core: Optional[bool] = Field(default=None, description="Whether the source is a core source.")
host_organization: Optional[str] = Field(default=None, description="The host organization id.")
host_organization_name: Optional[str] = Field(default=None, description="The host organization name.")
host_organization_lineage: Optional[List[str]] = Field(default=None, description="The host organization lineage.")
type: Optional[str] = Field(default=None, description="The source type.")
class Location(OpenAlexModel):
is_oa: Optional[bool] = Field(default=None, description="Whether this location is open access.")
landing_page_url: Optional[str] = Field(default=None, description="The landing page URL.")
pdf_url: Optional[str] = Field(default=None, description="The PDF URL.")
source: Optional[Source] = Field(default=None, description="The publication source.")
license: Optional[str] = Field(default=None, description="The license label.")
license_id: Optional[str] = Field(default=None, description="The license id.")
is_accepted: Optional[bool] = Field(default=None, description="Whether this manuscript is accepted.")
is_published: Optional[bool] = Field(default=None, description="Whether this manuscript is published.")
class OpenAccess(OpenAlexModel):
is_oa: Optional[bool] = Field(default=None, description="Whether the work is open access.")
oa_url: Optional[str] = Field(default=None, description="The open access URL.")
any_repository_has_fulltext: Optional[bool] = Field(default=None, description="Whether a repository has full text.")
class Author(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The author id.")
display_name: Optional[str] = Field(default=None, description="The display name of the author.")
orcid: Optional[str] = Field(default=None, description="The optional ORCID of the author.")
class Institution(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The institution id.")
display_name: Optional[str] = Field(default=None, description="The institution display name.")
ror: Optional[str] = Field(default=None, description="The ROR id.")
country_code: Optional[str] = Field(default=None, description="The country code.")
type: Optional[str] = Field(default=None, description="The institution type.")
lineage: Optional[List[str]] = Field(default=None, description="The institution lineage.")
class Authorship(OpenAlexModel):
author: Optional[Author] = Field(default=None, description="The author.")
institutions: List[Institution] = Field(default_factory=list, description="The author's institutions.")
countries: List[str] = Field(default_factory=list, description="The author's countries.")
is_corresponding: Optional[bool] = Field(default=None, description="Whether this author is corresponding.")
raw_author_name: Optional[str] = Field(default=None, description="The raw author name.")
raw_affiliation_strings: List[str] = Field(default_factory=list, description="The raw affiliation strings.")
class WorkIds(OpenAlexModel):
openalex: Optional[str] = Field(default=None, description="The OpenAlex id.")
doi: Optional[str] = Field(default=None, description="The DOI.")
mag: Optional[int] = Field(default=None, description="The MAG id.")
pmid: Optional[str] = Field(default=None, description="The PubMed id.")
pmcid: Optional[str] = Field(default=None, description="The PubMed Central id.")
class Biblio(OpenAlexModel):
volume: Optional[str] = Field(default=None, description="The volume.")
issue: Optional[str] = Field(default=None, description="The issue.")
first_page: Optional[str] = Field(default=None, description="The first page.")
last_page: Optional[str] = Field(default=None, description="The last page.")
class TopicLevel(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The topic level id.")
display_name: Optional[str] = Field(default=None, description="The topic level display name.")
class Topic(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The topic id.")
display_name: Optional[str] = Field(default=None, description="The topic display name.")
score: Optional[float] = Field(default=None, description="The topic score.")
subfield: Optional[TopicLevel] = Field(default=None, description="The topic subfield.")
field: Optional[TopicLevel] = Field(default=None, description="The topic field.")
domain: Optional[TopicLevel] = Field(default=None, description="The topic domain.")
class Keyword(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The keyword id.")
display_name: Optional[str] = Field(default=None, description="The keyword display name.")
score: Optional[float] = Field(default=None, description="The keyword score.")
class Funder(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The funder id.")
display_name: Optional[str] = Field(default=None, description="The funder display name.")
ror: Optional[str] = Field(default=None, description="The ROR id.")
class Award(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The award id.")
display_name: Optional[str] = Field(default=None, description="The award display name.")
funder_award_id: Optional[str] = Field(default=None, description="The funder award id.")
funder_id: Optional[str] = Field(default=None, description="The funder id.")
funder_display_name: Optional[str] = Field(default=None, description="The funder display name.")
doi: Optional[str] = Field(default=None, description="The award DOI.")
class CitationNormalizedPercentile(OpenAlexModel):
value: Optional[float] = Field(default=None, description="The normalized citation percentile.")
is_in_top_1_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 1 percent.")
is_in_top_10_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 10 percent.")
class CitedByPercentileYear(OpenAlexModel):
min: Optional[int] = Field(default=None, description="The minimum percentile year.")
max: Optional[int] = Field(default=None, description="The maximum percentile year.")
class CountByYear(OpenAlexModel):
year: Optional[int] = Field(default=None, description="The year.")
cited_by_count: int = Field(default=0, description="The citation count for the year.")
class SustainableDevelopmentGoal(OpenAlexModel):
id: Optional[str] = Field(default=None, description="The sustainable development goal id.")
display_name: Optional[str] = Field(default=None, description="The sustainable development goal display name.")
score: Optional[float] = Field(default=None, description="The sustainable development goal score.")
class Mesh(OpenAlexModel):
descriptor_ui: Optional[str] = Field(default=None, description="The descriptor UI.")
descriptor_name: Optional[str] = Field(default=None, description="The descriptor name.")
qualifier_ui: Optional[str] = Field(default=None, description="The qualifier UI.")
qualifier_name: Optional[str] = Field(default=None, description="The qualifier name.")
is_major_topic: Optional[bool] = Field(default=None, description="Whether this is a major topic.")
class HasContent(OpenAlexModel):
pdf: Optional[bool] = Field(default=None, description="Whether PDF content exists.")
grobid_xml: Optional[bool] = Field(default=None, description="Whether GROBID XML content exists.")
class Work(OpenAlexModel):
id: str = Field(description="The external id of the work.")
doi: Optional[str] = Field(default=None, description="The optional DOI of the work.")
title: Optional[str] = Field(default=None, description="The title of the work.")
display_name: Optional[str] = Field(default=None, description="The display name of the work.")
publication_year: Optional[int] = Field(default=None, description="The publication year.")
publication_date: Optional[str] = Field(default=None, description="The publication date.")
type: Optional[str] = Field(default=None, description="The work type.")
language: Optional[str] = Field(default=None, description="The work language.")
cited_by_count: int = Field(default=0, description="The number of citations.")
is_retracted: Optional[bool] = Field(default=None, description="Whether the work is retracted.")
is_paratext: Optional[bool] = Field(default=None, description="Whether the work is paratext.")
primary_location: Optional[Location] = Field(default=None, description="The primary location.")
locations: List[Location] = Field(default_factory=list, description="The work locations.")
best_oa_location: Optional[Location] = Field(default=None, description="The best open access location.")
open_access: Optional[OpenAccess] = Field(default=None, description="Open access information.")
authorships: List[Authorship] = Field(default_factory=list, description="The authorships.")
ids: Optional[WorkIds] = Field(default=None, description="External ids.")
biblio: Optional[Biblio] = Field(default=None, description="Bibliographic information.")
abstract_inverted_index: dict[str, List[int]] = Field(default_factory=dict, description="The inverted abstract index.")
referenced_works: List[str] = Field(default_factory=list, description="Referenced work ids.")
referenced_works_count: int = Field(default=0, description="The number of referenced works.")
related_works: List[str] = Field(default_factory=list, description="Related work ids.")
topics: List[Topic] = Field(default_factory=list, description="The topics.")
primary_topic: Optional[Topic] = Field(default=None, description="The primary topic.")
keywords: List[Keyword] = Field(default_factory=list, description="The keywords.")
funders: List[Funder] = Field(default_factory=list, description="The funders.")
awards: List[Award] = Field(default_factory=list, description="The awards.")
fwci: Optional[float] = Field(default=None, description="The field weighted citation impact.")
citation_normalized_percentile: Optional[CitationNormalizedPercentile] = Field(default=None, description="The normalized citation percentile.")
cited_by_percentile_year: Optional[CitedByPercentileYear] = Field(default=None, description="The cited by percentile year.")
counts_by_year: List[CountByYear] = Field(default_factory=list, description="Citation counts by year.")
sustainable_development_goals: List[SustainableDevelopmentGoal] = Field(default_factory=list, description="Sustainable development goals.")
mesh: List[Mesh] = Field(default_factory=list, description="MeSH terms.")
indexed_in: List[str] = Field(default_factory=list, description="Indexes containing the work.")
has_content: Optional[HasContent] = Field(default=None, description="Available content flags.")
content_url: Optional[str] = Field(default=None, description="The content URL.")
created_date: Optional[str] = Field(default=None, description="The creation date.")
updated_date: Optional[str] = Field(default=None, description="The last update timestamp.")
class WorkSummary(BaseModel):
doi: Optional[str] = Field(default=None, description="The optional DOI of the work.")
title: Optional[str] = Field(default=None, description="The title of the work.")
type: Optional[str] = Field(default=None, description="The work type.")
language: Optional[str] = Field(default=None, description="The work language.")
publication_year: Optional[int] = Field(default=None, description="The publication year.")
cited_by_count: int = Field(default=0, description="The number of citations.")
topics: List[str] = Field(default_factory=list, description="The display names of the work topics.")
class WorkPage(BaseModel):
elements: List[WorkSummary] = Field(default_factory=list, description="The works on this page.")
page: int = Field(default=1, description="The current page number.")
size: int = Field(default=20, description="The requested page size.")
total: int = Field(default=0, description="The total number of works.")
class WorkList(BaseModel):
elements: List[Work] = Field(default_factory=list, description="All works.")
total: int = Field(default=0, description="The total number of works.")
@@ -0,0 +1,114 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP client for the OpenAlex works Elasticsearch index.
"""
from typing import Any
import httpx
from .. import config
class MissingApiKeyError(Exception):
pass
class OpenAlexWorksSearchClient:
def __init__(
self,
base_url: str | None = None,
index: str | None = None,
api_key: str | None = None,
timeout: float | None = None,
transport: httpx.AsyncBaseTransport | None = None,
):
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
self.index = index or config.settings.openalex_works_search_index
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
self.transport = transport
def author_works_query(
self,
author_id: str,
page: int,
size: int,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
) -> dict[str, Any]:
indexed_author_id = f"https://openalex.org/{author_id.strip()}"
filters = self._work_filters(publication_year, work_type, language)
return {
"from": (page - 1) * size,
"size": size,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "authorships",
"query": {
"term": {
"authorships.author.id": indexed_author_id,
},
},
},
},
],
"filter": filters,
},
},
"sort": [
{"publication_year": {"order": "desc", "missing": "_last"}},
{"cited_by_count": {"order": "desc", "missing": "_last"}},
],
}
def _work_filters(
self,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
) -> list[dict[str, Any]]:
filters: list[dict[str, Any]] = []
if publication_year:
filters.append({"terms": {"publication_year": publication_year}})
if work_type:
filters.append({"terms": {"type": work_type}})
if language:
filters.append({"terms": {"language": language}})
return filters
async def search_author_works(
self,
author_id: str,
page: int,
size: int,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
) -> dict[str, Any]:
if not self.api_key:
raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.")
async with httpx.AsyncClient(
base_url=self.base_url,
timeout=self.timeout,
transport=self.transport,
) as client:
response = await client.post(
f"/{self.index}/_search",
headers={"Authorization": f"ApiKey {self.api_key}"},
json=self.author_works_query(
author_id,
page,
size,
publication_year=publication_year,
work_type=work_type,
language=language,
),
)
response.raise_for_status()
return response.json()
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
REST API for publication works.
"""
from typing import Annotated
from fastapi import APIRouter
from fastapi import Depends
from fastapi import Path
from fastapi import Query
from .. import security
from . import logic
from . import model
router = APIRouter(prefix="/authors", tags=["Works"])
@router.get("/{author_id}/works",
operation_id="getAuthorWorks",
response_model=model.WorkPage,
summary="Returns a page of works for an author.")
async def get_author_works(
author_id: Annotated[str, Path(description="The author id, for example A5023888391.")],
page: Annotated[int, Query(description="The page number.", ge=1)] = 1,
size: Annotated[int, Query(description="The page size.", ge=1, le=100)] = 20,
publication_year: Annotated[list[int] | None, Query(description="Filter by publication year. Can be repeated.")] = None,
work_type: Annotated[list[str] | None, Query(alias="type", description="Filter by publication type. Can be repeated.")] = None,
language: Annotated[list[str] | None, Query(description="Filter by language code. Can be repeated.")] = None,
principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])),
):
return await logic.get_author_works(
author_id,
page,
size,
publication_year=publication_year,
work_type=work_type,
language=language,
)
@router.get("/{author_id}/works/all",
operation_id="getAllAuthorWorks",
response_model=model.WorkList,
summary="Returns all works for an author.")
async def get_all_author_works(
author_id: Annotated[str, Path(description="The author id, for example A5023888391.")],
principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])),
):
return await logic.get_all_author_works(author_id)
@@ -0,0 +1,176 @@
import json
import httpx
import pytest
from fastapi import HTTPException
from inse.works import logic
from inse.works.search_client import OpenAlexWorksSearchClient
@pytest.fixture
def anyio_backend():
return "asyncio"
@pytest.mark.anyio
async def test_get_author_works_maps_elasticsearch_response_to_work_page():
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(
200,
json={
"hits": {
"total": {"value": 1},
"hits": [
{
"_source": {
"id": "https://openalex.org/W2741809807",
"doi": "https://doi.org/10.7717/peerj.4375",
"display_name": "Example work",
"type": "article",
"language": "en",
"publication_year": 2023,
"cited_by_count": 42,
"topics": [
{
"id": "https://openalex.org/T10102",
"display_name": "Machine learning",
"score": 0.91,
}
],
"primary_location": {
"source": {
"id": "https://openalex.org/S123",
"display_name": "Example Source",
"issn": None,
}
},
"authorships": [
{
"author": {
"id": "https://openalex.org/A5023888391",
"display_name": "Example Author",
}
}
],
}
}
],
},
},
)
client = OpenAlexWorksSearchClient(
base_url="https://project.nes.uni-due.de/elastic",
api_key="test-key",
transport=httpx.MockTransport(handler),
)
page = await logic.get_author_works("A5023888391", page=1, size=20, client=client)
assert page.total == 1
assert page.elements[0].doi == "https://doi.org/10.7717/peerj.4375"
assert page.elements[0].title == "Example work"
assert page.elements[0].type == "article"
assert page.elements[0].language == "en"
assert page.elements[0].publication_year == 2023
assert page.elements[0].cited_by_count == 42
assert page.elements[0].topics == ["Machine learning"]
@pytest.mark.anyio
async def test_get_all_author_works_collects_all_pages():
requested_pages = []
def handler(request: httpx.Request) -> httpx.Response:
payload = json_from_request(request)
requested_pages.append(payload["from"] // payload["size"] + 1)
page = requested_pages[-1]
hits = [
{
"_source": {
"id": f"https://openalex.org/W{page}",
"doi": f"https://doi.org/10.1234/example-{page}",
"title": f"Example work {page}",
"display_name": f"Example work {page}",
"type": "article",
"language": "en",
"publication_year": 2024,
"publication_date": "2024-01-01",
"cited_by_count": page,
"primary_location": {
"is_oa": True,
"source": {
"id": "https://openalex.org/S123",
"display_name": "Example Source",
},
},
"authorships": [
{
"author": {
"id": "https://openalex.org/A5023888391",
"display_name": "Example Author",
},
},
],
"topics": [],
}
}
]
return httpx.Response(
200,
json={
"hits": {
"total": {"value": 2},
"hits": hits,
},
},
)
client = OpenAlexWorksSearchClient(
base_url="https://project.nes.uni-due.de/elastic",
api_key="test-key",
transport=httpx.MockTransport(handler),
)
works = await logic.get_all_author_works("A5023888391", client=client)
assert requested_pages == [1, 2]
assert works.total == 2
assert [work.title for work in works.elements] == ["Example work 1", "Example work 2"]
assert works.elements[0].id == "https://openalex.org/W1"
assert works.elements[0].display_name == "Example work 1"
assert works.elements[0].publication_date == "2024-01-01"
assert works.elements[0].primary_location.is_oa is True
assert works.elements[0].authorships[0].author.id == "https://openalex.org/A5023888391"
@pytest.mark.anyio
async def test_get_author_works_maps_missing_api_key_to_service_unavailable():
client = OpenAlexWorksSearchClient(api_key="")
with pytest.raises(HTTPException) as exc:
await logic.get_author_works("A5023888391", page=1, size=20, client=client)
assert exc.value.status_code == 503
@pytest.mark.anyio
async def test_get_author_works_maps_elasticsearch_errors_to_bad_gateway():
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(500, json={"error": "upstream failed"})
client = OpenAlexWorksSearchClient(
base_url="https://project.nes.uni-due.de/elastic",
api_key="test-key",
transport=httpx.MockTransport(handler),
)
with pytest.raises(HTTPException) as exc:
await logic.get_author_works("A5023888391", page=1, size=20, client=client)
assert exc.value.status_code == 502
def json_from_request(request: httpx.Request) -> dict:
return json.loads(request.content.decode("utf-8"))
@@ -0,0 +1,70 @@
import httpx
import pytest
from inse.works.search_client import MissingApiKeyError
from inse.works.search_client import OpenAlexWorksSearchClient
@pytest.fixture
def anyio_backend():
return "asyncio"
def test_author_works_query_searches_authorship_author_id():
client = OpenAlexWorksSearchClient(api_key="test-key")
query = client.author_works_query("A5023888391", page=2, size=25)
assert query["from"] == 25
assert query["size"] == 25
author_query = query["query"]["bool"]["must"][0]["nested"]
assert author_query["path"] == "authorships"
assert author_query["query"]["term"]["authorships.author.id"] == "https://openalex.org/A5023888391"
assert query["query"]["bool"]["filter"] == []
def test_author_works_query_adds_publication_filters():
client = OpenAlexWorksSearchClient(api_key="test-key")
query = client.author_works_query(
"A5023888391",
page=1,
size=20,
publication_year=[2023, 2024],
work_type=["article", "book-chapter"],
language=["en", "de"],
)
assert query["query"]["bool"]["filter"] == [
{"terms": {"publication_year": [2023, 2024]}},
{"terms": {"type": ["article", "book-chapter"]}},
{"terms": {"language": ["en", "de"]}},
]
@pytest.mark.anyio
async def test_search_author_works_calls_elasticsearch_index_with_api_key():
def handler(request: httpx.Request) -> httpx.Response:
assert request.method == "POST"
assert request.url.path == "/elastic/openalex-works/_search"
assert request.headers["Authorization"] == "ApiKey test-key"
return httpx.Response(200, json={"hits": {"total": {"value": 0}, "hits": []}})
client = OpenAlexWorksSearchClient(
base_url="https://project.nes.uni-due.de/elastic",
index="openalex-works",
api_key="test-key",
transport=httpx.MockTransport(handler),
)
result = await client.search_author_works("A5023888391", page=1, size=20)
assert result == {"hits": {"total": {"value": 0}, "hits": []}}
@pytest.mark.anyio
async def test_search_author_works_requires_api_key():
client = OpenAlexWorksSearchClient(api_key="")
with pytest.raises(MissingApiKeyError):
await client.search_author_works("A5023888391", page=1, size=20)
+108
View File
@@ -0,0 +1,108 @@
from fastapi.testclient import TestClient
from inse import config
from inse.works import logic
from inse.works import model
from inse.main import app
client = TestClient(app)
def test_get_author_works_returns_page(monkeypatch):
config.settings.auth_disabled = True
async def fake_get_author_works(
author_id: str,
page: int,
size: int,
publication_year: list[int] | None = None,
work_type: list[str] | None = None,
language: list[str] | None = None,
):
assert author_id == "A5023888391"
assert page == 2
assert size == 5
assert publication_year == [2023, 2024]
assert work_type == ["article"]
assert language == ["en"]
return model.WorkPage(
elements=[
model.WorkSummary(
doi="https://doi.org/10.7717/peerj.4375",
title="Example work",
type="article",
language="en",
publication_year=2023,
cited_by_count=42,
topics=["Machine learning"],
)
],
page=page,
size=size,
total=1,
)
monkeypatch.setattr(logic, "get_author_works", fake_get_author_works)
response = client.get(
"/inse-service/authors/A5023888391/works"
"?page=2&size=5&publication_year=2023&publication_year=2024&type=article&language=en"
)
assert response.status_code == 200
data = response.json()
assert data["page"] == 2
assert data["size"] == 5
assert data["total"] == 1
assert data["elements"][0] == {
"doi": "https://doi.org/10.7717/peerj.4375",
"title": "Example work",
"type": "article",
"language": "en",
"publication_year": 2023,
"cited_by_count": 42,
"topics": ["Machine learning"],
}
def test_get_all_author_works_returns_list(monkeypatch):
config.settings.auth_disabled = True
async def fake_get_all_author_works(
author_id: str,
):
assert author_id == "A5023888391"
return model.WorkList(
elements=[
model.Work(
id="https://openalex.org/W2741809807",
doi="https://doi.org/10.7717/peerj.4375",
title="Example work",
display_name="Example work",
type="article",
language="en",
publication_year=2023,
cited_by_count=42,
topics=[
model.Topic(
id="https://openalex.org/T10102",
display_name="Machine learning",
)
],
)
],
total=1,
)
monkeypatch.setattr(logic, "get_all_author_works", fake_get_all_author_works)
response = client.get("/inse-service/authors/A5023888391/works/all")
assert response.status_code == 200
data = response.json()
assert data["total"] == 1
assert data["elements"][0]["id"] == "https://openalex.org/W2741809807"
assert data["elements"][0]["title"] == "Example work"
assert data["elements"][0]["display_name"] == "Example work"
assert data["elements"][0]["topics"][0]["display_name"] == "Machine learning"
+18
View File
@@ -6,6 +6,24 @@ Angular 18 single-page application with Angular Material.
Run `npm start` for a dev server at `http://localhost:4200/`. The application will automatically reload on file changes.
## OpenAPI Client
Gradle exports the backend OpenAPI schema from the FastAPI app and generates the Angular client from that schema:
```bash
../gradlew :webapp:generateOpenApiClient
```
The generated client is written to `src/app/api`. The schema file is written to `../service/build/openapi/inse-service.openapi.json`.
If the schema was already exported, the npm script can regenerate only the frontend client:
```bash
npm run generate:api
```
Use the generated services for new backend endpoints so request models, response models, and operation names stay aligned with the FastAPI OpenAPI schema.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
+6 -1
View File
@@ -25,6 +25,12 @@ task serve(type: NodeTask) {
args = ['serve', '--configuration', 'development', '--proxy-config', 'src/proxy.conf.json', '--open']
workingDir = projectDir
}
task generateOpenApiClient(type: Exec) {
dependsOn ':service:exportOpenApiSpec'
commandLine 'npm', 'run', 'generate:api'
workingDir = projectDir
}
build {
dependsOn ngBuild
@@ -33,4 +39,3 @@ build {
clean {
dependsOn cleanNgBuild
}
+8
View File
@@ -0,0 +1,8 @@
.gitignore
.npmignore
.openapi-generator-ignore
README.md
git_push.sh
package.json
ng-package.json
tsconfig.json
+22
View File
@@ -0,0 +1,22 @@
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"generator-cli": {
"version": "7.17.0",
"generators": {
"inse-service": {
"generatorName": "typescript-angular",
"inputSpec": "../service/build/openapi/inse-service.openapi.json",
"output": "src/app/api",
"ignoreFileOverride": "openapi-generator-ignore",
"additionalProperties": {
"ngVersion": "21.2.14",
"providedInRoot": true,
"serviceSuffix": "OpenApiService",
"withInterfaces": true,
"enumPropertyNaming": "original",
"fileNaming": "kebab-case"
}
}
}
}
}
+1462
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -5,6 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"generate:api": "openapi-generator-cli generate --generator-key inse-service",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
@@ -30,6 +31,7 @@
"@angular/build": "^21.2.12",
"@angular/cli": "^21.2.12",
"@angular/compiler-cli": "^21.2.14",
"@openapitools/openapi-generator-cli": "^2.34.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
+4
View File
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
@@ -0,0 +1,54 @@
.gitignore
README.md
api.base.service.ts
api.module.ts
api/api.ts
api/items.service.ts
api/items.serviceInterface.ts
api/persons.service.ts
api/persons.serviceInterface.ts
api/topics.service.ts
api/topics.serviceInterface.ts
api/works.service.ts
api/works.serviceInterface.ts
configuration.ts
encoder.ts
git_push.sh
index.ts
model/affiliation.ts
model/author.ts
model/authorship.ts
model/award.ts
model/biblio.ts
model/citation-normalized-percentile.ts
model/cited-by-percentile-year.ts
model/count-by-year.ts
model/funder.ts
model/has-content.ts
model/http-validation-error.ts
model/institution.ts
model/item-create.ts
model/item-page.ts
model/item.ts
model/keyword.ts
model/location.ts
model/mesh.ts
model/models.ts
model/open-access.ts
model/person-bio.ts
model/person-search-result.ts
model/person.ts
model/source.ts
model/sustainable-development-goal.ts
model/topic-level.ts
model/topic.ts
model/validation-error-loc-inner.ts
model/validation-error.ts
model/work-ids.ts
model/work-list.ts
model/work-page.ts
model/work-summary.ts
model/work.ts
param.ts
provide-api.ts
variables.ts
@@ -0,0 +1 @@
7.17.0
+185
View File
@@ -0,0 +1,185 @@
# @
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.0.0
## Building
To install the required dependencies and to build the typescript sources run:
```console
npm install
npm run build
```
## Publishing
First build the package then run `npm publish dist` (don't forget to specify the `dist` folder!)
## Consuming
Navigate to the folder of your consuming project and run one of next commands.
_published:_
```console
npm install @ --save
```
_without publishing (not recommended):_
```console
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
```
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE/dist:
```console
npm link
```
In your project:
```console
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
Published packages are not effected by this issue.
### General usage
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()
],
};
```
**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 '';
```
If different from the generated base path, during app bootstrap, you can provide the base path to your service.
```typescript
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideApi('http://localhost:9999')
],
};
```
```typescript
// with a custom configuration
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideApi({
withCredentials: true,
username: 'user',
password: 'password'
})
],
};
```
```typescript
// with factory building a custom configuration
import { ApplicationConfig } from '@angular/core';
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
}
],
};
```
### Using multiple OpenAPI files / APIs
In order to use multiple APIs generated from different OpenAPI files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```typescript
import { provideApi as provideUserApi } from 'my-user-api-path';
import { provideApi as provideAdminApi } from 'my-admin-api-path';
import { HttpClientModule } from '@angular/common/http';
import { environment } from '../environments/environment';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideHttpClient(),
provideUserApi(environment.basePath),
provideAdminApi(environment.basePath),
],
};
```
### Customizing path parameter encoding
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
and Dates for format 'date-time' are encoded correctly.
Other styles (e.g. "matrix") are not that easy to encode
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
To implement your own parameter encoding (or call another library),
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
(see [General Usage](#general-usage) above).
Example value for use in your Configuration-Provider:
```typescript
new Configuration({
encodeParam: (param: Param) => myFancyParamEncoder(param),
})
```
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
+83
View File
@@ -0,0 +1,83 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
import { CustomHttpParameterCodec } from './encoder';
import { Configuration } from './configuration';
export class BaseService {
protected basePath = 'http://localhost';
public defaultHeaders = new HttpHeaders();
public configuration: Configuration;
public encoder: HttpParameterCodec;
constructor(basePath?: string|string[], configuration?: Configuration) {
this.configuration = configuration || new Configuration();
if (typeof this.configuration.basePath !== 'string') {
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
if (firstBasePath != undefined) {
basePath = firstBasePath;
}
if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}
protected canConsumeForm(consumes: string[]): boolean {
return consumes.indexOf('multipart/form-data') !== -1;
}
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep: boolean = false): HttpParams {
// If the value is an object (but not a Date), recursively add its keys.
if (typeof value === 'object' && !(value instanceof Date)) {
return this.addToHttpParamsRecursive(httpParams, value, isDeep ? key : undefined, isDeep);
}
return this.addToHttpParamsRecursive(httpParams, value, key);
}
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep: boolean = false): HttpParams {
if (value === null || value === undefined) {
return httpParams;
}
if (typeof value === 'object') {
// If JSON format is preferred, key must be provided.
if (key != null) {
return isDeep
? Object.keys(value as Record<string, any>).reduce(
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
httpParams,
)
: httpParams.append(key, JSON.stringify(value));
}
// Otherwise, if it's an array, add each element.
if (Array.isArray(value)) {
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key, value.toISOString());
} else {
throw Error("key may not be null if value is Date");
}
} else {
Object.keys(value).forEach(k => {
const paramKey = key ? `${key}.${k}` : k;
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
});
}
return httpParams;
} else if (key != null) {
return httpParams.append(key, value);
}
throw Error("key may not be null if value is not object or array");
}
}
+30
View File
@@ -0,0 +1,30 @@
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: []
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}
+13
View File
@@ -0,0 +1,13 @@
export * from './items.service';
import { ItemsOpenApiService } from './items.service';
export * from './items.serviceInterface';
export * from './persons.service';
import { PersonsOpenApiService } from './persons.service';
export * from './persons.serviceInterface';
export * from './topics.service';
import { TopicsOpenApiService } from './topics.service';
export * from './topics.serviceInterface';
export * from './works.service';
import { WorksOpenApiService } from './works.service';
export * from './works.serviceInterface';
export const APIS = [ItemsOpenApiService, PersonsOpenApiService, TopicsOpenApiService, WorksOpenApiService];
+366
View File
@@ -0,0 +1,366 @@
/**
* My App Service
*
*
*
* 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 { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { Item } from '../model/item';
// @ts-ignore
import { ItemCreate } from '../model/item-create';
// @ts-ignore
import { ItemPage } from '../model/item-page';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
ItemsOpenApiServiceInterface
} from './items.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class ItemsOpenApiService extends BaseService implements ItemsOpenApiServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Adds a new item.
* @endpoint post /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<Item>;
public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (itemCreate === null || itemCreate === undefined) {
throw new Error('Required parameter itemCreate was null or undefined when calling addItem.');
}
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 = `/items`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<Item>('post', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: itemCreate,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Deletes the item with the id.
* @endpoint delete /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<any>;
public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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 = `/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<any>('delete', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns the item with the id.
* @endpoint get /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<Item>;
public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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 = `/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<Item>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns a page of items.
* @endpoint get /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<ItemPage>;
public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ItemPage>>;
public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ItemPage>>;
public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>pageOffset, 'pageOffset');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>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 = `/items`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<ItemPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Updates the item with the id.
* @endpoint put /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<Item>;
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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 = `/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<Item>('put', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: itemCreate,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,70 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { Item } from '../model/models';
import { ItemCreate } from '../model/models';
import { ItemPage } from '../model/models';
import { Configuration } from '../configuration';
export interface ItemsOpenApiServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Adds a new item.
*
* @endpoint post /items
* @param itemCreate
*/
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
/**
* Deletes the item with the id.
*
* @endpoint delete /items/{id}
* @param id The item id.
*/
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
/**
* Returns the item with the id.
*
* @endpoint get /items/{id}
* @param id The item id.
*/
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
/**
* Returns a page of items.
*
* @endpoint get /items
* @param pageOffset The page offset.
* @param pageSize The page size.
*/
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
/**
* Updates the item with the id.
*
* @endpoint put /items/{id}
* @param id The item id.
* @param itemCreate
*/
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
}
+168
View File
@@ -0,0 +1,168 @@
/**
* My App Service
*
*
*
* 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 { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { PersonBio } from '../model/person-bio';
// @ts-ignore
import { PersonSearchResult } from '../model/person-search-result';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
PersonsOpenApiServiceInterface
} from './persons.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class PersonsOpenApiService extends BaseService implements PersonsOpenApiServiceInterface {
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 /persons/bio
* @param authorId OpenAlex author ID (e.g., A5093075883)
* @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, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonBio>;
public generatePersonBio(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBio>>;
public generatePersonBio(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBio>>;
public generatePersonBio(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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,
<any>authorId, 'author_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 = `/persons/bio`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PersonBio>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Searches for persons by ID or name.
* @endpoint get /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<PersonSearchResult>;
public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonSearchResult>>;
public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonSearchResult>>;
public searchPersons(authorId?: string, query?: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>authorId, 'author_id');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>query, 'query');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>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 = `/persons/search`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PersonSearchResult>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,45 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { PersonBio } from '../model/models';
import { PersonSearchResult } from '../model/models';
import { Configuration } from '../configuration';
export interface PersonsOpenApiServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Generates a bio for a person by author ID.
*
* @endpoint get /persons/bio
* @param authorId OpenAlex author ID (e.g., A5093075883)
*/
generatePersonBio(authorId: string, extraHttpRequestParams?: any): Observable<PersonBio>;
/**
* Searches for persons by ID or name.
*
* @endpoint get /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
*/
searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable<PersonSearchResult>;
}
+165
View File
@@ -0,0 +1,165 @@
/**
* My App Service
*
*
*
* 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 { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
TopicsOpenApiServiceInterface
} from './topics.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class TopicsOpenApiService extends BaseService implements TopicsOpenApiServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Builds the topic hierarchy cache.
* @endpoint get /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<object>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>pageSize, 'page_size');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>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 = `/topics/cache`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Counts topic hierarchy occurrences from cache.
* @endpoint get /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<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
public countTopicHierarchy(topic: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
public countTopicHierarchy(topic: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
public countTopicHierarchy(topic: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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,
<any>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 = `/topics/count`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,42 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { Configuration } from '../configuration';
export interface TopicsOpenApiServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Builds the topic hierarchy cache.
*
* @endpoint get /topics/cache
* @param pageSize Page size for each search page.
* @param saveJson Persist cache JSON to data folder.
*/
buildTopicCache(pageSize?: number, saveJson?: boolean, extraHttpRequestParams?: any): Observable<object>;
/**
* Counts topic hierarchy occurrences from cache.
*
* @endpoint get /topics/count
* @param topic Topic names (repeat parameter).
*/
countTopicHierarchy(topic: Array<string>, extraHttpRequestParams?: any): Observable<object>;
}
+191
View File
@@ -0,0 +1,191 @@
/**
* My App Service
*
*
*
* 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 { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { WorkList } from '../model/work-list';
// @ts-ignore
import { WorkPage } from '../model/work-page';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
WorksOpenApiServiceInterface
} from './works.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class WorksOpenApiService extends BaseService implements WorksOpenApiServiceInterface {
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 /authors/{author_id}/works/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<WorkList>;
public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkList>>;
public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkList>>;
public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.');
}
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 = `/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/works/all`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<WorkList>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns a page of works for an author.
* @endpoint get /authors/{author_id}/works
* @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 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<number>, type?: Array<string>, language?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPage>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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,
<any>page, 'page');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>size, 'size');
if (publicationYear) {
publicationYear.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'publication_year');
})
}
if (type) {
type.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'type');
})
}
if (language) {
language.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'language');
})
}
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 = `/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/works`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<WorkPage>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,48 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { WorkList } from '../model/models';
import { WorkPage } from '../model/models';
import { Configuration } from '../configuration';
export interface WorksOpenApiServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Returns all works for an author.
*
* @endpoint get /authors/{author_id}/works/all
* @param authorId The author id, for example A5023888391.
*/
getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable<WorkList>;
/**
* Returns a page of works for an author.
*
* @endpoint get /authors/{author_id}/works
* @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.
*/
getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, extraHttpRequestParams?: any): Observable<WorkPage>;
}
+193
View File
@@ -0,0 +1,193 @@
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
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
* <p>
* See {@link README.md} for more details
* </p>
*/
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
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
* <p>
* See {@link README.md} for more details
* </p>
*/
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 ?? {};
// 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 <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length === 0) {
return undefined;
}
const type = contentTypes.find((x: string) => this.isJsonMime(x));
if (type === undefined) {
return contentTypes[0];
}
return type;
}
/**
* 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 <code>undefined</code> 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;
}
/**
* 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 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;
}
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;
return encodeURIComponent(String(value));
}
}
+20
View File
@@ -0,0 +1,20 @@
import { HttpParameterCodec } from '@angular/common/http';
/**
* Custom HttpParameterCodec
* 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);
}
}
+57
View File
@@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
+7
View File
@@ -0,0 +1,7 @@
export * from './api/api';
export * from './model/models';
export * from './variables';
export * from './configuration';
export * from './api.module';
export * from './provide-api';
export * from './param';
+19
View File
@@ -0,0 +1,19 @@
/**
* My App Service
*
*
*
* 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 Affiliation {
/**
* Institution name.
*/
institution: string;
country_code?: string | null;
}
+20
View File
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 Author {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
orcid?: string | null;
}
+34
View File
@@ -0,0 +1,34 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Author } from './author';
import { Institution } from './institution';
export interface Authorship {
[key: string]: any | any;
author?: Author | null;
/**
* The author\'s institutions.
*/
institutions?: Array<Institution>;
/**
* The author\'s countries.
*/
countries?: Array<string>;
is_corresponding?: boolean | null;
raw_author_name?: string | null;
/**
* The raw affiliation strings.
*/
raw_affiliation_strings?: Array<string>;
}
+23
View File
@@ -0,0 +1,23 @@
/**
* My App Service
*
*
*
* 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 Award {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
funder_award_id?: string | null;
funder_id?: string | null;
funder_display_name?: string | null;
doi?: string | null;
}
+21
View File
@@ -0,0 +1,21 @@
/**
* My App Service
*
*
*
* 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 Biblio {
[key: string]: any | any;
volume?: string | null;
issue?: string | null;
first_page?: string | null;
last_page?: string | null;
}
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 CitationNormalizedPercentile {
[key: string]: any | any;
value?: number | null;
is_in_top_1_percent?: boolean | null;
is_in_top_10_percent?: boolean | null;
}
@@ -0,0 +1,19 @@
/**
* My App Service
*
*
*
* 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 CitedByPercentileYear {
[key: string]: any | any;
min?: number | null;
max?: number | null;
}
+22
View File
@@ -0,0 +1,22 @@
/**
* My App Service
*
*
*
* 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 CountByYear {
[key: string]: any | any;
year?: number | null;
/**
* The citation count for the year.
*/
cited_by_count?: number;
}
+20
View File
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 Funder {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
ror?: string | null;
}
+19
View File
@@ -0,0 +1,19 @@
/**
* My App Service
*
*
*
* 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 HasContent {
[key: string]: any | any;
pdf?: boolean | null;
grobid_xml?: boolean | null;
}
@@ -0,0 +1,16 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ValidationError } from './validation-error';
export interface HTTPValidationError {
detail?: Array<ValidationError>;
}
+23
View File
@@ -0,0 +1,23 @@
/**
* My App Service
*
*
*
* 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 Institution {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
ror?: string | null;
country_code?: string | null;
type?: string | null;
lineage?: Array<string> | null;
}
+22
View File
@@ -0,0 +1,22 @@
/**
* My App Service
*
*
*
* 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;
}
+31
View File
@@ -0,0 +1,31 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Item } from './item';
export interface ItemPage {
/**
* The elements of the page.
*/
elements?: Array<Item>;
/**
* The page offset in elements.
*/
offset?: number;
/**
* The total number of elements.
*/
total?: number;
/**
* The page size in elements.
*/
size?: number;
}
+26
View File
@@ -0,0 +1,26 @@
/**
* My App Service
*
*
*
* 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;
}
+20
View File
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 Keyword {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
score?: number | null;
}
+26
View File
@@ -0,0 +1,26 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Source } from './source';
export interface Location {
[key: string]: any | any;
is_oa?: boolean | null;
landing_page_url?: string | null;
pdf_url?: string | null;
source?: Source | null;
license?: string | null;
license_id?: string | null;
is_accepted?: boolean | null;
is_published?: boolean | null;
}
+22
View File
@@ -0,0 +1,22 @@
/**
* My App Service
*
*
*
* 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 Mesh {
[key: string]: any | any;
descriptor_ui?: string | null;
descriptor_name?: string | null;
qualifier_ui?: string | null;
qualifier_name?: string | null;
is_major_topic?: boolean | null;
}
+33
View File
@@ -0,0 +1,33 @@
export * from './affiliation';
export * from './author';
export * from './authorship';
export * from './award';
export * from './biblio';
export * from './citation-normalized-percentile';
export * from './cited-by-percentile-year';
export * from './count-by-year';
export * from './funder';
export * from './http-validation-error';
export * from './has-content';
export * from './institution';
export * from './item';
export * from './item-create';
export * from './item-page';
export * from './keyword';
export * from './location';
export * from './mesh';
export * from './open-access';
export * from './person';
export * from './person-bio';
export * from './person-search-result';
export * from './source';
export * from './sustainable-development-goal';
export * from './topic';
export * from './topic-level';
export * from './validation-error';
export * from './validation-error-loc-inner';
export * from './work';
export * from './work-ids';
export * from './work-list';
export * from './work-page';
export * from './work-summary';
+20
View File
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 OpenAccess {
[key: string]: any | any;
is_oa?: boolean | null;
oa_url?: string | null;
any_repository_has_fulltext?: boolean | null;
}
+18
View File
@@ -0,0 +1,18 @@
/**
* My App Service
*
*
*
* 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;
}
@@ -0,0 +1,19 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Person } from './person';
export interface PersonSearchResult {
/**
* List of found persons.
*/
persons?: Array<Person>;
}
+49
View File
@@ -0,0 +1,49 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Affiliation } from './affiliation';
export interface Person {
/**
* The person id.
*/
id: string;
/**
* The person name.
*/
name: string;
/**
* Number of works.
*/
works_count: number;
/**
* Number of citations.
*/
cited_by_count: number;
/**
* Affiliations.
*/
affiliations?: Array<Affiliation>;
/**
* Research topics.
*/
topics?: Array<string>;
topics_full?: Array<object> | null;
topic_share?: Array<object> | null;
summary_stats?: object | null;
ids?: object | null;
last_known_institutions?: Array<object> | null;
sources?: Array<object> | null;
counts_by_year?: Array<object> | null;
works_api_url?: string | null;
dates?: object | null;
cited_by_count_boost?: number | null;
}
+28
View File
@@ -0,0 +1,28 @@
/**
* My App Service
*
*
*
* 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 Source {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
issn_l?: string | null;
issn?: Array<string> | 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<string> | null;
type?: string | null;
}
@@ -0,0 +1,20 @@
/**
* My App Service
*
*
*
* 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 SustainableDevelopmentGoal {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
score?: number | null;
}
+19
View File
@@ -0,0 +1,19 @@
/**
* My App Service
*
*
*
* 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 TopicLevel {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
}
+24
View File
@@ -0,0 +1,24 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { TopicLevel } from './topic-level';
export interface Topic {
[key: string]: any | any;
id?: string | null;
display_name?: string | null;
score?: number | null;
subfield?: TopicLevel | null;
field?: TopicLevel | null;
domain?: TopicLevel | null;
}
@@ -0,0 +1,14 @@
/**
* My App Service
*
*
*
* 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 {
}
@@ -0,0 +1,18 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ValidationErrorLocInner } from './validation-error-loc-inner';
export interface ValidationError {
loc: Array<ValidationErrorLocInner>;
msg: string;
type: string;
}
+22
View File
@@ -0,0 +1,22 @@
/**
* My App Service
*
*
*
* 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 WorkIds {
[key: string]: any | any;
openalex?: string | null;
doi?: string | null;
mag?: number | null;
pmid?: string | null;
pmcid?: string | null;
}
+23
View File
@@ -0,0 +1,23 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Work } from './work';
export interface WorkList {
/**
* All works.
*/
elements?: Array<Work>;
/**
* The total number of works.
*/
total?: number;
}
+31
View File
@@ -0,0 +1,31 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { WorkSummary } from './work-summary';
export interface WorkPage {
/**
* The works on this page.
*/
elements?: Array<WorkSummary>;
/**
* The current page number.
*/
page?: number;
/**
* The requested page size.
*/
size?: number;
/**
* The total number of works.
*/
total?: number;
}
+27
View File
@@ -0,0 +1,27 @@
/**
* My App Service
*
*
*
* 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 WorkSummary {
doi?: string | null;
title?: string | null;
type?: string | null;
language?: string | null;
publication_year?: number | null;
/**
* The number of citations.
*/
cited_by_count?: number;
/**
* The display names of the work topics.
*/
topics?: Array<string>;
}
+118
View File
@@ -0,0 +1,118 @@
/**
* My App Service
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Biblio } from './biblio';
import { CountByYear } from './count-by-year';
import { Authorship } from './authorship';
import { Keyword } from './keyword';
import { Funder } from './funder';
import { OpenAccess } from './open-access';
import { WorkIds } from './work-ids';
import { Mesh } from './mesh';
import { SustainableDevelopmentGoal } from './sustainable-development-goal';
import { HasContent } from './has-content';
import { Award } from './award';
import { CitationNormalizedPercentile } from './citation-normalized-percentile';
import { Topic } from './topic';
import { CitedByPercentileYear } from './cited-by-percentile-year';
import { Location } from './location';
export interface Work {
[key: string]: any | any;
/**
* The external id of the work.
*/
id: string;
doi?: string | null;
title?: string | null;
display_name?: string | null;
publication_year?: number | null;
publication_date?: string | null;
type?: string | null;
language?: string | null;
/**
* The number of citations.
*/
cited_by_count?: number;
is_retracted?: boolean | null;
is_paratext?: boolean | null;
primary_location?: Location | null;
/**
* The work locations.
*/
locations?: Array<Location>;
best_oa_location?: Location | null;
open_access?: OpenAccess | null;
/**
* The authorships.
*/
authorships?: Array<Authorship>;
ids?: WorkIds | null;
biblio?: Biblio | null;
/**
* The inverted abstract index.
*/
abstract_inverted_index?: { [key: string]: Array<number>; };
/**
* Referenced work ids.
*/
referenced_works?: Array<string>;
/**
* The number of referenced works.
*/
referenced_works_count?: number;
/**
* Related work ids.
*/
related_works?: Array<string>;
/**
* The topics.
*/
topics?: Array<Topic>;
primary_topic?: Topic | null;
/**
* The keywords.
*/
keywords?: Array<Keyword>;
/**
* The funders.
*/
funders?: Array<Funder>;
/**
* The awards.
*/
awards?: Array<Award>;
fwci?: number | null;
citation_normalized_percentile?: CitationNormalizedPercentile | null;
cited_by_percentile_year?: CitedByPercentileYear | null;
/**
* Citation counts by year.
*/
counts_by_year?: Array<CountByYear>;
/**
* Sustainable development goals.
*/
sustainable_development_goals?: Array<SustainableDevelopmentGoal>;
/**
* MeSH terms.
*/
mesh?: Array<Mesh>;
/**
* Indexes containing the work.
*/
indexed_in?: Array<string>;
has_content?: HasContent | null;
content_url?: string | null;
created_date?: string | null;
updated_date?: string | null;
}
+69
View File
@@ -0,0 +1,69 @@
/**
* Standard parameter styles defined by OpenAPI spec
*/
export type StandardParamStyle =
| 'matrix'
| 'label'
| 'form'
| 'simple'
| 'spaceDelimited'
| 'pipeDelimited'
| 'deepObject'
;
/**
* The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
*/
export type ParamStyle = StandardParamStyle | string;
/**
* Standard parameter locations defined by OpenAPI spec
*/
export type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
/**
* Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
*/
export type StandardDataType =
| "integer"
| "number"
| "boolean"
| "string"
| "object"
| "array"
;
/**
* Standard {@link DataType}s plus your own types/classes.
*/
export type DataType = StandardDataType | string;
/**
* Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
*/
export type StandardDataFormat =
| "int32"
| "int64"
| "float"
| "double"
| "byte"
| "binary"
| "date"
| "date-time"
| "password"
;
export type DataFormat = StandardDataFormat | string;
/**
* The parameter to encode.
*/
export interface Param {
name: string;
value: unknown;
in: ParamLocation;
style: ParamStyle,
explode: boolean;
dataType: DataType;
dataFormat: DataFormat | undefined;
}
+15
View File
@@ -0,0 +1,15 @@
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 }),
},
]);
}
+9
View File
@@ -0,0 +1,9 @@
import { InjectionToken } from '@angular/core';
export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}
@@ -1,70 +0,0 @@
<div
style="
display: flex;
flex-direction: column;
height: 100svh;
overflow: hidden;
"
>
<mat-toolbar class="main">
<div>
<ng-content select="[indicator]"></ng-content>
</div>
<div style="flex: 1" class="menu">
@if (mediaQuery.matches && (credentialService.authenticated | async)) {
<button mat-icon-button (click)="toggle()">
<mat-icon>menu</mat-icon>
</button>
} @else {
<a
href="/inse-webapp/"
style="
color: white;
text-decoration: none;
font-weight: 600;
font-size: 18px;
letter-spacing: 0.03em;
"
>Smartguide</a
>
}
</div>
<div style="display: flex; flex-direction: row" class="menu">
<ng-content select="[menu]"></ng-content>
@if (credentialService.authenticated | async) {
<button mat-icon-button (click)="logout()" matTooltip="Abmelden">
<mat-icon>logout</mat-icon>
</button>
} @else {
<button mat-icon-button routerLink="/login" matTooltip="Anmelden">
<mat-icon>login</mat-icon>
</button>
}
</div>
</mat-toolbar>
<div class="container">
<mat-drawer-container style="width: 100%; height: 100%">
@if (
(credentialService.authenticated | async) &&
((credentialService.superadmin | async) ||
(credentialService.universityadmin | async))
) {
<mat-drawer
class="drawer"
#drawer
[mode]="mediaQuery.matches ? 'over' : 'side'"
[(opened)]="sideNavOpen"
>
<app-menu></app-menu>
</mat-drawer>
}
<mat-drawer-content>
<ng-content></ng-content>
</mat-drawer-content>
</mat-drawer-container>
</div>
<div class="footer-container">
<div class="footer large">&copy; 2026 Smartguide</div>
<div class="footer small">&copy; 2026 Smartguide</div>
</div>
</div>
@@ -1,69 +0,0 @@
@use '@angular/material' as mat;
@import '../../m3-theme.scss';
.footer, .footer a {
font-size: 12px;
color: rgba(255, 255, 255, 0.85);
text-decoration: none;
letter-spacing: 0.02em;
}
.large {
display: block;
}
.small {
display: none;
}
.container {
height: calc(100svh - 84px);
overflow: auto;
background-color: #f4f6fb;
}
mat-toolbar.main {
background: linear-gradient(135deg, #1a3a6e 0%, #2259a8 60%, #4072c2 100%);
color: white;
@include mat.elevation(4);
z-index: 10;
}
.drawer {
width: 230px;
@include mat.elevation(3);
border-right: 1px solid rgba(0,0,0,0.06);
}
.footer-container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 28px;
background: linear-gradient(135deg, #1a3a6e 0%, #2259a8 100%);
}
@media (prefers-color-scheme: dark) {
.container {
background-color: #1b1b1f;
}
mat-toolbar.main {
background: linear-gradient(135deg, #001849 0%, #002d6e 60%, #004290 100%);
}
.footer-container {
background: linear-gradient(135deg, #001849 0%, #002d6e 100%);
}
}
@media (max-width: 600px) {
.large {
display: none;
}
.small {
display: block;
}
.container {
height: calc(100svh - 76px);
}
}
@@ -1,11 +0,0 @@
<mat-nav-list style="width: 199px; padding: 10px">
<div matSubheader>Navigation</div>
<mat-list-item routerLink="/items" routerLinkActive="active">
<mat-icon matListItemIcon>list</mat-icon>
<div matListItemTitle>Elemente</div>
</mat-list-item>
<mat-list-item routerLink="/person/0">
<mat-icon matListItemIcon>person</mat-icon>
<div matListItemTitle>Person 0</div>
</mat-list-item>
</mat-nav-list>
@@ -1,13 +0,0 @@
@use '@angular/material' as mat;
@import '../../m3-theme.scss';
.active {
background-color: mat.get-theme-color($light-theme, primary-container);
border-radius: 8px;
}
@media (prefers-color-scheme: dark) {
.active {
background-color: mat.get-theme-color($dark-theme, primary-container);
}
}
@@ -1,19 +0,0 @@
import { Component } from '@angular/core';
import { RouterLink, RouterLinkActive } from '@angular/router';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { CredentialService } from '../services/credential.service';
@Component({
selector: 'app-menu',
imports: [RouterLink, MatIconModule, MatListModule, RouterLinkActive],
templateUrl: './app-menu.component.html',
styleUrl: './app-menu.component.scss',
standalone: true,
})
export class AppMenuComponent {
constructor(public credentialService: CredentialService) { }
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { Component} from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { AppLayoutComponent } from './app-layout/app-layout.component';
import { AppLayoutComponent } from './shared/ui/app-layout/app-layout.component';
@Component({
selector: 'app-root',
+9 -8
View File
@@ -6,24 +6,25 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
import { provideHttpClient, withInterceptors } from '@angular/common/http';
import locale from '@angular/common/locales/de';
import { registerLocaleData } from '@angular/common';
import { authenticationInterceptor } from './interceptors/authentication.interceptor';
import { authenticationInterceptor } from './shared/interceptors/authentication.interceptor';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { PaginatorIntl } from './utils/paginatorIntl';
import { PaginatorIntl } from './shared/utils/paginatorIntl';
import { provideApi } from './api/provide-api';
registerLocaleData(locale);
export const appConfig: ApplicationConfig = {
providers: [
{ provide: LOCALE_ID, useValue: 'de' },
{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}},
{
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: { appearance: 'outline' },
},
{ provide: MatPaginatorIntl, useClass: PaginatorIntl },
provideRouter(routes),
provideHttpClient(withInterceptors([authenticationInterceptor])),
provideApi('/inse-service'),
provideAnimationsAsync(),
]
],
};
+17 -8
View File
@@ -1,27 +1,29 @@
import { Routes } from '@angular/router';
import { userGuard } from './guards/user.guard';
import { userGuard } from './shared/guards/user.guard';
export const routes: Routes = [
{
path: 'login',
loadComponent: () =>
import('./app-login/app-login.component').then(
import('./modules/app-login/app-login.component').then(
(mod) => mod.AppLoginComponent,
),
},
{
path: 'items',
path: 'dashboard',
canActivate: [userGuard],
loadComponent: () =>
import('./list-item/list-item.component').then(
(mod) => mod.ListItemComponent,
import('./modules/dashboard/dashboard.component').then(
(mod) => mod.DashboardComponent,
),
},
{
path: 'person/:id',
canActivate: [userGuard],
loadComponent: () =>
import('./person/person.component').then((mod) => mod.PersonComponent),
import('./modules/person/person.component').then(
(mod) => mod.PersonComponent,
),
children: [
{
path: '',
@@ -31,17 +33,24 @@ export const routes: Routes = [
{
path: 'overview',
loadComponent: () =>
import('./person-overview/person-overview.component').then(
import('./modules/person-overview/person-overview.component').then(
(mod) => mod.PersonOverviewComponent,
),
},
{
path: 'network',
loadComponent: () =>
import('./person-network/person-network.component').then(
import('./modules/person-network/person-network.component').then(
(mod) => mod.PersonNetworkComponent,
),
},
{
path: 'publications',
loadComponent: () =>
import('./modules/person-publications/person-publications.component').then(
(mod) => mod.PersonPublicationsComponent,
),
},
],
},
{
@@ -1,58 +0,0 @@
<div class="page">
<div class="form-section">
<h3>{{ editing ? 'Element bearbeiten' : 'Neues Element' }}</h3>
<form [formGroup]="itemForm" class="item-form">
<mat-form-field>
<mat-label>Name</mat-label>
<input matInput formControlName="name">
</mat-form-field>
<mat-form-field>
<mat-label>Beschreibung</mat-label>
<input matInput formControlName="description">
</mat-form-field>
<div class="form-actions">
<button mat-flat-button class="primary-button" (click)="save()" [disabled]="!itemForm.valid">
{{ editing ? 'Speichern' : 'Erstellen' }}
</button>
@if (editing) {
<button mat-flat-button class="secondary-button" (click)="cancelEdit()">Abbrechen</button>
}
</div>
</form>
</div>
<table mat-table [dataSource]="items" class="mat-elevation-z2">
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>ID</th>
<td mat-cell *matCellDef="let item">{{ item.id }}</td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let item">{{ item.name }}</td>
</ng-container>
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
<td mat-cell *matCellDef="let item">{{ item.description }}</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let item">
<button mat-icon-button (click)="startEdit(item)" matTooltip="Bearbeiten">
<mat-icon>edit</mat-icon>
</button>
<button mat-icon-button (click)="delete(item)" matTooltip="Löschen">
<mat-icon>delete</mat-icon>
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator
[length]="total"
[pageSize]="paginationService.selection"
[pageSizeOptions]="paginationService.options"
(page)="onPage($event)">
</mat-paginator>
</div>
@@ -1,73 +0,0 @@
.page {
padding: 28px 32px;
max-width: 960px;
margin: 0 auto;
}
.form-section {
margin-bottom: 24px;
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 1px 6px rgba(26, 58, 110, 0.08);
}
.form-section h3 {
margin: 0 0 16px;
font-weight: 600;
color: #1a3a6e;
}
.item-form {
display: flex;
flex-direction: row;
align-items: baseline;
gap: 12px;
flex-wrap: wrap;
}
.form-actions {
display: flex;
gap: 8px;
}
.form-actions button {
border-radius: 8px;
}
table {
width: 100%;
border-radius: 12px;
overflow: hidden;
}
::ng-deep .mat-mdc-header-row {
background-color: #eaf0ff;
}
mat-paginator {
margin-top: 8px;
border-radius: 0 0 12px 12px;
}
@media (prefers-color-scheme: dark) {
.form-section {
background: #303034;
box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}
.form-section h3 {
color: #a4c4ff;
}
::ng-deep .mat-mdc-header-row {
background-color: #1b1b22;
}
}
@media (max-width: 600px) {
.page {
padding: 16px;
}
.item-form {
flex-direction: column;
}
}
@@ -1,115 +0,0 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { MatPaginator, MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { ApiService, Item } from '../services/api.service';
import { PaginationService } from '../services/pagination.service';
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
import { createLoadError } from '../utils/errorHandler';
@Component({
selector: 'app-list-item',
imports: [
MatTableModule,
MatPaginatorModule,
MatButtonModule,
MatIconModule,
MatDialogModule,
MatSnackBarModule,
MatFormFieldModule,
MatInputModule,
ReactiveFormsModule
],
templateUrl: './list-item.component.html',
styleUrl: './list-item.component.scss',
standalone: true,
})
export class ListItemComponent implements OnInit {
displayedColumns: string[] = ['id', 'name', 'description', 'actions'];
items: Item[] = [];
total = 0;
editing: Item | null = null;
itemForm = new FormGroup({
name: new FormControl<string>('', [Validators.required, Validators.maxLength(200)]),
description: new FormControl<string>('', [Validators.maxLength(2000)])
});
constructor(
public apiService: ApiService,
public paginationService: PaginationService,
private dialog: MatDialog,
private snackBar: MatSnackBar
) {}
ngOnInit(): void {
this.load();
}
load() {
const offset = 0;
this.apiService.getItems(offset, this.paginationService.selection).subscribe({
next: (page) => {
this.items = page.elements;
this.total = page.total;
},
error: createLoadError(this.snackBar, () => this.load())
});
}
onPage(event: PageEvent) {
this.paginationService.selection = event.pageSize;
const offset = event.pageIndex * event.pageSize;
this.apiService.getItems(offset, event.pageSize).subscribe({
next: (page) => {
this.items = page.elements;
this.total = page.total;
},
error: createLoadError(this.snackBar, () => this.onPage(event))
});
}
startEdit(item: Item) {
this.editing = item;
this.itemForm.patchValue({ name: item.name, description: item.description });
}
cancelEdit() {
this.editing = null;
this.itemForm.reset();
}
save() {
if (!this.itemForm.valid) return;
const data = { name: this.itemForm.value.name!, description: this.itemForm.value.description ?? '' };
if (this.editing) {
this.apiService.updateItem(this.editing.id, data).subscribe({
next: () => { this.cancelEdit(); this.load(); },
error: createLoadError(this.snackBar)
});
} else {
this.apiService.createItem(data).subscribe({
next: () => { this.cancelEdit(); this.load(); },
error: createLoadError(this.snackBar)
});
}
}
delete(item: Item) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent);
dialogRef.componentInstance.confirmDelete.subscribe(() => {
this.apiService.deleteItem(item.id).subscribe({
next: () => this.load(),
error: createLoadError(this.snackBar)
});
});
}
}
@@ -50,20 +50,3 @@
.error {
color: #ba1a1a;
}
@media (prefers-color-scheme: dark) {
.container {
background: linear-gradient(160deg, #1b1b1f 0%, #252530 100%);
}
.form {
background: #303034;
box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.form h3 {
color: #a4c4ff;
}
.progress {
color: #c1c8dc;
}
}
@@ -3,7 +3,7 @@ import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angula
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { CredentialService } from '../services/credential.service';
import { CredentialService } from '../../shared/services/credential.service';
import { MatIconModule } from '@angular/material/icon';
import { CommonModule } from '@angular/common';
import { Subscription } from 'rxjs';
@@ -46,7 +46,7 @@ export class AppLoginComponent implements OnInit, OnDestroy {
checkEnter(): void {
if (this.credentialService.authenticated.value) {
this.router.navigate(['/items']);
this.router.navigate(['/dashboard']);
}
}
@@ -0,0 +1 @@
@@ -0,0 +1 @@
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-dashboard',
imports: [],
templateUrl: './dashboard.component.html',
styleUrl: './dashboard.component.scss',
standalone: true,
})
export class DashboardComponent {}

Some files were not shown because too many files have changed in this diff Show More