Full refactor (DB DTOs) #98
@@ -23,6 +23,15 @@ from . import config
|
||||
from .integrations import elasticsearch
|
||||
from .integrations import llm
|
||||
|
||||
from inse.models.author import Author
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.topic import Topic
|
||||
from inse.models.topic_subfield import TopicSubfield
|
||||
from inse.models.topic_field import TopicField
|
||||
from inse.models.topic_domain import TopicDomain
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
topic_cache_filename: str = "topic_hierarchy_cache.json"
|
||||
|
||||
@@ -136,13 +145,13 @@ def build_topic_cache(page_size: int = 200,
|
||||
|
||||
return taxonomy_cache
|
||||
|
||||
def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]:
|
||||
def get_topics_from_cache(topic_names: List[str]) -> List[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.
|
||||
List[Topic]: A list of Topic models.
|
||||
"""
|
||||
cache = _load_topic_cache()
|
||||
topics = []
|
||||
@@ -150,13 +159,16 @@ def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]:
|
||||
data = cache.get(name)
|
||||
if not data:
|
||||
continue
|
||||
topics.append(model.Topic(
|
||||
subfield_name = data.get("subfield", "")
|
||||
field_name = data.get("field", "")
|
||||
domain_name = data.get("domain", "")
|
||||
topics.append(Topic(
|
||||
id=data.get("topic_id", ""),
|
||||
display_name=name,
|
||||
count=data.get("count", 1),
|
||||
subfield=data.get("subfield", ""),
|
||||
field=data.get("field", ""),
|
||||
domain=data.get("domain", "")
|
||||
works_count=data.get("count", 1),
|
||||
subfield=TopicSubfield(display_name=subfield_name) if subfield_name else None,
|
||||
var_field=TopicField(display_name=field_name) if field_name else None,
|
||||
domain=TopicDomain(display_name=domain_name) if domain_name else None
|
||||
))
|
||||
return topics
|
||||
|
||||
@@ -202,7 +214,7 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict:
|
||||
### persons
|
||||
|
||||
def search_persons(author_id: Optional[str] = None, query: Optional[str] = None,
|
||||
include: Optional[set[str]] = None) -> model.PersonSearchResult:
|
||||
include: Optional[set[str]] = None) -> AuthorsListResponse:
|
||||
if author_id:
|
||||
query_field = "_id"
|
||||
query_value = author_id
|
||||
@@ -210,7 +222,7 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None,
|
||||
query_field = "display_name"
|
||||
query_value = query
|
||||
else:
|
||||
return "Either author_id or query must be provided"
|
||||
return AuthorsListResponse(results=[], meta=Meta(count=0))
|
||||
|
||||
data = elasticsearch.search(
|
||||
index="openalex-authors",
|
||||
@@ -218,67 +230,36 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None,
|
||||
query_value=query_value
|
||||
)
|
||||
|
||||
include_set = {tag.strip().lower() for tag in include} if include else set()
|
||||
persons = []
|
||||
authors = []
|
||||
for hit in data.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source", {})
|
||||
source_copy = dict(source)
|
||||
source_copy["id"] = source_copy.get("id") or hit.get("_id", "")
|
||||
|
||||
affiliations = []
|
||||
for aff in source.get("affiliations", []):
|
||||
institution = aff.get("institution", {})
|
||||
affiliations.append(model.Affiliation(
|
||||
institution=institution.get("display_name", ""),
|
||||
country_code=institution.get("country_code", "")
|
||||
))
|
||||
# Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated)
|
||||
ids = source_copy.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
ids_copy = dict(ids)
|
||||
for str_field in ["openalex", "orcid", "scopus"]:
|
||||
val = ids_copy.get(str_field)
|
||||
if val is not None and not isinstance(val, str):
|
||||
ids_copy[str_field] = str(val)
|
||||
source_copy["ids"] = ids_copy
|
||||
|
||||
topics = [t.get("display_name", "") for t in source.get("topics", [])]
|
||||
author = Author.from_dict(source_copy)
|
||||
if author:
|
||||
authors.append(author)
|
||||
|
||||
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)
|
||||
return AuthorsListResponse(results=authors, meta=Meta(count=len(authors)))
|
||||
|
||||
def generate_person_bio(author_id: str) -> str:
|
||||
search_result = search_persons(author_id=author_id)
|
||||
if not search_result.persons:
|
||||
if not search_result.results:
|
||||
return "No person found."
|
||||
if len(search_result.persons) > 1:
|
||||
if len(search_result.results) > 1:
|
||||
return "Multiple persons found, cannot generate bio."
|
||||
|
||||
person = search_result.persons[0]
|
||||
person = search_result.results[0]
|
||||
person_json = json.dumps(person.model_dump())
|
||||
|
||||
system_prompt = "Erstelle eine Beschreibung der Person in 3-5 Sätzen. Gebe nur die Beschreibung zurück, ohne Einleitung oder Schluss."
|
||||
@@ -287,3 +268,4 @@ def generate_person_bio(author_id: str) -> str:
|
||||
return llm.call(system_prompt=system_prompt, user_prompt=user_prompt)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,44 +36,8 @@ class Page(BaseModel, Generic[T]):
|
||||
class ItemPage(Page[Item]):
|
||||
pass
|
||||
|
||||
class Topic(BaseModel):
|
||||
id: str = Field(description="The openalex topic id.")
|
||||
display_name: str = Field(description="The topic name.")
|
||||
count: int = Field(description="The number of works associated with the topic.")
|
||||
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 TopicShare(Topic):
|
||||
count: float = Field(description="Share value (0..1) for this topic.")
|
||||
|
||||
class PersonBio(BaseModel):
|
||||
bio: str = Field(description="The generated biography.")
|
||||
|
||||
class Affiliation(BaseModel):
|
||||
institution: str = Field(description="Institution name.")
|
||||
country_code: Optional[str] = Field(default=None, description="Country code.")
|
||||
|
||||
class Person(BaseModel):
|
||||
id: str = Field(description="The person id.")
|
||||
name: str = Field(description="The person name.")
|
||||
works_count: int = Field(description="Number of works.")
|
||||
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.")
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
# import models into model package
|
||||
from inse.models.author import Author
|
||||
from inse.models.author_affiliations_inner import AuthorAffiliationsInner
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.author_ids import AuthorIds
|
||||
from inse.models.author_parsed_longest_name import AuthorParsedLongestName
|
||||
from inse.models.author_summary_stats import AuthorSummaryStats
|
||||
from inse.models.author_topics_inner import AuthorTopicsInner
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
from inse.models.authorship import Authorship
|
||||
from inse.models.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.autocomplete_response_meta import AutocompleteResponseMeta
|
||||
from inse.models.autocomplete_response_results_inner import AutocompleteResponseResultsInner
|
||||
from inse.models.award import Award
|
||||
from inse.models.award_full import AwardFull
|
||||
from inse.models.award_full_funder import AwardFullFunder
|
||||
from inse.models.awards_list_response import AwardsListResponse
|
||||
from inse.models.concept import Concept
|
||||
from inse.models.concept_ids import ConceptIds
|
||||
from inse.models.concepts_list_response import ConceptsListResponse
|
||||
from inse.models.continent import Continent
|
||||
from inse.models.continent_ids import ContinentIds
|
||||
from inse.models.continents_list_response import ContinentsListResponse
|
||||
from inse.models.countries_list_response import CountriesListResponse
|
||||
from inse.models.country import Country
|
||||
from inse.models.country_continent import CountryContinent
|
||||
from inse.models.country_ids import CountryIds
|
||||
from inse.models.dehydrated_author import DehydratedAuthor
|
||||
from inse.models.dehydrated_funder import DehydratedFunder
|
||||
from inse.models.dehydrated_institution import DehydratedInstitution
|
||||
from inse.models.dehydrated_source import DehydratedSource
|
||||
from inse.models.domain import Domain
|
||||
from inse.models.domain_fields_inner import DomainFieldsInner
|
||||
from inse.models.domain_ids import DomainIds
|
||||
from inse.models.domains_list_response import DomainsListResponse
|
||||
from inse.models.error import Error
|
||||
from inse.models.fields_list_response import FieldsListResponse
|
||||
from inse.models.funder import Funder
|
||||
from inse.models.funder_ids import FunderIds
|
||||
from inse.models.funders_list_response import FundersListResponse
|
||||
from inse.models.get_changefile200_response import GetChangefile200Response
|
||||
from inse.models.get_changefile200_response_meta import GetChangefile200ResponseMeta
|
||||
from inse.models.get_changefile200_response_results_inner import GetChangefile200ResponseResultsInner
|
||||
from inse.models.get_changefile200_response_results_inner_formats import GetChangefile200ResponseResultsInnerFormats
|
||||
from inse.models.get_changefile200_response_results_inner_formats_jsonl import GetChangefile200ResponseResultsInnerFormatsJsonl
|
||||
from inse.models.get_changefile200_response_results_inner_formats_parquet import GetChangefile200ResponseResultsInnerFormatsParquet
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.institution import Institution
|
||||
from inse.models.institution_geo import InstitutionGeo
|
||||
from inse.models.institution_ids import InstitutionIds
|
||||
from inse.models.institution_type import InstitutionType
|
||||
from inse.models.institution_types_list_response import InstitutionTypesListResponse
|
||||
from inse.models.institutions_list_response import InstitutionsListResponse
|
||||
from inse.models.keyword import Keyword
|
||||
from inse.models.keywords_list_response import KeywordsListResponse
|
||||
from inse.models.language import Language
|
||||
from inse.models.languages_list_response import LanguagesListResponse
|
||||
from inse.models.license import License
|
||||
from inse.models.licenses_list_response import LicensesListResponse
|
||||
from inse.models.list_changefiles200_response import ListChangefiles200Response
|
||||
from inse.models.list_changefiles200_response_meta import ListChangefiles200ResponseMeta
|
||||
from inse.models.list_changefiles200_response_results_inner import ListChangefiles200ResponseResultsInner
|
||||
from inse.models.location import Location
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.model_field import ModelField
|
||||
from inse.models.open_access import OpenAccess
|
||||
from inse.models.publisher import Publisher
|
||||
from inse.models.publisher_ids import PublisherIds
|
||||
from inse.models.publisher_parent_publisher import PublisherParentPublisher
|
||||
from inse.models.publishers_list_response import PublishersListResponse
|
||||
from inse.models.rate_limit_response import RateLimitResponse
|
||||
from inse.models.rate_limit_response_rate_limit import RateLimitResponseRateLimit
|
||||
from inse.models.rate_limit_response_rate_limit_endpoint_costs_usd import RateLimitResponseRateLimitEndpointCostsUsd
|
||||
from inse.models.sdg import Sdg
|
||||
from inse.models.sdg_ids import SdgIds
|
||||
from inse.models.sdgs_list_response import SdgsListResponse
|
||||
from inse.models.source import Source
|
||||
from inse.models.source_ids import SourceIds
|
||||
from inse.models.source_type import SourceType
|
||||
from inse.models.source_types_list_response import SourceTypesListResponse
|
||||
from inse.models.sources_list_response import SourcesListResponse
|
||||
from inse.models.subfield import Subfield
|
||||
from inse.models.subfield_domain import SubfieldDomain
|
||||
from inse.models.subfield_field import SubfieldField
|
||||
from inse.models.subfields_list_response import SubfieldsListResponse
|
||||
from inse.models.text_classification_response import TextClassificationResponse
|
||||
from inse.models.text_classification_response_meta import TextClassificationResponseMeta
|
||||
from inse.models.topic import Topic
|
||||
from inse.models.topic_domain import TopicDomain
|
||||
from inse.models.topic_field import TopicField
|
||||
from inse.models.topic_ids import TopicIds
|
||||
from inse.models.topic_subfield import TopicSubfield
|
||||
from inse.models.topics_list_response import TopicsListResponse
|
||||
from inse.models.work import Work
|
||||
from inse.models.work_biblio import WorkBiblio
|
||||
from inse.models.work_citation_normalized_percentile import WorkCitationNormalizedPercentile
|
||||
from inse.models.work_cited_by_percentile_year import WorkCitedByPercentileYear
|
||||
from inse.models.work_counts_by_year_inner import WorkCountsByYearInner
|
||||
from inse.models.work_has_content import WorkHasContent
|
||||
from inse.models.work_ids import WorkIds
|
||||
from inse.models.work_keyword import WorkKeyword
|
||||
from inse.models.work_mesh_inner import WorkMeshInner
|
||||
from inse.models.work_sustainable_development_goals_inner import WorkSustainableDevelopmentGoalsInner
|
||||
from inse.models.work_topic import WorkTopic
|
||||
from inse.models.work_topic_domain import WorkTopicDomain
|
||||
from inse.models.work_topic_field import WorkTopicField
|
||||
from inse.models.work_topic_subfield import WorkTopicSubfield
|
||||
from inse.models.work_type import WorkType
|
||||
from inse.models.work_types_list_response import WorkTypesListResponse
|
||||
from inse.models.works_list_response import WorksListResponse
|
||||
from inse.models.work_page import WorkPage
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author_affiliations_inner import AuthorAffiliationsInner
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.author_ids import AuthorIds
|
||||
from inse.models.author_parsed_longest_name import AuthorParsedLongestName
|
||||
from inse.models.author_summary_stats import AuthorSummaryStats
|
||||
from inse.models.work_topic import WorkTopic
|
||||
from inse.models.dehydrated_institution import DehydratedInstitution
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Author(BaseModel):
|
||||
"""
|
||||
A person who creates scholarly works
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this author.")
|
||||
orcid: Optional[StrictStr] = Field(default=None, description="The ORCID ID for this author. This is the Canonical External ID for authors.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the author as a single string.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Other ways this author's name has been displayed.")
|
||||
longest_name: Optional[StrictStr] = Field(default=None, description="The longest name variant found for this author across all their works.")
|
||||
parsed_longest_name: Optional[AuthorParsedLongestName] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works this author has created.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="The total number of works that cite a work this author has created.")
|
||||
summary_stats: Optional[AuthorSummaryStats] = None
|
||||
affiliations: Optional[List[AuthorAffiliationsInner]] = Field(default=None, description="List of affiliations this author has claimed in their publications. Each object has:")
|
||||
last_known_institutions: Optional[List[DehydratedInstitution]] = Field(default=None, description="This author's last known institutional affiliations. Each item is a dehydrated Institution object.")
|
||||
topics: Optional[List[WorkTopic]] = None
|
||||
counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
ids: Optional[AuthorIds] = None
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all this author's works.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this author was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this author was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "orcid", "display_name", "display_name_alternatives", "longest_name", "parsed_longest_name", "works_count", "cited_by_count", "summary_stats", "affiliations", "last_known_institutions", "topics", "counts_by_year", "ids", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Author from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of parsed_longest_name
|
||||
if self.parsed_longest_name:
|
||||
_dict['parsed_longest_name'] = self.parsed_longest_name.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of summary_stats
|
||||
if self.summary_stats:
|
||||
_dict['summary_stats'] = self.summary_stats.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in affiliations (list)
|
||||
_items = []
|
||||
if self.affiliations:
|
||||
for _item_affiliations in self.affiliations:
|
||||
if _item_affiliations:
|
||||
_items.append(_item_affiliations.to_dict())
|
||||
_dict['affiliations'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in last_known_institutions (list)
|
||||
_items = []
|
||||
if self.last_known_institutions:
|
||||
for _item_last_known_institutions in self.last_known_institutions:
|
||||
if _item_last_known_institutions:
|
||||
_items.append(_item_last_known_institutions.to_dict())
|
||||
_dict['last_known_institutions'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in topics (list)
|
||||
_items = []
|
||||
if self.topics:
|
||||
for _item_topics in self.topics:
|
||||
if _item_topics:
|
||||
_items.append(_item_topics.to_dict())
|
||||
_dict['topics'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Author from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"orcid": obj.get("orcid"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"longest_name": obj.get("longest_name"),
|
||||
"parsed_longest_name": AuthorParsedLongestName.from_dict(obj["parsed_longest_name"]) if obj.get("parsed_longest_name") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None,
|
||||
"affiliations": [AuthorAffiliationsInner.from_dict(_item) for _item in obj["affiliations"]] if obj.get("affiliations") is not None else None,
|
||||
"last_known_institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["last_known_institutions"]] if obj.get("last_known_institutions") is not None else None,
|
||||
"topics": [WorkTopic.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"ids": AuthorIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.dehydrated_institution import DehydratedInstitution
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
|
||||
class AuthorAffiliationsInner(BaseModel):
|
||||
"""
|
||||
AuthorAffiliationsInner
|
||||
""" # noqa: E501
|
||||
|
||||
institution: Optional[DehydratedInstitution] = Field(
|
||||
default=None,
|
||||
description="[Dehydrated institution](/api-reference/institutions#the-dehydratedinstitution-object)",
|
||||
)
|
||||
years: Optional[List[StrictInt]] = None
|
||||
__properties: ClassVar[List[str]] = ["institution", "years"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorAffiliationsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of institution
|
||||
if self.institution:
|
||||
_dict["institution"] = self.institution.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorAffiliationsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate(
|
||||
{
|
||||
"institution": DehydratedInstitution.from_dict(obj["institution"])
|
||||
if obj.get("institution") is not None
|
||||
else None,
|
||||
"years": obj.get("years"),
|
||||
}
|
||||
)
|
||||
return _obj
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorCountsByYearInner(BaseModel):
|
||||
"""
|
||||
AuthorCountsByYearInner
|
||||
""" # noqa: E501
|
||||
year: Optional[StrictInt] = None
|
||||
works_count: Optional[StrictInt] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["year", "works_count", "cited_by_count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorCountsByYearInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorCountsByYearInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"year": obj.get("year"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
orcid: Optional[StrictStr] = None
|
||||
scopus: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "orcid", "scopus"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
openalex_val = obj.get("openalex")
|
||||
if openalex_val is not None and not isinstance(openalex_val, str):
|
||||
openalex_val = str(openalex_val)
|
||||
|
||||
orcid_val = obj.get("orcid")
|
||||
if orcid_val is not None and not isinstance(orcid_val, str):
|
||||
orcid_val = str(orcid_val)
|
||||
|
||||
scopus_val = obj.get("scopus")
|
||||
if scopus_val is not None and not isinstance(scopus_val, str):
|
||||
scopus_val = str(scopus_val)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": openalex_val,
|
||||
"orcid": orcid_val,
|
||||
"scopus": scopus_val
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorParsedLongestName(BaseModel):
|
||||
"""
|
||||
The longest name parsed into its component parts.
|
||||
""" # noqa: E501
|
||||
first: Optional[StrictStr] = Field(default=None, description="First name (lowercased).")
|
||||
middle: Optional[StrictStr] = Field(default=None, description="Middle name or initial (lowercased).")
|
||||
last: Optional[StrictStr] = Field(default=None, description="Last name (lowercased).")
|
||||
suffix: Optional[StrictStr] = Field(default=None, description="Name suffix (e.g., Jr., III).")
|
||||
nickname: Optional[StrictStr] = Field(default=None, description="Nickname, if any.")
|
||||
__properties: ClassVar[List[str]] = ["first", "middle", "last", "suffix", "nickname"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorParsedLongestName from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorParsedLongestName from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"first": obj.get("first"),
|
||||
"middle": obj.get("middle"),
|
||||
"last": obj.get("last"),
|
||||
"suffix": obj.get("suffix"),
|
||||
"nickname": obj.get("nickname")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorSummaryStats(BaseModel):
|
||||
"""
|
||||
Citation metrics:
|
||||
""" # noqa: E501
|
||||
var_2yr_mean_citedness: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="2yr_mean_citedness")
|
||||
h_index: Optional[StrictInt] = None
|
||||
i10_index: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["2yr_mean_citedness", "h_index", "i10_index"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorSummaryStats from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorSummaryStats from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"2yr_mean_citedness": obj.get("2yr_mean_citedness"),
|
||||
"h_index": obj.get("h_index"),
|
||||
"i10_index": obj.get("i10_index")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorTopicsInner(BaseModel):
|
||||
"""
|
||||
AuthorTopicsInner
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
count: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorTopicsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorTopicsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"count": obj.get("count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author import Author
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AuthorsListResponse(BaseModel):
|
||||
"""
|
||||
AuthorsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Author]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AuthorsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AuthorsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Author.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.dehydrated_author import DehydratedAuthor
|
||||
from inse.models.dehydrated_institution import DehydratedInstitution
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Authorship(BaseModel):
|
||||
"""
|
||||
Author and their affiliation for a work
|
||||
""" # noqa: E501
|
||||
author_position: Optional[StrictStr] = Field(default=None, description="Position in author list")
|
||||
author: Optional[DehydratedAuthor] = Field(default=None, description="[Dehydrated author](/api-reference/authors#the-dehydratedauthor-object)")
|
||||
institutions: Optional[List[DehydratedInstitution]] = Field(default=None, description="[Dehydrated institutions](/api-reference/institutions#the-dehydratedinstitution-object)")
|
||||
countries: Optional[List[StrictStr]] = Field(default=None, description="Country codes of affiliations")
|
||||
is_corresponding: Optional[StrictBool] = Field(default=None, description="Whether this is the corresponding author")
|
||||
raw_author_name: Optional[StrictStr] = Field(default=None, description="Author name as it appears in the work")
|
||||
raw_affiliation_strings: Optional[List[StrictStr]] = None
|
||||
__properties: ClassVar[List[str]] = ["author_position", "author", "institutions", "countries", "is_corresponding", "raw_author_name", "raw_affiliation_strings"]
|
||||
|
||||
@field_validator('author_position')
|
||||
def author_position_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['first', 'middle', 'last']):
|
||||
raise ValueError("must be one of enum values ('first', 'middle', 'last')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Authorship from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of author
|
||||
if self.author:
|
||||
_dict['author'] = self.author.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in institutions (list)
|
||||
_items = []
|
||||
if self.institutions:
|
||||
for _item_institutions in self.institutions:
|
||||
if _item_institutions:
|
||||
_items.append(_item_institutions.to_dict())
|
||||
_dict['institutions'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Authorship from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"author_position": obj.get("author_position"),
|
||||
"author": DehydratedAuthor.from_dict(obj["author"]) if obj.get("author") is not None else None,
|
||||
"institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["institutions"]] if obj.get("institutions") is not None else None,
|
||||
"countries": obj.get("countries"),
|
||||
"is_corresponding": obj.get("is_corresponding"),
|
||||
"raw_author_name": obj.get("raw_author_name"),
|
||||
"raw_affiliation_strings": obj.get("raw_affiliation_strings")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.autocomplete_response_meta import AutocompleteResponseMeta
|
||||
from inse.models.autocomplete_response_results_inner import AutocompleteResponseResultsInner
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AutocompleteResponse(BaseModel):
|
||||
"""
|
||||
AutocompleteResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[AutocompleteResponseMeta] = None
|
||||
results: Optional[List[AutocompleteResponseResultsInner]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": AutocompleteResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [AutocompleteResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AutocompleteResponseMeta(BaseModel):
|
||||
"""
|
||||
AutocompleteResponseMeta
|
||||
""" # noqa: E501
|
||||
count: Optional[StrictInt] = None
|
||||
db_response_time_ms: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["count", "db_response_time_ms"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponseMeta from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponseMeta from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"count": obj.get("count"),
|
||||
"db_response_time_ms": obj.get("db_response_time_ms")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AutocompleteResponseResultsInner(BaseModel):
|
||||
"""
|
||||
AutocompleteResponseResultsInner
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
hint: Optional[StrictStr] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
works_count: Optional[StrictInt] = None
|
||||
entity_type: Optional[StrictStr] = None
|
||||
external_id: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "hint", "cited_by_count", "works_count", "entity_type", "external_id"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponseResultsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AutocompleteResponseResultsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"hint": obj.get("hint"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"entity_type": obj.get("entity_type"),
|
||||
"external_id": obj.get("external_id")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Award(BaseModel):
|
||||
"""
|
||||
Award
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
funder_award_id: Optional[StrictStr] = None
|
||||
funder_id: Optional[StrictStr] = None
|
||||
funder_display_name: Optional[StrictStr] = None
|
||||
doi: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "funder_award_id", "funder_id", "funder_display_name", "doi"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Award from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Award from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"funder_award_id": obj.get("funder_award_id"),
|
||||
"funder_id": obj.get("funder_id"),
|
||||
"funder_display_name": obj.get("funder_display_name"),
|
||||
"doi": obj.get("doi")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from inse.models.award_full_funder import AwardFullFunder
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AwardFull(BaseModel):
|
||||
"""
|
||||
Research grant or funding award
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this award.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the award, if available.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of the award, if available.")
|
||||
funder_award_id: Optional[StrictStr] = Field(default=None, description="The funder's internal ID for this award.")
|
||||
funder: Optional[AwardFullFunder] = None
|
||||
funded_outputs: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs of works funded by this award (first 100).")
|
||||
funded_outputs_count: Optional[StrictInt] = Field(default=None, description="Total number of works funded by this award.")
|
||||
amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The funding amount, if available.")
|
||||
currency: Optional[StrictStr] = Field(default=None, description="The currency of the funding amount, if available.")
|
||||
funding_type: Optional[StrictStr] = Field(default=None, description="The type of funding, if available.")
|
||||
funder_scheme: Optional[StrictStr] = Field(default=None, description="The funder's scheme or program, if available.")
|
||||
start_date: Optional[date] = Field(default=None, description="Start date of the award (ISO 8601), if available.")
|
||||
end_date: Optional[date] = Field(default=None, description="End date of the award (ISO 8601), if available.")
|
||||
start_year: Optional[StrictInt] = Field(default=None, description="Start year of the award, if available.")
|
||||
end_year: Optional[StrictInt] = Field(default=None, description="End year of the award, if available.")
|
||||
landing_page_url: Optional[StrictStr] = Field(default=None, description="URL to the award's landing page, if available.")
|
||||
doi: Optional[StrictStr] = Field(default=None, description="DOI for this award, if available.")
|
||||
provenance: Optional[StrictStr] = Field(default=None, description="The source of this award data.")
|
||||
lead_investigator: Optional[Dict[str, Any]] = Field(default=None, description="The lead investigator for this award, if available.")
|
||||
co_lead_investigator: Optional[Dict[str, Any]] = Field(default=None, description="The co-lead investigator, if available.")
|
||||
investigators: Optional[List[Any]] = Field(default=None, description="List of investigators on this award, if available.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works funded by this award.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this award was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this award was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "funder_award_id", "funder", "funded_outputs", "funded_outputs_count", "amount", "currency", "funding_type", "funder_scheme", "start_date", "end_date", "start_year", "end_year", "landing_page_url", "doi", "provenance", "lead_investigator", "co_lead_investigator", "investigators", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AwardFull from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of funder
|
||||
if self.funder:
|
||||
_dict['funder'] = self.funder.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AwardFull from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"funder_award_id": obj.get("funder_award_id"),
|
||||
"funder": AwardFullFunder.from_dict(obj["funder"]) if obj.get("funder") is not None else None,
|
||||
"funded_outputs": obj.get("funded_outputs"),
|
||||
"funded_outputs_count": obj.get("funded_outputs_count"),
|
||||
"amount": obj.get("amount"),
|
||||
"currency": obj.get("currency"),
|
||||
"funding_type": obj.get("funding_type"),
|
||||
"funder_scheme": obj.get("funder_scheme"),
|
||||
"start_date": obj.get("start_date"),
|
||||
"end_date": obj.get("end_date"),
|
||||
"start_year": obj.get("start_year"),
|
||||
"end_year": obj.get("end_year"),
|
||||
"landing_page_url": obj.get("landing_page_url"),
|
||||
"doi": obj.get("doi"),
|
||||
"provenance": obj.get("provenance"),
|
||||
"lead_investigator": obj.get("lead_investigator"),
|
||||
"co_lead_investigator": obj.get("co_lead_investigator"),
|
||||
"investigators": obj.get("investigators"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AwardFullFunder(BaseModel):
|
||||
"""
|
||||
The [funder](/api-reference/funders) of this award
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
doi: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "doi"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AwardFullFunder from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AwardFullFunder from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"doi": obj.get("doi")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.award_full import AwardFull
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class AwardsListResponse(BaseModel):
|
||||
"""
|
||||
AwardsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[AwardFull]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AwardsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AwardsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [AwardFull.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.concept_ids import ConceptIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Concept(BaseModel):
|
||||
"""
|
||||
Legacy research area taxonomy (deprecated)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this concept.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the concept.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of this concept.")
|
||||
level: Optional[StrictInt] = Field(default=None, description="The hierarchical level (0 = top level, higher = more specific).")
|
||||
wikidata: Optional[StrictStr] = Field(default=None, description="The Wikidata ID for this concept.")
|
||||
ids: Optional[ConceptIds] = None
|
||||
image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this concept.")
|
||||
image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this concept.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works tagged with this concept.")
|
||||
ancestors: Optional[List[Any]] = Field(default=None, description="Parent concepts in the hierarchy.")
|
||||
related_concepts: Optional[List[Any]] = Field(default=None, description="Related concepts with similarity scores.")
|
||||
counts_by_year: Optional[List[Any]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this concept.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this concept was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this concept was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "level", "wikidata", "ids", "image_url", "image_thumbnail_url", "works_count", "cited_by_count", "ancestors", "related_concepts", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Concept from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Concept from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"level": obj.get("level"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"ids": ConceptIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"image_url": obj.get("image_url"),
|
||||
"image_thumbnail_url": obj.get("image_thumbnail_url"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"ancestors": obj.get("ancestors"),
|
||||
"related_concepts": obj.get("related_concepts"),
|
||||
"counts_by_year": obj.get("counts_by_year"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ConceptIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
wikipedia: Optional[StrictStr] = None
|
||||
mag: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "wikidata", "wikipedia", "mag"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ConceptIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ConceptIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"wikipedia": obj.get("wikipedia"),
|
||||
"mag": obj.get("mag")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.concept import Concept
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ConceptsListResponse(BaseModel):
|
||||
"""
|
||||
ConceptsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Concept]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ConceptsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ConceptsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Concept.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.continent_ids import ContinentIds
|
||||
from inse.models.domain_fields_inner import DomainFieldsInner
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Continent(BaseModel):
|
||||
"""
|
||||
Geographic continent (7 total)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this continent (uses Wikidata Q-IDs).")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the continent.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A brief description of the continent.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this continent.")
|
||||
countries: Optional[List[DomainFieldsInner]] = Field(default=None, description="The countries within this continent. Each object has `id` and `display_name`.")
|
||||
ids: Optional[ContinentIds] = None
|
||||
created_date: Optional[date] = Field(default=None, description="When this continent was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this continent was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "countries", "ids", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Continent from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in countries (list)
|
||||
_items = []
|
||||
if self.countries:
|
||||
for _item_countries in self.countries:
|
||||
if _item_countries:
|
||||
_items.append(_item_countries.to_dict())
|
||||
_dict['countries'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Continent from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"countries": [DomainFieldsInner.from_dict(_item) for _item in obj["countries"]] if obj.get("countries") is not None else None,
|
||||
"ids": ContinentIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ContinentIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "wikidata"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ContinentIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ContinentIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"wikidata": obj.get("wikidata")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.continent import Continent
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ContinentsListResponse(BaseModel):
|
||||
"""
|
||||
ContinentsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Continent]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ContinentsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ContinentsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Continent.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.country import Country
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class CountriesListResponse(BaseModel):
|
||||
"""
|
||||
CountriesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Country]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of CountriesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of CountriesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Country.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.country_continent import CountryContinent
|
||||
from inse.models.country_ids import CountryIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Country(BaseModel):
|
||||
"""
|
||||
Geographic country
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this country.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The full name of the country.")
|
||||
country_code: Optional[StrictStr] = Field(default=None, description="ISO 3166-1 alpha-2 country code.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A brief description of the country.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this country.")
|
||||
continent: Optional[CountryContinent] = None
|
||||
is_global_south: Optional[StrictBool] = Field(default=None, description="Whether this country is part of the Global South.")
|
||||
ids: Optional[CountryIds] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works with authors affiliated with institutions in this country.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works from this country.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works from authors in this country.")
|
||||
authors_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all authors with affiliations in this country.")
|
||||
institutions_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all institutions in this country.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this country was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this country was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "country_code", "description", "display_name_alternatives", "continent", "is_global_south", "ids", "works_count", "cited_by_count", "works_api_url", "authors_api_url", "institutions_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Country from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of continent
|
||||
if self.continent:
|
||||
_dict['continent'] = self.continent.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Country from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"country_code": obj.get("country_code"),
|
||||
"description": obj.get("description"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"continent": CountryContinent.from_dict(obj["continent"]) if obj.get("continent") is not None else None,
|
||||
"is_global_south": obj.get("is_global_south"),
|
||||
"ids": CountryIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"authors_api_url": obj.get("authors_api_url"),
|
||||
"institutions_api_url": obj.get("institutions_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class CountryContinent(BaseModel):
|
||||
"""
|
||||
The [continent](/api-reference/continents)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of CountryContinent from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of CountryContinent from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class CountryIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
iso: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
wikipedia: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "iso", "wikidata", "wikipedia"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of CountryIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of CountryIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"iso": obj.get("iso"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"wikipedia": obj.get("wikipedia")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DehydratedAuthor(BaseModel):
|
||||
"""
|
||||
[Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
orcid: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "orcid"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedAuthor from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedAuthor from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"orcid": obj.get("orcid")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DehydratedFunder(BaseModel):
|
||||
"""
|
||||
[Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
ror: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "ror"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedFunder from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedFunder from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"ror": obj.get("ror")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DehydratedInstitution(BaseModel):
|
||||
"""
|
||||
[Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
ror: Optional[StrictStr] = None
|
||||
country_code: Optional[StrictStr] = Field(default=None, description="[Country](/api-reference/countries) code")
|
||||
type: Optional[StrictStr] = Field(default=None, description="The [institution type](/api-reference/institution-types)")
|
||||
lineage: Optional[List[StrictStr]] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "ror", "country_code", "type", "lineage"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedInstitution from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedInstitution from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"ror": obj.get("ror"),
|
||||
"country_code": obj.get("country_code"),
|
||||
"type": obj.get("type"),
|
||||
"lineage": obj.get("lineage")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DehydratedSource(BaseModel):
|
||||
"""
|
||||
[Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
issn_l: Optional[StrictStr] = None
|
||||
issn: Optional[List[StrictStr]] = None
|
||||
is_oa: Optional[StrictBool] = None
|
||||
is_in_doaj: Optional[StrictBool] = None
|
||||
is_core: Optional[StrictBool] = None
|
||||
host_organization: Optional[StrictStr] = None
|
||||
host_organization_name: Optional[StrictStr] = None
|
||||
host_organization_lineage: Optional[List[StrictStr]] = None
|
||||
type: Optional[StrictStr] = Field(default=None, description="The [source type](/api-reference/source-types)")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "issn_l", "issn", "is_oa", "is_in_doaj", "is_core", "host_organization", "host_organization_name", "host_organization_lineage", "type"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedSource from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DehydratedSource from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"issn_l": obj.get("issn_l"),
|
||||
"issn": obj.get("issn"),
|
||||
"is_oa": obj.get("is_oa"),
|
||||
"is_in_doaj": obj.get("is_in_doaj"),
|
||||
"is_core": obj.get("is_core"),
|
||||
"host_organization": obj.get("host_organization"),
|
||||
"host_organization_name": obj.get("host_organization_name"),
|
||||
"host_organization_lineage": obj.get("host_organization_lineage"),
|
||||
"type": obj.get("type")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.domain_fields_inner import DomainFieldsInner
|
||||
from inse.models.domain_ids import DomainIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Domain(BaseModel):
|
||||
"""
|
||||
Top-level category in the topic hierarchy (4 total)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this domain.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the domain.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of this domain.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this domain.")
|
||||
fields: Optional[List[DomainFieldsInner]] = Field(default=None, description="The fields within this domain. Each object has `id` and `display_name`.")
|
||||
siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other domains at the same level. Each object has `id` and `display_name`.")
|
||||
ids: Optional[DomainIds] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this domain.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this domain.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this domain.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this domain was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this domain was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "fields", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Domain from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in fields (list)
|
||||
_items = []
|
||||
if self.fields:
|
||||
for _item_fields in self.fields:
|
||||
if _item_fields:
|
||||
_items.append(_item_fields.to_dict())
|
||||
_dict['fields'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in siblings (list)
|
||||
_items = []
|
||||
if self.siblings:
|
||||
for _item_siblings in self.siblings:
|
||||
if _item_siblings:
|
||||
_items.append(_item_siblings.to_dict())
|
||||
_dict['siblings'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Domain from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"fields": [DomainFieldsInner.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
|
||||
"siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None,
|
||||
"ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DomainFieldsInner(BaseModel):
|
||||
"""
|
||||
DomainFieldsInner
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DomainFieldsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DomainFieldsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DomainIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
wikipedia: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "wikidata", "wikipedia"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DomainIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DomainIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"wikipedia": obj.get("wikipedia")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.domain import Domain
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class DomainsListResponse(BaseModel):
|
||||
"""
|
||||
DomainsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Domain]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DomainsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DomainsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Domain.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Error(BaseModel):
|
||||
"""
|
||||
Error
|
||||
""" # noqa: E501
|
||||
error: Optional[StrictStr] = Field(default=None, description="Error type")
|
||||
message: Optional[StrictStr] = Field(default=None, description="Human-readable error message")
|
||||
__properties: ClassVar[List[str]] = ["error", "message"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Error from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Error from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"error": obj.get("error"),
|
||||
"message": obj.get("message")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.model_field import ModelField
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class FieldsListResponse(BaseModel):
|
||||
"""
|
||||
FieldsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[ModelField]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of FieldsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of FieldsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [ModelField.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.funder_ids import FunderIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Funder(BaseModel):
|
||||
"""
|
||||
An organization that funds research
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this funder.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the funder.")
|
||||
alternate_titles: Optional[List[StrictStr]] = Field(default=None, description="A list of alternate titles for this funder.")
|
||||
country_code: Optional[StrictStr] = Field(default=None, description="ISO two-letter country code where this funder is located.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A short description from Wikidata.")
|
||||
homepage_url: Optional[StrictStr] = Field(default=None, description="URL for this funder's primary homepage.")
|
||||
image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this funder (usually from Wikimedia).")
|
||||
image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.")
|
||||
grants_count: Optional[StrictInt] = Field(default=None, description="The number of grants linked to this funder.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works linked to this funder.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works linked to this funder.")
|
||||
ids: Optional[FunderIds] = None
|
||||
counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = Field(default=None, description="When this funder was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this funder was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "alternate_titles", "country_code", "description", "homepage_url", "image_url", "image_thumbnail_url", "grants_count", "works_count", "cited_by_count", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Funder from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Funder from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"alternate_titles": obj.get("alternate_titles"),
|
||||
"country_code": obj.get("country_code"),
|
||||
"description": obj.get("description"),
|
||||
"homepage_url": obj.get("homepage_url"),
|
||||
"image_url": obj.get("image_url"),
|
||||
"image_thumbnail_url": obj.get("image_thumbnail_url"),
|
||||
"grants_count": obj.get("grants_count"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"ids": FunderIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class FunderIds(BaseModel):
|
||||
"""
|
||||
External identifiers for this funder:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
ror: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
crossref: Optional[StrictStr] = None
|
||||
doi: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "ror", "wikidata", "crossref", "doi"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of FunderIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of FunderIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"ror": obj.get("ror"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"crossref": obj.get("crossref"),
|
||||
"doi": obj.get("doi")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.funder import Funder
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class FundersListResponse(BaseModel):
|
||||
"""
|
||||
FundersListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Funder]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of FundersListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of FundersListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Funder.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.get_changefile200_response_meta import GetChangefile200ResponseMeta
|
||||
from inse.models.get_changefile200_response_results_inner import GetChangefile200ResponseResultsInner
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200Response(BaseModel):
|
||||
"""
|
||||
GetChangefile200Response
|
||||
""" # noqa: E501
|
||||
meta: Optional[GetChangefile200ResponseMeta] = None
|
||||
results: Optional[List[GetChangefile200ResponseResultsInner]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200Response from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200Response from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": GetChangefile200ResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [GetChangefile200ResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200ResponseMeta(BaseModel):
|
||||
"""
|
||||
GetChangefile200ResponseMeta
|
||||
""" # noqa: E501
|
||||
count: Optional[StrictInt] = Field(default=None, description="Number of entity types with changes")
|
||||
var_date: Optional[date] = Field(default=None, description="The changefile date", alias="date")
|
||||
__properties: ClassVar[List[str]] = ["count", "date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseMeta from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseMeta from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"count": obj.get("count"),
|
||||
"date": obj.get("date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.get_changefile200_response_results_inner_formats import GetChangefile200ResponseResultsInnerFormats
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200ResponseResultsInner(BaseModel):
|
||||
"""
|
||||
GetChangefile200ResponseResultsInner
|
||||
""" # noqa: E501
|
||||
entity: Optional[StrictStr] = Field(default=None, description="The entity type (e.g., works, authors, institutions)")
|
||||
records: Optional[StrictInt] = Field(default=None, description="Number of created or modified records")
|
||||
formats: Optional[GetChangefile200ResponseResultsInnerFormats] = None
|
||||
__properties: ClassVar[List[str]] = ["entity", "records", "formats"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of formats
|
||||
if self.formats:
|
||||
_dict['formats'] = self.formats.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"entity": obj.get("entity"),
|
||||
"records": obj.get("records"),
|
||||
"formats": GetChangefile200ResponseResultsInnerFormats.from_dict(obj["formats"]) if obj.get("formats") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.get_changefile200_response_results_inner_formats_jsonl import GetChangefile200ResponseResultsInnerFormatsJsonl
|
||||
from inse.models.get_changefile200_response_results_inner_formats_parquet import GetChangefile200ResponseResultsInnerFormatsParquet
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200ResponseResultsInnerFormats(BaseModel):
|
||||
"""
|
||||
GetChangefile200ResponseResultsInnerFormats
|
||||
""" # noqa: E501
|
||||
jsonl: Optional[GetChangefile200ResponseResultsInnerFormatsJsonl] = None
|
||||
parquet: Optional[GetChangefile200ResponseResultsInnerFormatsParquet] = None
|
||||
__properties: ClassVar[List[str]] = ["jsonl", "parquet"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormats from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of jsonl
|
||||
if self.jsonl:
|
||||
_dict['jsonl'] = self.jsonl.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of parquet
|
||||
if self.parquet:
|
||||
_dict['parquet'] = self.parquet.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormats from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"jsonl": GetChangefile200ResponseResultsInnerFormatsJsonl.from_dict(obj["jsonl"]) if obj.get("jsonl") is not None else None,
|
||||
"parquet": GetChangefile200ResponseResultsInnerFormatsParquet.from_dict(obj["parquet"]) if obj.get("parquet") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200ResponseResultsInnerFormatsJsonl(BaseModel):
|
||||
"""
|
||||
GetChangefile200ResponseResultsInnerFormatsJsonl
|
||||
""" # noqa: E501
|
||||
size_bytes: Optional[StrictInt] = Field(default=None, description="File size in bytes")
|
||||
size_display: Optional[StrictStr] = Field(default=None, description="Human-readable file size")
|
||||
url: Optional[StrictStr] = Field(default=None, description="Download URL for gzipped JSONL file")
|
||||
__properties: ClassVar[List[str]] = ["size_bytes", "size_display", "url"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormatsJsonl from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormatsJsonl from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"size_bytes": obj.get("size_bytes"),
|
||||
"size_display": obj.get("size_display"),
|
||||
"url": obj.get("url")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GetChangefile200ResponseResultsInnerFormatsParquet(BaseModel):
|
||||
"""
|
||||
GetChangefile200ResponseResultsInnerFormatsParquet
|
||||
""" # noqa: E501
|
||||
size_bytes: Optional[StrictInt] = Field(default=None, description="File size in bytes")
|
||||
size_display: Optional[StrictStr] = Field(default=None, description="Human-readable file size")
|
||||
url: Optional[StrictStr] = Field(default=None, description="Download URL for Parquet file")
|
||||
__properties: ClassVar[List[str]] = ["size_bytes", "size_display", "url"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormatsParquet from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GetChangefile200ResponseResultsInnerFormatsParquet from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"size_bytes": obj.get("size_bytes"),
|
||||
"size_display": obj.get("size_display"),
|
||||
"url": obj.get("url")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class GroupByResult(BaseModel):
|
||||
"""
|
||||
GroupByResult
|
||||
""" # noqa: E501
|
||||
key: Optional[StrictStr] = Field(default=None, description="The group key value")
|
||||
key_display_name: Optional[StrictStr] = Field(default=None, description="Human-readable name for the key")
|
||||
count: Optional[StrictInt] = Field(default=None, description="Number of results in this group")
|
||||
__properties: ClassVar[List[str]] = ["key", "key_display_name", "count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of GroupByResult from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of GroupByResult from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"key": obj.get("key"),
|
||||
"key_display_name": obj.get("key_display_name"),
|
||||
"count": obj.get("count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.author_summary_stats import AuthorSummaryStats
|
||||
from inse.models.institution_geo import InstitutionGeo
|
||||
from inse.models.institution_ids import InstitutionIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Institution(BaseModel):
|
||||
"""
|
||||
A university, research organization, or other affiliation
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this institution.")
|
||||
ror: Optional[StrictStr] = Field(default=None, description="The ROR ID for this institution. This is the Canonical External ID for institutions.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the institution.")
|
||||
country_code: Optional[StrictStr] = Field(default=None, description="ISO two-letter country code where this institution is located.")
|
||||
type: Optional[StrictStr] = Field(default=None, description="The institution's primary type (ROR vocabulary): `Education`, `Healthcare`, `Company`, `Archive`, `Nonprofit`, `Government`, `Facility`, `Other`.")
|
||||
homepage_url: Optional[StrictStr] = Field(default=None, description="URL for the institution's primary homepage.")
|
||||
image_url: Optional[StrictStr] = Field(default=None, description="URL for an image representing this institution (usually from Wikimedia).")
|
||||
image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.")
|
||||
display_name_acronyms: Optional[List[StrictStr]] = Field(default=None, description="Acronyms or initialisms for this institution.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Other names people may use for this institution.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works created by authors affiliated with this institution.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works from authors affiliated with this institution.")
|
||||
summary_stats: Optional[AuthorSummaryStats] = None
|
||||
geo: Optional[InstitutionGeo] = None
|
||||
lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs including this institution and any parent institutions.")
|
||||
ids: Optional[InstitutionIds] = None
|
||||
counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all works affiliated with this institution.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this institution was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']):
|
||||
raise ValueError("must be one of enum values ('education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Institution from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of summary_stats
|
||||
if self.summary_stats:
|
||||
_dict['summary_stats'] = self.summary_stats.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of geo
|
||||
if self.geo:
|
||||
_dict['geo'] = self.geo.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Institution from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"ror": obj.get("ror"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"country_code": obj.get("country_code"),
|
||||
"type": obj.get("type"),
|
||||
"homepage_url": obj.get("homepage_url"),
|
||||
"image_url": obj.get("image_url"),
|
||||
"image_thumbnail_url": obj.get("image_thumbnail_url"),
|
||||
"display_name_acronyms": obj.get("display_name_acronyms"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None,
|
||||
"geo": InstitutionGeo.from_dict(obj["geo"]) if obj.get("geo") is not None else None,
|
||||
"lineage": obj.get("lineage"),
|
||||
"ids": InstitutionIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class InstitutionGeo(BaseModel):
|
||||
"""
|
||||
Location information:
|
||||
""" # noqa: E501
|
||||
city: Optional[StrictStr] = None
|
||||
geonames_city_id: Optional[StrictStr] = None
|
||||
region: Optional[StrictStr] = None
|
||||
country_code: Optional[StrictStr] = None
|
||||
country: Optional[StrictStr] = None
|
||||
latitude: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
longitude: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
__properties: ClassVar[List[str]] = ["city", "geonames_city_id", "region", "country_code", "country", "latitude", "longitude"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionGeo from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionGeo from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"city": obj.get("city"),
|
||||
"geonames_city_id": obj.get("geonames_city_id"),
|
||||
"region": obj.get("region"),
|
||||
"country_code": obj.get("country_code"),
|
||||
"country": obj.get("country"),
|
||||
"latitude": obj.get("latitude"),
|
||||
"longitude": obj.get("longitude")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class InstitutionIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
ror: Optional[StrictStr] = None
|
||||
mag: Optional[StrictInt] = None
|
||||
grid: Optional[StrictStr] = None
|
||||
wikipedia: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "ror", "mag", "grid", "wikipedia", "wikidata"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"ror": obj.get("ror"),
|
||||
"mag": obj.get("mag"),
|
||||
"grid": obj.get("grid"),
|
||||
"wikipedia": obj.get("wikipedia"),
|
||||
"wikidata": obj.get("wikidata")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class InstitutionType(BaseModel):
|
||||
"""
|
||||
Type of institution
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
works_count: Optional[StrictInt] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = None
|
||||
updated_date: Optional[datetime] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionType from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionType from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.institution_type import InstitutionType
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class InstitutionTypesListResponse(BaseModel):
|
||||
"""
|
||||
InstitutionTypesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[InstitutionType]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionTypesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionTypesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [InstitutionType.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.institution import Institution
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class InstitutionsListResponse(BaseModel):
|
||||
"""
|
||||
InstitutionsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Institution]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstitutionsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Institution.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Keyword(BaseModel):
|
||||
"""
|
||||
A keyword identified from works' topics
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this keyword.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the keyword.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this keyword.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="The total citations to works tagged with this keyword.")
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = Field(default=None, description="When this keyword was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this keyword was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Keyword from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Keyword from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.keyword import Keyword
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class KeywordsListResponse(BaseModel):
|
||||
"""
|
||||
KeywordsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Keyword]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of KeywordsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of KeywordsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Keyword.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Language(BaseModel):
|
||||
"""
|
||||
Language of scholarly works
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this language (uses ISO 639-1 codes).")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the language.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works written in this language.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this language.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works in this language.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this language was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this language was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Language from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Language from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.language import Language
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class LanguagesListResponse(BaseModel):
|
||||
"""
|
||||
LanguagesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Language]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of LanguagesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of LanguagesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Language.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class License(BaseModel):
|
||||
"""
|
||||
Open access license
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
url: Optional[StrictStr] = None
|
||||
description: Optional[StrictStr] = None
|
||||
works_count: Optional[StrictInt] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = None
|
||||
updated_date: Optional[datetime] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "url", "description", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of License from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of License from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"url": obj.get("url"),
|
||||
"description": obj.get("description"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.license import License
|
||||
from inse.models.meta import Meta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class LicensesListResponse(BaseModel):
|
||||
"""
|
||||
LicensesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[License]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of LicensesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of LicensesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [License.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.list_changefiles200_response_meta import ListChangefiles200ResponseMeta
|
||||
from inse.models.list_changefiles200_response_results_inner import ListChangefiles200ResponseResultsInner
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ListChangefiles200Response(BaseModel):
|
||||
"""
|
||||
ListChangefiles200Response
|
||||
""" # noqa: E501
|
||||
meta: Optional[ListChangefiles200ResponseMeta] = None
|
||||
results: Optional[List[ListChangefiles200ResponseResultsInner]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200Response from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200Response from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": ListChangefiles200ResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [ListChangefiles200ResponseResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ListChangefiles200ResponseMeta(BaseModel):
|
||||
"""
|
||||
ListChangefiles200ResponseMeta
|
||||
""" # noqa: E501
|
||||
count: Optional[StrictInt] = Field(default=None, description="Number of available changefile dates")
|
||||
__properties: ClassVar[List[str]] = ["count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200ResponseMeta from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200ResponseMeta from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"count": obj.get("count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ListChangefiles200ResponseResultsInner(BaseModel):
|
||||
"""
|
||||
ListChangefiles200ResponseResultsInner
|
||||
""" # noqa: E501
|
||||
var_date: Optional[date] = Field(default=None, description="The changefile date (YYYY-MM-DD)", alias="date")
|
||||
url: Optional[StrictStr] = Field(default=None, description="URL to get details and download links for this date")
|
||||
__properties: ClassVar[List[str]] = ["date", "url"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200ResponseResultsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ListChangefiles200ResponseResultsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"date": obj.get("date"),
|
||||
"url": obj.get("url")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.dehydrated_source import DehydratedSource
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Location(BaseModel):
|
||||
"""
|
||||
Where a work is hosted
|
||||
""" # noqa: E501
|
||||
is_oa: Optional[StrictBool] = Field(default=None, description="Whether this location provides open access")
|
||||
landing_page_url: Optional[StrictStr] = Field(default=None, description="URL to the landing page")
|
||||
pdf_url: Optional[StrictStr] = Field(default=None, description="Direct URL to PDF")
|
||||
source: Optional[DehydratedSource] = Field(default=None, description="[Dehydrated source](/api-reference/sources#the-dehydratedsource-object)")
|
||||
license: Optional[StrictStr] = Field(default=None, description="The [license](/api-reference/licenses) (e.g., cc-by)")
|
||||
license_id: Optional[StrictStr] = None
|
||||
version: Optional[StrictStr] = Field(default=None, description="Version of the work at this location")
|
||||
is_accepted: Optional[StrictBool] = None
|
||||
is_published: Optional[StrictBool] = None
|
||||
__properties: ClassVar[List[str]] = ["is_oa", "landing_page_url", "pdf_url", "source", "license", "license_id", "version", "is_accepted", "is_published"]
|
||||
|
||||
@field_validator('version')
|
||||
def version_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['publishedVersion', 'acceptedVersion', 'submittedVersion']):
|
||||
raise ValueError("must be one of enum values ('publishedVersion', 'acceptedVersion', 'submittedVersion')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Location from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of source
|
||||
if self.source:
|
||||
_dict['source'] = self.source.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Location from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"is_oa": obj.get("is_oa"),
|
||||
"landing_page_url": obj.get("landing_page_url"),
|
||||
"pdf_url": obj.get("pdf_url"),
|
||||
"source": DehydratedSource.from_dict(obj["source"]) if obj.get("source") is not None else None,
|
||||
"license": obj.get("license"),
|
||||
"license_id": obj.get("license_id"),
|
||||
"version": obj.get("version"),
|
||||
"is_accepted": obj.get("is_accepted"),
|
||||
"is_published": obj.get("is_published")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Meta(BaseModel):
|
||||
"""
|
||||
Metadata about the query results
|
||||
""" # noqa: E501
|
||||
count: Optional[StrictInt] = Field(default=None, description="Total number of results matching the query")
|
||||
db_response_time_ms: Optional[StrictInt] = Field(default=None, description="Database response time in milliseconds")
|
||||
page: Optional[StrictInt] = Field(default=None, description="Current page number")
|
||||
per_page: Optional[StrictInt] = Field(default=None, description="Number of results per page")
|
||||
next_cursor: Optional[StrictStr] = Field(default=None, description="Cursor for the next page (when using cursor pagination)")
|
||||
groups_count: Optional[StrictInt] = Field(default=None, description="Number of groups when using group_by")
|
||||
cost_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Cost of this request in USD")
|
||||
__properties: ClassVar[List[str]] = ["count", "db_response_time_ms", "page", "per_page", "next_cursor", "groups_count", "cost_usd"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Meta from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Meta from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"count": obj.get("count"),
|
||||
"db_response_time_ms": obj.get("db_response_time_ms"),
|
||||
"page": obj.get("page"),
|
||||
"per_page": obj.get("per_page"),
|
||||
"next_cursor": obj.get("next_cursor"),
|
||||
"groups_count": obj.get("groups_count"),
|
||||
"cost_usd": obj.get("cost_usd")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.domain_fields_inner import DomainFieldsInner
|
||||
from inse.models.domain_ids import DomainIds
|
||||
from inse.models.work_topic_domain import WorkTopicDomain
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class ModelField(BaseModel):
|
||||
"""
|
||||
Second-level category in the topic hierarchy (26 total)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this field.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the field.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of this field.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this field.")
|
||||
domain: Optional[WorkTopicDomain] = None
|
||||
subfields: Optional[List[DomainFieldsInner]] = Field(default=None, description="The subfields within this field. Each object has `id` and `display_name`.")
|
||||
siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other fields at the same level. Each object has `id` and `display_name`.")
|
||||
ids: Optional[DomainIds] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this field.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this field.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this field.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this field was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this field was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "domain", "subfields", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ModelField from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of domain
|
||||
if self.domain:
|
||||
_dict['domain'] = self.domain.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in subfields (list)
|
||||
_items = []
|
||||
if self.subfields:
|
||||
for _item_subfields in self.subfields:
|
||||
if _item_subfields:
|
||||
_items.append(_item_subfields.to_dict())
|
||||
_dict['subfields'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in siblings (list)
|
||||
_items = []
|
||||
if self.siblings:
|
||||
for _item_siblings in self.siblings:
|
||||
if _item_siblings:
|
||||
_items.append(_item_siblings.to_dict())
|
||||
_dict['siblings'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ModelField from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"domain": WorkTopicDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None,
|
||||
"subfields": [DomainFieldsInner.from_dict(_item) for _item in obj["subfields"]] if obj.get("subfields") is not None else None,
|
||||
"siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None,
|
||||
"ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class OpenAccess(BaseModel):
|
||||
"""
|
||||
Open access information
|
||||
""" # noqa: E501
|
||||
is_oa: Optional[StrictBool] = Field(default=None, description="Whether this work is open access")
|
||||
oa_status: Optional[StrictStr] = Field(default=None, description="Open access status")
|
||||
oa_url: Optional[StrictStr] = Field(default=None, description="Best open access URL")
|
||||
any_repository_has_fulltext: Optional[StrictBool] = Field(default=None, description="Whether any repository has the full text")
|
||||
__properties: ClassVar[List[str]] = ["is_oa", "oa_status", "oa_url", "any_repository_has_fulltext"]
|
||||
|
||||
@field_validator('oa_status')
|
||||
def oa_status_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['diamond', 'gold', 'hybrid', 'bronze', 'green', 'closed']):
|
||||
raise ValueError("must be one of enum values ('diamond', 'gold', 'hybrid', 'bronze', 'green', 'closed')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of OpenAccess from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of OpenAccess from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"is_oa": obj.get("is_oa"),
|
||||
"oa_status": obj.get("oa_status"),
|
||||
"oa_url": obj.get("oa_url"),
|
||||
"any_repository_has_fulltext": obj.get("any_repository_has_fulltext")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.publisher_ids import PublisherIds
|
||||
from inse.models.publisher_parent_publisher import PublisherParentPublisher
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Publisher(BaseModel):
|
||||
"""
|
||||
An organization that publishes scholarly works
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this publisher.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the publisher.")
|
||||
alternate_titles: Optional[List[StrictStr]] = Field(default=None, description="Alternate titles for this publisher (including translations).")
|
||||
country_codes: Optional[List[StrictStr]] = Field(default=None, description="ISO two-letter country codes where the publisher is primarily located.")
|
||||
hierarchy_level: Optional[StrictInt] = Field(default=None, description="The hierarchy level for this publisher. Level 0 has no parent publishers.")
|
||||
parent_publisher: Optional[PublisherParentPublisher] = None
|
||||
lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs including this publisher and any parent publishers.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works published by this publisher.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works linked to this publisher.")
|
||||
sources_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all sources published by this publisher.")
|
||||
ids: Optional[PublisherIds] = None
|
||||
counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this publisher was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this publisher was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "alternate_titles", "country_codes", "hierarchy_level", "parent_publisher", "lineage", "works_count", "cited_by_count", "sources_api_url", "ids", "counts_by_year", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Publisher from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of parent_publisher
|
||||
if self.parent_publisher:
|
||||
_dict['parent_publisher'] = self.parent_publisher.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Publisher from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"alternate_titles": obj.get("alternate_titles"),
|
||||
"country_codes": obj.get("country_codes"),
|
||||
"hierarchy_level": obj.get("hierarchy_level"),
|
||||
"parent_publisher": PublisherParentPublisher.from_dict(obj["parent_publisher"]) if obj.get("parent_publisher") is not None else None,
|
||||
"lineage": obj.get("lineage"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"sources_api_url": obj.get("sources_api_url"),
|
||||
"ids": PublisherIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class PublisherIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
ror: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "ror", "wikidata"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PublisherIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PublisherIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"ror": obj.get("ror"),
|
||||
"wikidata": obj.get("wikidata")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class PublisherParentPublisher(BaseModel):
|
||||
"""
|
||||
OpenAlex ID of the direct parent publisher. Null if `hierarchy_level` is 0.
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PublisherParentPublisher from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PublisherParentPublisher from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.publisher import Publisher
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class PublishersListResponse(BaseModel):
|
||||
"""
|
||||
PublishersListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Publisher]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PublishersListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PublishersListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Publisher.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.rate_limit_response_rate_limit import RateLimitResponseRateLimit
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class RateLimitResponse(BaseModel):
|
||||
"""
|
||||
RateLimitResponse
|
||||
""" # noqa: E501
|
||||
api_key: Optional[StrictStr] = None
|
||||
rate_limit: Optional[RateLimitResponseRateLimit] = None
|
||||
__properties: ClassVar[List[str]] = ["api_key", "rate_limit"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of rate_limit
|
||||
if self.rate_limit:
|
||||
_dict['rate_limit'] = self.rate_limit.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"api_key": obj.get("api_key"),
|
||||
"rate_limit": RateLimitResponseRateLimit.from_dict(obj["rate_limit"]) if obj.get("rate_limit") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from inse.models.rate_limit_response_rate_limit_endpoint_costs_usd import RateLimitResponseRateLimitEndpointCostsUsd
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class RateLimitResponseRateLimit(BaseModel):
|
||||
"""
|
||||
RateLimitResponseRateLimit
|
||||
""" # noqa: E501
|
||||
daily_budget_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Your daily usage allowance in USD")
|
||||
daily_used_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount used today in USD")
|
||||
daily_remaining_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Remaining daily allowance in USD")
|
||||
prepaid_balance_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total prepaid balance in USD")
|
||||
prepaid_remaining_usd: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Remaining prepaid balance in USD")
|
||||
prepaid_expires_at: Optional[datetime] = Field(default=None, description="When prepaid balance expires")
|
||||
resets_at: Optional[datetime] = None
|
||||
resets_in_seconds: Optional[StrictInt] = None
|
||||
endpoint_costs_usd: Optional[RateLimitResponseRateLimitEndpointCostsUsd] = None
|
||||
credits_limit: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_budget_usd instead.")
|
||||
credits_used: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_used_usd instead.")
|
||||
credits_remaining: Optional[StrictInt] = Field(default=None, description="Deprecated. Use daily_remaining_usd instead.")
|
||||
credit_costs: Optional[Dict[str, Any]] = Field(default=None, description="Deprecated. Use endpoint_costs_usd instead.")
|
||||
__properties: ClassVar[List[str]] = ["daily_budget_usd", "daily_used_usd", "daily_remaining_usd", "prepaid_balance_usd", "prepaid_remaining_usd", "prepaid_expires_at", "resets_at", "resets_in_seconds", "endpoint_costs_usd", "credits_limit", "credits_used", "credits_remaining", "credit_costs"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponseRateLimit from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of endpoint_costs_usd
|
||||
if self.endpoint_costs_usd:
|
||||
_dict['endpoint_costs_usd'] = self.endpoint_costs_usd.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponseRateLimit from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"daily_budget_usd": obj.get("daily_budget_usd"),
|
||||
"daily_used_usd": obj.get("daily_used_usd"),
|
||||
"daily_remaining_usd": obj.get("daily_remaining_usd"),
|
||||
"prepaid_balance_usd": obj.get("prepaid_balance_usd"),
|
||||
"prepaid_remaining_usd": obj.get("prepaid_remaining_usd"),
|
||||
"prepaid_expires_at": obj.get("prepaid_expires_at"),
|
||||
"resets_at": obj.get("resets_at"),
|
||||
"resets_in_seconds": obj.get("resets_in_seconds"),
|
||||
"endpoint_costs_usd": RateLimitResponseRateLimitEndpointCostsUsd.from_dict(obj["endpoint_costs_usd"]) if obj.get("endpoint_costs_usd") is not None else None,
|
||||
"credits_limit": obj.get("credits_limit"),
|
||||
"credits_used": obj.get("credits_used"),
|
||||
"credits_remaining": obj.get("credits_remaining"),
|
||||
"credit_costs": obj.get("credit_costs")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class RateLimitResponseRateLimitEndpointCostsUsd(BaseModel):
|
||||
"""
|
||||
Cost per request in USD for each endpoint type
|
||||
""" # noqa: E501
|
||||
singleton: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
list: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
search: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
content: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
semantic: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
text: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
__properties: ClassVar[List[str]] = ["singleton", "list", "search", "content", "semantic", "text"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponseRateLimitEndpointCostsUsd from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RateLimitResponseRateLimitEndpointCostsUsd from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"singleton": obj.get("singleton"),
|
||||
"list": obj.get("list"),
|
||||
"search": obj.get("search"),
|
||||
"content": obj.get("content"),
|
||||
"semantic": obj.get("semantic"),
|
||||
"text": obj.get("text")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.sdg_ids import SdgIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Sdg(BaseModel):
|
||||
"""
|
||||
UN Sustainable Development Goal (17 total)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this SDG.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the SDG.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="The official UN description of this goal.")
|
||||
ids: Optional[SdgIds] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this SDG.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works tagged with this SDG.")
|
||||
image_url: Optional[StrictStr] = Field(default=None, description="URL to the official SDG icon image.")
|
||||
image_thumbnail_url: Optional[StrictStr] = Field(default=None, description="Smaller version of `image_url`.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this SDG.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this SDG was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this SDG was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "ids", "works_count", "cited_by_count", "image_url", "image_thumbnail_url", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Sdg from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Sdg from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"ids": SdgIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"image_url": obj.get("image_url"),
|
||||
"image_thumbnail_url": obj.get("image_thumbnail_url"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SdgIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
un: Optional[StrictStr] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "un", "wikidata"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SdgIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SdgIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"un": obj.get("un"),
|
||||
"wikidata": obj.get("wikidata")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.sdg import Sdg
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SdgsListResponse(BaseModel):
|
||||
"""
|
||||
SdgsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Sdg]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SdgsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SdgsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Sdg.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.author_summary_stats import AuthorSummaryStats
|
||||
from inse.models.source_ids import SourceIds
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Source(BaseModel):
|
||||
"""
|
||||
A journal, repository, or other venue for scholarly works
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this source.")
|
||||
issn_l: Optional[StrictStr] = Field(default=None, description="The ISSN-L (linking ISSN) for this source. This is the Canonical External ID for sources.")
|
||||
issn: Optional[List[StrictStr]] = Field(default=None, description="All ISSNs used by this source. Many publications have multiple ISSNs.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The name of the source.")
|
||||
type: Optional[StrictStr] = Field(default=None, description="The type of source: `journal`, `repository`, `conference`, `ebook platform`, `book series`, `metadata`, or `other`.")
|
||||
host_organization: Optional[StrictStr] = Field(default=None, description="The host organization as an OpenAlex ID. This will be an Institution ID if the source is a repository, or a Publisher ID if it's a journal/conference.")
|
||||
host_organization_name: Optional[StrictStr] = Field(default=None, description="The display_name of the host organization.")
|
||||
host_organization_lineage: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs of parent publishers (only for publisher-hosted sources).")
|
||||
is_oa: Optional[StrictBool] = Field(default=None, description="Whether this is currently a fully open-access source.")
|
||||
is_in_doaj: Optional[StrictBool] = Field(default=None, description="Whether this journal is listed in the Directory of Open Access Journals.")
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works this source hosts.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works hosted in this source.")
|
||||
summary_stats: Optional[AuthorSummaryStats] = None
|
||||
apc_usd: Optional[StrictInt] = Field(default=None, description="The source's article processing charge in USD.")
|
||||
homepage_url: Optional[StrictStr] = Field(default=None, description="The homepage URL for this source.")
|
||||
ids: Optional[SourceIds] = None
|
||||
counts_by_year: Optional[List[AuthorCountsByYearInner]] = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that will get you a list of all this source's works.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this source was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this source was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "issn_l", "issn", "display_name", "type", "host_organization", "host_organization_name", "host_organization_lineage", "is_oa", "is_in_doaj", "works_count", "cited_by_count", "summary_stats", "apc_usd", "homepage_url", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['journal', 'repository', 'conference', 'ebook platform', 'book series']):
|
||||
raise ValueError("must be one of enum values ('journal', 'repository', 'conference', 'ebook platform', 'book series')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Source from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of summary_stats
|
||||
if self.summary_stats:
|
||||
_dict['summary_stats'] = self.summary_stats.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Source from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"issn_l": obj.get("issn_l"),
|
||||
"issn": obj.get("issn"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"type": obj.get("type"),
|
||||
"host_organization": obj.get("host_organization"),
|
||||
"host_organization_name": obj.get("host_organization_name"),
|
||||
"host_organization_lineage": obj.get("host_organization_lineage"),
|
||||
"is_oa": obj.get("is_oa"),
|
||||
"is_in_doaj": obj.get("is_in_doaj"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"summary_stats": AuthorSummaryStats.from_dict(obj["summary_stats"]) if obj.get("summary_stats") is not None else None,
|
||||
"apc_usd": obj.get("apc_usd"),
|
||||
"homepage_url": obj.get("homepage_url"),
|
||||
"ids": SourceIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SourceIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
issn_l: Optional[StrictStr] = None
|
||||
issn: Optional[List[StrictStr]] = None
|
||||
mag: Optional[StrictInt] = None
|
||||
wikidata: Optional[StrictStr] = None
|
||||
fatcat: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "issn_l", "issn", "mag", "wikidata", "fatcat"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SourceIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SourceIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"issn_l": obj.get("issn_l"),
|
||||
"issn": obj.get("issn"),
|
||||
"mag": obj.get("mag"),
|
||||
"wikidata": obj.get("wikidata"),
|
||||
"fatcat": obj.get("fatcat")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SourceType(BaseModel):
|
||||
"""
|
||||
Type of source
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
works_count: Optional[StrictInt] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = None
|
||||
updated_date: Optional[datetime] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SourceType from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SourceType from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.source_type import SourceType
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SourceTypesListResponse(BaseModel):
|
||||
"""
|
||||
SourceTypesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[SourceType]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SourceTypesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SourceTypesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [SourceType.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.source import Source
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SourcesListResponse(BaseModel):
|
||||
"""
|
||||
SourcesListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Source]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SourcesListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SourcesListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Source.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.domain_fields_inner import DomainFieldsInner
|
||||
from inse.models.domain_ids import DomainIds
|
||||
from inse.models.subfield_domain import SubfieldDomain
|
||||
from inse.models.subfield_field import SubfieldField
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Subfield(BaseModel):
|
||||
"""
|
||||
Third-level category in the topic hierarchy (254 total)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this subfield.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the subfield.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of this subfield.")
|
||||
display_name_alternatives: Optional[List[StrictStr]] = Field(default=None, description="Alternate names for this subfield.")
|
||||
var_field: Optional[SubfieldField] = Field(default=None, alias="field")
|
||||
domain: Optional[SubfieldDomain] = None
|
||||
topics: Optional[List[DomainFieldsInner]] = Field(default=None, description="The topics within this subfield. Each object has `id` and `display_name`.")
|
||||
siblings: Optional[List[DomainFieldsInner]] = Field(default=None, description="Other subfields at the same level (across all fields). Each object has `id` and `display_name`.")
|
||||
ids: Optional[DomainIds] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with topics in this subfield.")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="Total citations to works in this subfield.")
|
||||
works_api_url: Optional[StrictStr] = Field(default=None, description="A URL that returns all works tagged with this subfield.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this subfield was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this subfield was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "display_name_alternatives", "field", "domain", "topics", "siblings", "ids", "works_count", "cited_by_count", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Subfield from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of var_field
|
||||
if self.var_field:
|
||||
_dict['field'] = self.var_field.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of domain
|
||||
if self.domain:
|
||||
_dict['domain'] = self.domain.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in topics (list)
|
||||
_items = []
|
||||
if self.topics:
|
||||
for _item_topics in self.topics:
|
||||
if _item_topics:
|
||||
_items.append(_item_topics.to_dict())
|
||||
_dict['topics'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in siblings (list)
|
||||
_items = []
|
||||
if self.siblings:
|
||||
for _item_siblings in self.siblings:
|
||||
if _item_siblings:
|
||||
_items.append(_item_siblings.to_dict())
|
||||
_dict['siblings'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Subfield from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"display_name_alternatives": obj.get("display_name_alternatives"),
|
||||
"field": SubfieldField.from_dict(obj["field"]) if obj.get("field") is not None else None,
|
||||
"domain": SubfieldDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None,
|
||||
"topics": [DomainFieldsInner.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None,
|
||||
"siblings": [DomainFieldsInner.from_dict(_item) for _item in obj["siblings"]] if obj.get("siblings") is not None else None,
|
||||
"ids": DomainIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SubfieldDomain(BaseModel):
|
||||
"""
|
||||
The domain containing this subfield (top level of hierarchy).
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldDomain from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldDomain from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SubfieldField(BaseModel):
|
||||
"""
|
||||
The field containing this subfield (parent level).
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldField from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldField from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.subfield import Subfield
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class SubfieldsListResponse(BaseModel):
|
||||
"""
|
||||
SubfieldsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Subfield]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SubfieldsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Subfield.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.text_classification_response_meta import TextClassificationResponseMeta
|
||||
from inse.models.work_topic import WorkTopic
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TextClassificationResponse(BaseModel):
|
||||
"""
|
||||
TextClassificationResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[TextClassificationResponseMeta] = None
|
||||
results: Optional[List[WorkTopic]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TextClassificationResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TextClassificationResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": TextClassificationResponseMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [WorkTopic.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TextClassificationResponseMeta(BaseModel):
|
||||
"""
|
||||
TextClassificationResponseMeta
|
||||
""" # noqa: E501
|
||||
count: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TextClassificationResponseMeta from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TextClassificationResponseMeta from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"count": obj.get("count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.topic_domain import TopicDomain
|
||||
from inse.models.topic_field import TopicField
|
||||
from inse.models.topic_ids import TopicIds
|
||||
from inse.models.topic_subfield import TopicSubfield
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Topic(BaseModel):
|
||||
"""
|
||||
A research topic automatically assigned to works
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this topic.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="The English-language label of the topic.")
|
||||
description: Optional[StrictStr] = Field(default=None, description="A description of this topic, generated by AI.")
|
||||
keywords: Optional[List[StrictStr]] = Field(default=None, description="Keywords representing the content of papers in the topic.")
|
||||
subfield: Optional[TopicSubfield] = None
|
||||
var_field: Optional[TopicField] = Field(default=None, alias="field")
|
||||
domain: Optional[TopicDomain] = None
|
||||
works_count: Optional[StrictInt] = Field(default=None, description="The number of works tagged with this topic.")
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
ids: Optional[TopicIds] = None
|
||||
works_api_url: Optional[StrictStr] = None
|
||||
created_date: Optional[date] = None
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this topic was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name", "description", "keywords", "subfield", "field", "domain", "works_count", "cited_by_count", "ids", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Topic from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of subfield
|
||||
if self.subfield:
|
||||
_dict['subfield'] = self.subfield.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of var_field
|
||||
if self.var_field:
|
||||
_dict['field'] = self.var_field.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of domain
|
||||
if self.domain:
|
||||
_dict['domain'] = self.domain.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Topic from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"description": obj.get("description"),
|
||||
"keywords": obj.get("keywords"),
|
||||
"subfield": TopicSubfield.from_dict(obj["subfield"]) if obj.get("subfield") is not None else None,
|
||||
"field": TopicField.from_dict(obj["field"]) if obj.get("field") is not None else None,
|
||||
"domain": TopicDomain.from_dict(obj["domain"]) if obj.get("domain") is not None else None,
|
||||
"works_count": obj.get("works_count"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"ids": TopicIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TopicDomain(BaseModel):
|
||||
"""
|
||||
The domain (highest level) containing this topic:
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TopicDomain from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TopicDomain from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TopicField(BaseModel):
|
||||
"""
|
||||
The field (second level) containing this topic:
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TopicField from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TopicField from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TopicIds(BaseModel):
|
||||
"""
|
||||
External identifiers:
|
||||
""" # noqa: E501
|
||||
openalex: Optional[StrictStr] = None
|
||||
wikipedia: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["openalex", "wikipedia"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TopicIds from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TopicIds from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"openalex": obj.get("openalex"),
|
||||
"wikipedia": obj.get("wikipedia")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TopicSubfield(BaseModel):
|
||||
"""
|
||||
The subfield (third level) containing this topic:
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = None
|
||||
display_name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "display_name"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TopicSubfield from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TopicSubfield from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"display_name": obj.get("display_name")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from inse.models.group_by_result import GroupByResult
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.topic import Topic
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class TopicsListResponse(BaseModel):
|
||||
"""
|
||||
TopicsListResponse
|
||||
""" # noqa: E501
|
||||
meta: Optional[Meta] = None
|
||||
results: Optional[List[Topic]] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
__properties: ClassVar[List[str]] = ["meta", "results", "group_by"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of TopicsListResponse from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of meta
|
||||
if self.meta:
|
||||
_dict['meta'] = self.meta.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
||||
_items = []
|
||||
if self.results:
|
||||
for _item_results in self.results:
|
||||
if _item_results:
|
||||
_items.append(_item_results.to_dict())
|
||||
_dict['results'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in group_by (list)
|
||||
_items = []
|
||||
if self.group_by:
|
||||
for _item_group_by in self.group_by:
|
||||
if _item_group_by:
|
||||
_items.append(_item_group_by.to_dict())
|
||||
_dict['group_by'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of TopicsListResponse from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"meta": Meta.from_dict(obj["meta"]) if obj.get("meta") is not None else None,
|
||||
"results": [Topic.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
||||
"group_by": [GroupByResult.from_dict(_item) for _item in obj["group_by"]] if obj.get("group_by") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import date, datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from inse.models.authorship import Authorship
|
||||
from inse.models.award import Award
|
||||
from inse.models.dehydrated_funder import DehydratedFunder
|
||||
from inse.models.location import Location
|
||||
from inse.models.open_access import OpenAccess
|
||||
from inse.models.work_biblio import WorkBiblio
|
||||
from inse.models.work_citation_normalized_percentile import WorkCitationNormalizedPercentile
|
||||
from inse.models.work_cited_by_percentile_year import WorkCitedByPercentileYear
|
||||
from inse.models.work_counts_by_year_inner import WorkCountsByYearInner
|
||||
from inse.models.work_has_content import WorkHasContent
|
||||
from inse.models.work_ids import WorkIds
|
||||
from inse.models.work_keyword import WorkKeyword
|
||||
from inse.models.work_mesh_inner import WorkMeshInner
|
||||
from inse.models.work_sustainable_development_goals_inner import WorkSustainableDevelopmentGoalsInner
|
||||
from inse.models.work_topic import WorkTopic
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class Work(BaseModel):
|
||||
"""
|
||||
A scholarly document (article, book, dataset, thesis, etc.)
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this work.")
|
||||
doi: Optional[StrictStr] = Field(default=None, description="The DOI for the work. This is the Canonical External ID for works.")
|
||||
title: Optional[StrictStr] = Field(default=None, description="The title of this work.")
|
||||
display_name: Optional[StrictStr] = Field(default=None, description="Same as `title`. Included for consistency with other entities.")
|
||||
publication_year: Optional[StrictInt] = Field(default=None, description="The year this work was published.")
|
||||
publication_date: Optional[date] = Field(default=None, description="The day when this work was published (ISO 8601 format).")
|
||||
type: Optional[StrictStr] = Field(default=None, description="The type of the work. Common values: `article`, `book`, `dataset`, `preprint`, `dissertation`, `book-chapter`.")
|
||||
language: Optional[StrictStr] = Field(default=None, description="[Language](/api-reference/languages) in ISO 639-1 format")
|
||||
cited_by_count: Optional[StrictInt] = Field(default=None, description="The number of citations to this work.")
|
||||
is_retracted: Optional[StrictBool] = Field(default=None, description="True if this work has been retracted (from Retraction Watch database).")
|
||||
is_paratext: Optional[StrictBool] = Field(default=None, description="True if this work is paratext (e.g., front cover, table of contents).")
|
||||
primary_location: Optional[Location] = Field(default=None, description="A Location object with the primary location of this work (closest to the version of record). Includes `source`, `landing_page_url`, `pdf_url`, `is_oa`, `license`, and `version`.")
|
||||
locations: Optional[List[Location]] = Field(default=None, description="List of Location objects describing all unique places where this work lives.")
|
||||
best_oa_location: Optional[Location] = Field(default=None, description="A Location object with the best available open access location for this work.")
|
||||
open_access: Optional[OpenAccess] = Field(default=None, description="Information about the access status of this work:")
|
||||
authorships: Optional[List[Authorship]] = Field(default=None, description="List of Authorship objects representing authors and their institutions. Limited to the first 100 authors. Each authorship includes `author`, `institutions`, `author_position`, `is_corresponding`, and other fields.")
|
||||
ids: Optional[WorkIds] = None
|
||||
biblio: Optional[WorkBiblio] = None
|
||||
abstract_inverted_index: Optional[Dict[str, Any]] = Field(default=None, description="The abstract as an inverted index (word positions). OpenAlex doesn't include plaintext abstracts due to legal constraints. Use the `has_abstract` filter to get works with or without abstracts.")
|
||||
referenced_works: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs for works that this work cites.")
|
||||
referenced_works_count: Optional[StrictInt] = Field(default=None, description="The number of works that this work cites.")
|
||||
related_works: Optional[List[StrictStr]] = Field(default=None, description="OpenAlex IDs for works related to this work (computed algorithmically).")
|
||||
topics: Optional[List[WorkTopic]] = Field(default=None, description="List of up to 3 Topics for this work, each with a relevance score.")
|
||||
primary_topic: Optional[WorkTopic] = Field(default=None, description="The top ranked Topic for this work, with `id`, `display_name`, `score`, and hierarchy (`subfield`, `field`, `domain`).")
|
||||
keywords: Optional[List[WorkKeyword]] = Field(default=None, description="Keywords identified based on the work's topics, with relevance scores.")
|
||||
funders: Optional[List[DehydratedFunder]] = Field(default=None, description="Dehydrated Funder objects representing the funders of this work.")
|
||||
awards: Optional[List[Award]] = Field(default=None, description="Dehydrated Award objects representing grants associated with this work.")
|
||||
fwci: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Field-weighted Citation Impact, calculated as citations received / citations expected.")
|
||||
citation_normalized_percentile: Optional[WorkCitationNormalizedPercentile] = None
|
||||
cited_by_percentile_year: Optional[WorkCitedByPercentileYear] = None
|
||||
counts_by_year: Optional[List[WorkCountsByYearInner]] = Field(default=None, description="`cited_by_count` for each of the last ten years.")
|
||||
sustainable_development_goals: Optional[List[WorkSustainableDevelopmentGoalsInner]] = Field(default=None, description="UN Sustainable Development Goals relevant to this work, with prediction scores.")
|
||||
mesh: Optional[List[WorkMeshInner]] = Field(default=None, description="MeSH tags for works found in PubMed.")
|
||||
indexed_in: Optional[List[StrictStr]] = Field(default=None, description="Sources this work is indexed in. Values: `arxiv`, `crossref`, `doaj`, `pubmed`.")
|
||||
has_content: Optional[WorkHasContent] = None
|
||||
content_url: Optional[StrictStr] = Field(default=None, description="URL for downloading full-text content. Only present when `has_content.pdf` or `has_content.grobid_xml` is true.")
|
||||
created_date: Optional[date] = Field(default=None, description="When this work was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this work was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "doi", "title", "display_name", "publication_year", "publication_date", "type", "language", "cited_by_count", "is_retracted", "is_paratext", "primary_location", "locations", "best_oa_location", "open_access", "authorships", "ids", "biblio", "abstract_inverted_index", "referenced_works", "referenced_works_count", "related_works", "topics", "primary_topic", "keywords", "funders", "awards", "fwci", "citation_normalized_percentile", "cited_by_percentile_year", "counts_by_year", "sustainable_development_goals", "mesh", "indexed_in", "has_content", "content_url", "created_date", "updated_date"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Work from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of primary_location
|
||||
if self.primary_location:
|
||||
_dict['primary_location'] = self.primary_location.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in locations (list)
|
||||
_items = []
|
||||
if self.locations:
|
||||
for _item_locations in self.locations:
|
||||
if _item_locations:
|
||||
_items.append(_item_locations.to_dict())
|
||||
_dict['locations'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of best_oa_location
|
||||
if self.best_oa_location:
|
||||
_dict['best_oa_location'] = self.best_oa_location.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of open_access
|
||||
if self.open_access:
|
||||
_dict['open_access'] = self.open_access.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in authorships (list)
|
||||
_items = []
|
||||
if self.authorships:
|
||||
for _item_authorships in self.authorships:
|
||||
if _item_authorships:
|
||||
_items.append(_item_authorships.to_dict())
|
||||
_dict['authorships'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of ids
|
||||
if self.ids:
|
||||
_dict['ids'] = self.ids.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of biblio
|
||||
if self.biblio:
|
||||
_dict['biblio'] = self.biblio.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in topics (list)
|
||||
_items = []
|
||||
if self.topics:
|
||||
for _item_topics in self.topics:
|
||||
if _item_topics:
|
||||
_items.append(_item_topics.to_dict())
|
||||
_dict['topics'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of primary_topic
|
||||
if self.primary_topic:
|
||||
_dict['primary_topic'] = self.primary_topic.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in keywords (list)
|
||||
_items = []
|
||||
if self.keywords:
|
||||
for _item_keywords in self.keywords:
|
||||
if _item_keywords:
|
||||
_items.append(_item_keywords.to_dict())
|
||||
_dict['keywords'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in funders (list)
|
||||
_items = []
|
||||
if self.funders:
|
||||
for _item_funders in self.funders:
|
||||
if _item_funders:
|
||||
_items.append(_item_funders.to_dict())
|
||||
_dict['funders'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in awards (list)
|
||||
_items = []
|
||||
if self.awards:
|
||||
for _item_awards in self.awards:
|
||||
if _item_awards:
|
||||
_items.append(_item_awards.to_dict())
|
||||
_dict['awards'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of citation_normalized_percentile
|
||||
if self.citation_normalized_percentile:
|
||||
_dict['citation_normalized_percentile'] = self.citation_normalized_percentile.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of cited_by_percentile_year
|
||||
if self.cited_by_percentile_year:
|
||||
_dict['cited_by_percentile_year'] = self.cited_by_percentile_year.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in counts_by_year (list)
|
||||
_items = []
|
||||
if self.counts_by_year:
|
||||
for _item_counts_by_year in self.counts_by_year:
|
||||
if _item_counts_by_year:
|
||||
_items.append(_item_counts_by_year.to_dict())
|
||||
_dict['counts_by_year'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in sustainable_development_goals (list)
|
||||
_items = []
|
||||
if self.sustainable_development_goals:
|
||||
for _item_sustainable_development_goals in self.sustainable_development_goals:
|
||||
if _item_sustainable_development_goals:
|
||||
_items.append(_item_sustainable_development_goals.to_dict())
|
||||
_dict['sustainable_development_goals'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in mesh (list)
|
||||
_items = []
|
||||
if self.mesh:
|
||||
for _item_mesh in self.mesh:
|
||||
if _item_mesh:
|
||||
_items.append(_item_mesh.to_dict())
|
||||
_dict['mesh'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of has_content
|
||||
if self.has_content:
|
||||
_dict['has_content'] = self.has_content.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Work from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"doi": obj.get("doi"),
|
||||
"title": obj.get("title"),
|
||||
"display_name": obj.get("display_name"),
|
||||
"publication_year": obj.get("publication_year"),
|
||||
"publication_date": obj.get("publication_date"),
|
||||
"type": obj.get("type"),
|
||||
"language": obj.get("language"),
|
||||
"cited_by_count": obj.get("cited_by_count"),
|
||||
"is_retracted": obj.get("is_retracted"),
|
||||
"is_paratext": obj.get("is_paratext"),
|
||||
"primary_location": Location.from_dict(obj["primary_location"]) if obj.get("primary_location") is not None else None,
|
||||
"locations": [Location.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
|
||||
"best_oa_location": Location.from_dict(obj["best_oa_location"]) if obj.get("best_oa_location") is not None else None,
|
||||
"open_access": OpenAccess.from_dict(obj["open_access"]) if obj.get("open_access") is not None else None,
|
||||
"authorships": [Authorship.from_dict(_item) for _item in obj["authorships"]] if obj.get("authorships") is not None else None,
|
||||
"ids": WorkIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"biblio": WorkBiblio.from_dict(obj["biblio"]) if obj.get("biblio") is not None else None,
|
||||
"abstract_inverted_index": obj.get("abstract_inverted_index"),
|
||||
"referenced_works": obj.get("referenced_works"),
|
||||
"related_works": obj.get("related_works"),
|
||||
"topics": [WorkTopic.from_dict(_item) for _item in obj["topics"]] if obj.get("topics") is not None else None,
|
||||
"primary_topic": WorkTopic.from_dict(obj["primary_topic"]) if obj.get("primary_topic") is not None else None,
|
||||
"keywords": [WorkKeyword.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None,
|
||||
"funders": [DehydratedFunder.from_dict(_item) for _item in obj["funders"]] if obj.get("funders") is not None else None,
|
||||
"awards": [Award.from_dict(_item) for _item in obj["awards"]] if obj.get("awards") is not None else None,
|
||||
"fwci": obj.get("fwci"),
|
||||
"citation_normalized_percentile": WorkCitationNormalizedPercentile.from_dict(obj["citation_normalized_percentile"]) if obj.get("citation_normalized_percentile") is not None else None,
|
||||
"cited_by_percentile_year": WorkCitedByPercentileYear.from_dict(obj["cited_by_percentile_year"]) if obj.get("cited_by_percentile_year") is not None else None,
|
||||
"counts_by_year": [WorkCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"sustainable_development_goals": [WorkSustainableDevelopmentGoalsInner.from_dict(_item) for _item in obj["sustainable_development_goals"]] if obj.get("sustainable_development_goals") is not None else None,
|
||||
"mesh": [WorkMeshInner.from_dict(_item) for _item in obj["mesh"]] if obj.get("mesh") is not None else None,
|
||||
"indexed_in": obj.get("indexed_in"),
|
||||
"has_content": WorkHasContent.from_dict(obj["has_content"]) if obj.get("has_content") is not None else None,
|
||||
"content_url": obj.get("content_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class WorkBiblio(BaseModel):
|
||||
"""
|
||||
Bibliographic info: `volume`, `issue`, `first_page`, `last_page`.
|
||||
""" # noqa: E501
|
||||
volume: Optional[StrictStr] = None
|
||||
issue: Optional[StrictStr] = None
|
||||
first_page: Optional[StrictStr] = None
|
||||
last_page: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["volume", "issue", "first_page", "last_page"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of WorkBiblio from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of WorkBiblio from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"volume": obj.get("volume"),
|
||||
"issue": obj.get("issue"),
|
||||
"first_page": obj.get("first_page"),
|
||||
"last_page": obj.get("last_page")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictBool, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class WorkCitationNormalizedPercentile(BaseModel):
|
||||
"""
|
||||
Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`.
|
||||
""" # noqa: E501
|
||||
value: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
is_in_top_1_percent: Optional[StrictBool] = None
|
||||
is_in_top_10_percent: Optional[StrictBool] = None
|
||||
__properties: ClassVar[List[str]] = ["value", "is_in_top_1_percent", "is_in_top_10_percent"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of WorkCitationNormalizedPercentile from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of WorkCitationNormalizedPercentile from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"value": obj.get("value"),
|
||||
"is_in_top_1_percent": obj.get("is_in_top_1_percent"),
|
||||
"is_in_top_10_percent": obj.get("is_in_top_10_percent")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class WorkCitedByPercentileYear(BaseModel):
|
||||
"""
|
||||
Percentile rank compared to other works published in the same year. Contains `min` and `max`.
|
||||
""" # noqa: E501
|
||||
min: Optional[StrictInt] = None
|
||||
max: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["min", "max"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of WorkCitedByPercentileYear from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of WorkCitedByPercentileYear from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"min": obj.get("min"),
|
||||
"max": obj.get("max")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAlex API
|
||||
|
||||
The OpenAlex API provides access to a comprehensive catalog of scholarly works, authors, sources, institutions, topics, keywords, publishers, and funders. OpenAlex indexes over 250 million scholarly works.
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Contact: support@openalex.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
|
||||
class WorkCountsByYearInner(BaseModel):
|
||||
"""
|
||||
WorkCountsByYearInner
|
||||
""" # noqa: E501
|
||||
year: Optional[StrictInt] = None
|
||||
cited_by_count: Optional[StrictInt] = None
|
||||
__properties: ClassVar[List[str]] = ["year", "cited_by_count"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
validate_by_alias=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(to_jsonable_python(self.to_dict()))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of WorkCountsByYearInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of WorkCountsByYearInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"year": obj.get("year"),
|
||||
"cited_by_count": obj.get("cited_by_count")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user