From 68bcbf1e6e5862cd11a1c5065417d358ef75d6b9 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 13:58:40 -0700 Subject: codegen python with core_id --- python/fatcat_client/models/release_entity.py | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/fatcat_client/models/release_entity.py b/python/fatcat_client/models/release_entity.py index 3412ca92..79e2c64f 100644 --- a/python/fatcat_client/models/release_entity.py +++ b/python/fatcat_client/models/release_entity.py @@ -48,6 +48,7 @@ class ReleaseEntity(object): 'wikidata_qid': 'str', 'pmcid': 'str', 'pmid': 'str', + 'core_id': 'str', 'isbn13': 'str', 'doi': 'str', 'release_date': 'date', @@ -78,6 +79,7 @@ class ReleaseEntity(object): 'wikidata_qid': 'wikidata_qid', 'pmcid': 'pmcid', 'pmid': 'pmid', + 'core_id': 'core_id', 'isbn13': 'isbn13', 'doi': 'doi', 'release_date': 'release_date', @@ -96,7 +98,7 @@ class ReleaseEntity(object): 'extra': 'extra' } - def __init__(self, abstracts=None, refs=None, contribs=None, language=None, publisher=None, pages=None, issue=None, volume=None, wikidata_qid=None, pmcid=None, pmid=None, isbn13=None, doi=None, release_date=None, release_status=None, release_type=None, container_id=None, files=None, container=None, work_id=None, title=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 + def __init__(self, abstracts=None, refs=None, contribs=None, language=None, publisher=None, pages=None, issue=None, volume=None, wikidata_qid=None, pmcid=None, pmid=None, core_id=None, isbn13=None, doi=None, release_date=None, release_status=None, release_type=None, container_id=None, files=None, container=None, work_id=None, title=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 """ReleaseEntity - a model defined in Swagger""" # noqa: E501 self._abstracts = None @@ -110,6 +112,7 @@ class ReleaseEntity(object): self._wikidata_qid = None self._pmcid = None self._pmid = None + self._core_id = None self._isbn13 = None self._doi = None self._release_date = None @@ -150,6 +153,8 @@ class ReleaseEntity(object): self.pmcid = pmcid if pmid is not None: self.pmid = pmid + if core_id is not None: + self.core_id = core_id if isbn13 is not None: self.isbn13 = isbn13 if doi is not None: @@ -415,6 +420,27 @@ class ReleaseEntity(object): self._pmid = pmid + @property + def core_id(self): + """Gets the core_id of this ReleaseEntity. # noqa: E501 + + + :return: The core_id of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._core_id + + @core_id.setter + def core_id(self, core_id): + """Sets the core_id of this ReleaseEntity. + + + :param core_id: The core_id of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._core_id = core_id + @property def isbn13(self): """Gets the isbn13 of this ReleaseEntity. # noqa: E501 -- cgit v1.2.3 From 9b202b026fc886d0e068656fe8cbcc1d2091c318 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 16:44:20 -0700 Subject: monkey patch broken release_view --- python/fatcat/templates/release_view.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html index dd92f611..9be312e1 100644 --- a/python/fatcat/templates/release_view.html +++ b/python/fatcat/templates/release_view.html @@ -147,11 +147,11 @@ Believed to represent this release... This release citing other releases.
    {% for ref in release.refs %} -
  1. {% if ref.extra != None %}{{ ref.extra }}{% else %}unknown{% endif %} +
  2. {% if ref.extra != None and ref.extra.unstructured != None %}{{ ref.extra.unstructured }}{% else %}unknown{% endif %} {% if ref.target_release_id != None %} (fatcat release) - {% elif ref.extra != None and ref.extra.doi != None %} - (DOI: {{ ref.extra.doi }}) +{# {% elif ref.extra != None and ref.extra.doi != None %} + (DOI: {{ ref.extra.get('doi') }}) #} {% endif %} {% endfor %}
-- cgit v1.2.3 From 18821fcbfa9eb38ee0fb0b065d6642b461fed021 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 19:03:31 -0700 Subject: compact file html table --- python/fatcat/templates/file_view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') diff --git a/python/fatcat/templates/file_view.html b/python/fatcat/templates/file_view.html index 2934224d..febc2b19 100644 --- a/python/fatcat/templates/file_view.html +++ b/python/fatcat/templates/file_view.html @@ -45,7 +45,7 @@ No known public URL, mirror, or archive for this file. {% endif %}

Checksums

- +
Algorithm Value -- cgit v1.2.3 From 4c11f65f202ef8f71bfd640232ed30ccd6f4c3a4 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 21:47:00 -0700 Subject: improve handling of invalid identifiers --- python/fatcat/importer_common.py | 17 ++++++++++++++--- python/fatcat/orcid_importer.py | 7 +++++-- python/tests/files/0000-0001-8254-710X.json | 1 + .../files/crossref-works.2018-01-21.badsample.json | 1 + python/tests/importer.py | 20 ++++++++++++++++++++ python/tests/orcid.py | 4 ++++ 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 python/tests/files/0000-0001-8254-710X.json (limited to 'python') diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py index 9d495aa7..e084d8c4 100644 --- a/python/fatcat/importer_common.py +++ b/python/fatcat/importer_common.py @@ -1,4 +1,5 @@ +import re import sys import csv import json @@ -22,6 +23,7 @@ class FatcatImporter: self._orcid_id_map = dict() self._doi_id_map = dict() self._issn_issnl_map = None + self._orcid_regex = re.compile("^\\d{4}-\\d{4}-\\d{4}-\\d{4}$") if issn_map_file: self.read_issn_map_file(issn_map_file) @@ -54,9 +56,11 @@ class FatcatImporter: reader = csv.DictReader(source, delimiter=delimiter) self.process_batch(reader, size) + def is_issnl(self, issnl): + return len(issnl) == 9 and issnl[4] == '-' + def lookup_issnl(self, issnl): """Caches calls to the ISSN-L lookup API endpoint in a local dict""" - assert len(issnl) == 9 and issnl[4] == '-' if issnl in self._issnl_id_map: return self._issnl_id_map[issnl] container_id = None @@ -69,9 +73,13 @@ class FatcatImporter: self._issnl_id_map[issnl] = container_id # might be None return container_id + def is_orcid(self, orcid): + return self._orcid_regex.match(orcid) != None + def lookup_orcid(self, orcid): """Caches calls to the Orcid lookup API endpoint in a local dict""" - assert len(orcid) == 19 and orcid[4] == '-' + if not self.is_orcid(orcid): + return None if orcid in self._orcid_id_map: return self._orcid_id_map[orcid] creator_id = None @@ -84,9 +92,12 @@ class FatcatImporter: self._orcid_id_map[orcid] = creator_id # might be None return creator_id + def is_doi(self, doi): + return doi.startswith("10.") and doi.count("/") >= 1 + def lookup_doi(self, doi): """Caches calls to the doi lookup API endpoint in a local dict""" - assert doi.startswith('10.') + assert self.is_doi(doi) doi = doi.lower() if doi in self._doi_id_map: return self._doi_id_map[doi] diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py index 69b184d5..e57703d5 100644 --- a/python/fatcat/orcid_importer.py +++ b/python/fatcat/orcid_importer.py @@ -5,7 +5,6 @@ import itertools import fatcat_client from fatcat.importer_common import FatcatImporter - def value_or_none(e): if type(e) == dict: e = e.get('value') @@ -46,8 +45,12 @@ class FatcatOrcidImporter(FatcatImporter): else: # must have *some* name return None + orcid = obj['orcid-identifier']['path'] + if not self.is_orcid(orcid): + sys.stderr.write("Bad ORCID: {}\n".format(orcid)) + return None ce = fatcat_client.CreatorEntity( - orcid=obj['orcid-identifier']['path'], + orcid=orcid, given_name=given, surname=sur, display_name=display, diff --git a/python/tests/files/0000-0001-8254-710X.json b/python/tests/files/0000-0001-8254-710X.json new file mode 100644 index 00000000..094cae67 --- /dev/null +++ b/python/tests/files/0000-0001-8254-710X.json @@ -0,0 +1 @@ +{"orcid-identifier":{"uri":"http://orcid.org/0000-0001-8254-710X","path":"0000-0001-8254-710X","host":"orcid.org"},"preferences":{"locale":"en"},"history":{"creation-method":"Member-referred","completion-date":null,"submission-date":{"value":1407501041999},"last-modified-date":{"value":1465949566770},"claimed":true,"source":null,"deactivation-date":null,"verified-email":true,"verified-primary-email":true},"person":{"last-modified-date":null,"name":{"created-date":{"value":1460755375159},"last-modified-date":{"value":1460755375159},"given-names":{"value":"Man-Hui"},"family-name":{"value":"Li"},"credit-name":null,"source":null,"visibility":"public","path":"0000-0001-8254-710X"},"other-names":{"last-modified-date":null,"other-name":null,"path":"/0000-0001-8254-710X/other-names"},"biography":{"created-date":{"value":1460755375161},"last-modified-date":{"value":1460755375161},"content":null,"visibility":"public","path":"/0000-0001-8254-710X/biography"},"researcher-urls":{"last-modified-date":null,"researcher-url":null,"path":"/0000-0001-8254-710X/researcher-urls"},"emails":{"last-modified-date":null,"email":null,"path":"/0000-0001-8254-710X/email"},"addresses":{"last-modified-date":null,"address":null,"path":"/0000-0001-8254-710X/address"},"keywords":{"last-modified-date":null,"keyword":null,"path":"/0000-0001-8254-710X/keywords"},"external-identifiers":{"last-modified-date":null,"external-identifier":null,"path":"/0000-0001-8254-710X/external-identifiers"},"path":"/0000-0001-8254-710X/person"},"activities-summary":{"last-modified-date":null,"educations":{"last-modified-date":null,"education-summary":null,"path":"/0000-0001-8254-710X/educations"},"employments":{"last-modified-date":null,"employment-summary":null,"path":"/0000-0001-8254-710X/employments"},"fundings":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-710X/fundings"},"peer-reviews":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-710X/peer-reviews"},"works":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-710X/works"},"path":"/0000-0001-8254-710X/activities"},"path":"/0000-0001-8254-710X"} diff --git a/python/tests/files/crossref-works.2018-01-21.badsample.json b/python/tests/files/crossref-works.2018-01-21.badsample.json index d0ce191f..931da7a7 100644 --- a/python/tests/files/crossref-works.2018-01-21.badsample.json +++ b/python/tests/files/crossref-works.2018-01-21.badsample.json @@ -9,5 +9,6 @@ { "_id" : { "$oid" : "5a55196988a035a45bda0cb1" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T14:41:48Z", "timestamp" : { "$numberLong" : "1508769708308" } }, "reference-count" : 44, "publisher" : "Elsevier BV", "issue" : "1", "license" : [ { "URL" : "http://www.elsevier.com/tdm/userlicense/1.0/", "start" : { "date-parts" : [ [ 1998, 11, 1 ] ], "date-time" : "1998-11-01T00:00:00Z", "timestamp" : { "$numberLong" : "909878400000" } }, "delay-in-days" : 0, "content-version" : "tdm" } ], "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "Toxicology and Applied Pharmacology" ], "published-print" : { "date-parts" : [ [ 1998, 11 ] ] }, "DOI" : "10.1006/taap.1998.8543", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 9, 18 ] ], "date-time" : "2002-09-18T22:01:25Z", "timestamp" : { "$numberLong" : "1032386485000" } }, "page" : "102-108", "source" : "Crossref", "is-referenced-by-count" : 44, "title" : [ "Role of CYP1A2 in the Hepatotoxicity of Acetaminophen: Investigations UsingCyp1a2Null Mice" ], "prefix" : "10.1006", "volume" : "153", "author" : [ { "given" : "Robert P.", "family" : "Tonge", "affiliation" : [] }, { "given" : "Edward J.", "family" : "Kelly", "affiliation" : [] }, { "given" : "Sam A.", "family" : "Bruschi", "affiliation" : [] }, { "given" : "Tom", "family" : "Kalhorn", "affiliation" : [] }, { "given" : "David L.", "family" : "Eaton", "affiliation" : [] }, { "given" : "Daniel W.", "family" : "Nebert", "affiliation" : [] }, { "given" : "Sidney D.", "family" : "Nelson", "affiliation" : [] } ], "member" : "78", "container-title" : [ "Toxicology and Applied Pharmacology" ], "link" : [ { "URL" : "http://api.elsevier.com/content/article/PII:S0041008X9898543X?httpAccept=text/xml", "content-type" : "text/xml", "content-version" : "vor", "intended-application" : "text-mining" }, { "URL" : "http://api.elsevier.com/content/article/PII:S0041008X9898543X?httpAccept=text/plain", "content-type" : "text/plain", "content-version" : "vor", "intended-application" : "text-mining" } ], "deposited" : { "date-parts" : [ [ 2017, 6, 14 ] ], "date-time" : "2017-06-14T16:51:33Z", "timestamp" : { "$numberLong" : "1497459093000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 1998, 11 ] ] }, "references-count" : 44, "alternative-id" : [ "S0041008X9898543X" ], "URL" : "http://dx.doi.org/10.1006/taap.1998.8543", "ISSN" : [ "0041-008X" ], "issn-type" : [ { "value" : "0041-008X", "type" : "print" } ], "subject" : [ "Toxicology", "Pharmacology" ] } { "_id" : { "$oid" : "5a55170088a035a45bd8490d" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T14:30:12Z", "timestamp" : { "$numberLong" : "1508769012416" } }, "reference-count" : 37, "publisher" : "Wiley-Blackwell", "issue" : "2", "license" : [ { "URL" : "http://doi.wiley.com/10.1002/tdm_license_1.1", "start" : { "date-parts" : [ [ 2015, 9, 1 ] ], "date-time" : "2015-09-01T00:00:00Z", "timestamp" : { "$numberLong" : "1441065600000" } }, "delay-in-days" : 5356, "content-version" : "tdm" } ], "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "Am. J. Ind. Med." ], "published-print" : { "date-parts" : [ [ 2001, 2 ] ] }, "DOI" : "10.1002/1097-0274(200102)39:2<218::aid-ajim1009>3.0.co;2-4", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 8, 25 ] ], "date-time" : "2002-08-25T20:41:50Z", "timestamp" : { "$numberLong" : "1030308110000" } }, "page" : "218-226", "source" : "Crossref", "is-referenced-by-count" : 10, "title" : [ "The work environment impact assessment: A methodologic framework for evaluating health-based interventions" ], "prefix" : "10.1002", "volume" : "39", "author" : [ { "given" : "Beth J.", "family" : "Rosenberg", "affiliation" : [] }, { "given" : "Elizabeth M.", "family" : "Barbeau", "affiliation" : [] }, { "given" : "Rafael", "family" : "Moure-Eraso", "affiliation" : [] }, { "given" : "Charles", "family" : "Levenstein", "affiliation" : [] } ], "member" : "311", "published-online" : { "date-parts" : [ [ 2001 ] ] }, "reference" : [ { "key" : "BIB1", "author" : "Barbeau", "year" : "1998", "unstructured" : "1998. Displaced tobacco workers, public health, and tobacco policy: moving beyond jobs versus health. Doctoral thesis, Department of Work Environment, University of Massachusetts, Lowell." }, { "key" : "BIB2", "author" : "Berberian", "volume" : "37", "first-page" : "126", "year" : "1987", "journal-title" : "J Occup Environ Med" }, { "key" : "BIB3", "author" : "Bignami", "volume" : "80", "first-page" : "265", "year" : "1981", "journal-title" : "Mutat Res", "DOI" : "10.1016/0027-5107(81)90099-3", "doi-asserted-by" : "crossref" }, { "key" : "BIB4", "author" : "Britton", "year" : "1989", "unstructured" : "1989. The post-Alar era dawns chilly for apple growers. Boston Globe. Oct. 25, p. 34." }, { "key" : "BIB5", "author" : "Brusick", "year" : "1976", "unstructured" : "1976. Mutagen and oncogen Study on 1,1-dimethylhydrazine. Prepared for the Aerospace Med. Res. Lab., Aeropsace Med. Div. Airforce Systems Command, Wright- Patterson A.F.B., Dayton OH Litton Bionetics, Inc., Kensington, MD. NTIS AD-A035475." }, { "key" : "BIB6", "author" : "Chemical Marketing Reporter", "year" : "1984", "unstructured" : "Chemical Marketing Reporter. 1984. Uniroyal pesticide to be reviewed by EPA: regulatory action prompted by its toxicity. July 23." }, { "key" : "BIB7", "author" : "Chemical Marketing Reporter", "year" : "1989", "unstructured" : "Chemical Marketing Reporter. 1989. Uniroyal pulls apple pesticide from market, citing controversy. June 5." }, { "key" : "BIB8", "year" : "1990", "unstructured" : "Du Pont Chemical Company. 1990. MSDS No. M0000057, p. 2." }, { "key" : "BIB9", "year" : "1993", "unstructured" : "Farm Chemicals Handbook '93. 1993. Willoughby, OH: Meister.", "volume-title" : "Farm Chemicals Handbook '93" }, { "key" : "BIB10", "year" : "1985", "unstructured" : "Farm Chemicals Handbook '85. 1985. Willoughby, OH: Meister.", "volume-title" : "Farm Chemicals Handbook '85" }, { "key" : "BIB11", "author" : "Federal Register", "year" : "1989", "unstructured" : "Federal Register. 1989. Daminozide: termination of special review of food uses. Vol. 54, No. 216, p. 47482, November 14." }, { "key" : "BIB12", "author" : "Fenske", "first-page" : "729", "year" : "2000", "unstructured" : "2000. Agricultural workers. In: editors. Occupational health: recognizing and preventing work-related disease and injury. 4th ed. Philadelphia: Lippincott Williams and Wilkins, p. 729-748.", "volume-title" : "Occupational health: recognizing and preventing work-related disease and injury" }, { "key" : "BIB13", "author" : "Gibson", "volume" : "5", "first-page" : "24", "year" : "1994", "journal-title" : "New Solutions", "DOI" : "10.2190/NS5.1.g", "doi-asserted-by" : "crossref" }, { "key" : "BIB14", "author" : "Goldenhar", "volume" : "29", "first-page" : "289", "year" : "1996", "journal-title" : "Am J Ind Med", "DOI" : "10.1002/(SICI)1097-0274(199604)29:4<289::AID-AJIM2>3.0.CO;2-K", "doi-asserted-by" : "crossref" }, { "key" : "BIB15", "author" : "Haun", "year" : "1984", "unstructured" : "1984. Inhalation studies of UDMH. Air Force Aerospace Medical Res Lab, TR-85-020." }, { "key" : "BIB16", "author" : "International Agency for Research on Cancer (IARC)", "year" : "1997", "unstructured" : "International Agency for Research on Cancer (IARC). 1997. Evaluation of carcinogen risks to humans: man-made mineral fibres and radon. Lyons, France." }, { "key" : "BIB17", "author" : "Lord", "year" : "1969", "unstructured" : "1969 (May-June). Thoughts on the apple harvest problem. Fruit Notes. U. S. Department of Agriculture, Massachusetts Extension Service." }, { "key" : "BIB18", "author" : "Manning", "first-page" : "34", "year" : "1989", "unstructured" : "Sales Agent for J. P. Sullivan and Co., of Ayer, MA, an apple commission house. In 1989. The post-Alar era dawns chilly for apple growers. Boston Globe Oct. 25 p. 34.", "volume-title" : "The post-Alar era dawns chilly for apple growers" }, { "key" : "BIB19", "author" : "National Cancer Institute", "year" : "1978", "unstructured" : "National Cancer Institute. 1978. Bioassay of daminozide for possible carcinogenicity. Washington, D.C., United State Department of Health, Education and Welfare, Public Health Service (NIC Carcinogenesis Technical Report Series No. 83; DHEW Publication No (NIH 78-1333)." }, { "key" : "BIB20", "author" : "Rogers", "volume" : "89", "first-page" : "321", "year" : "1981", "journal-title" : "Mutat Res", "DOI" : "10.1016/0165-1218(81)90113-0", "doi-asserted-by" : "crossref" }, { "key" : "BIB21", "author" : "Rosenberg", "year" : "1995", "unstructured" : "1995. The best laid bans: the impact of pesticide bans on workers. Doctoral thesis, Department of Work Environment, University of Massachusetts Lowell." }, { "key" : "BIB22", "author" : "Rosenberg", "volume" : "6", "first-page" : "34", "year" : "1996", "journal-title" : "New Solutions: A Journal of Environmental and Occupational Health Policy", "DOI" : "10.2190/NS6.2.d", "doi-asserted-by" : "crossref" }, { "key" : "BIB23", "author" : "Rosenberg", "volume" : "8", "first-page" : "365", "year" : "1998", "journal-title" : "New Solutions Environmental Health Policy", "DOI" : "10.2190/A2A1-CT1X-RY6D-RR3M", "doi-asserted-by" : "crossref" }, { "key" : "BIB24", "author" : "Saunders", "volume" : "29", "first-page" : "409", "year" : "1987", "journal-title" : "J Occup Environ Med" }, { "key" : "BIB25", "author" : "Toth", "volume" : "50", "first-page" : "181", "year" : "1973", "journal-title" : "J Natl Cancer Inst", "DOI" : "10.1093/jnci/50.1.181", "doi-asserted-by" : "crossref" }, { "key" : "BIB26", "author" : "Toth", "volume" : "40", "first-page" : "2427", "year" : "1977a", "journal-title" : "Cancer", "DOI" : "10.1002/1097-0142(197711)40:5+<2427::AID-CNCR2820400906>3.0.CO;2-Y", "doi-asserted-by" : "crossref" }, { "key" : "BIB27", "author" : "Toth", "volume" : "37", "first-page" : "3497", "year" : "1977b", "journal-title" : "Cancer Res" }, { "key" : "BIB28", "author" : "U.S. Environmental Protection Agency", "year" : "1986", "unstructured" : "U.S. Environmental Protection Agency. 1986. Integrated Risk Information System (IRIS). Oxamyl. December 9." }, { "key" : "BIB29", "author" : "U.S. Environmental Protection Agency", "year" : "1986", "unstructured" : "U.S. Environmental Protection Agency. 1986. Chemical Fact Sheet Number 26: Daminozide. Office of Pesticides and Toxic Substances, Washington, DC. 10-169." }, { "key" : "BIB30", "author" : "U.S. Environmental Protection Agency", "year" : "1989", "unstructured" : "U.S. Environmental Protection Agency, Office of Pesticide Programs, Office of Pesticides and Toxic Substances. 1989. Daminozide special review technical support document: Preliminary determination to cancel the food uses of Daminozide. Washington, DC: May." }, { "key" : "BIB31", "author" : "U.S. Environmental Protection Agency", "volume" : "54", "first-page" : "10", "year" : "1989", "journal-title" : "Fed Regist." }, { "key" : "BIB32", "author" : "U.S. Environmental Protection Agency", "year" : "1990", "unstructured" : "U.S. Environmental Protection Agency. 1990. Integrated Risk Information System (IRIS). Propargite. May 1." }, { "key" : "BIB33", "author" : "U.S. Environmental Protection Agency", "volume" : "57", "first-page" : "10", "year" : "1992", "journal-title" : "Fed. Regist." }, { "key" : "BIB34", "author" : "U.S. Environmental Protection Agency", "year" : "1993", "unstructured" : "U.S. Environmental Protection Agency, Office of Prevention, Pesticides and Toxic Substances. 1993. R.E.D. Facts, Document number EPA-738-F-93-007. September." }, { "key" : "BIB35", "author" : "U.S. Department of Agriculture", "year" : "1993", "journal-title" : "New England Agricultural Statistics" }, { "key" : "BIB36", "author" : "Warren", "year" : "1992", "unstructured" : "1992. Unanticipated consequences of banning a chemical: the case of Alar. Unpublished manuscript, Department of Work Environment, University of Massachusetts Lowell." }, { "key" : "BIB37", "author" : "Wood", "year" : "1990", "unstructured" : "1990. Memo to Poverty Lane, West Lebanon, New Hampshire, to members of the Risk Assessment/Risk Management Work Group, Keystone National Policy Dialogue on Food Safety, Oct. 26, 1990, cited in Rosenberg, B. 1996." } ], "container-title" : [ "American Journal of Industrial Medicine" ], "link" : [ { "URL" : "https://api.wiley.com/onlinelibrary/tdm/v1/articles/10.1002%2F1097-0274(200102)39:2%3C218::AID-AJIM1009%3E3.0.CO;2-4", "content-type" : "unspecified", "content-version" : "vor", "intended-application" : "text-mining" } ], "deposited" : { "date-parts" : [ [ 2017, 8, 4 ] ], "date-time" : "2017-08-04T20:22:16Z", "timestamp" : { "$numberLong" : "1501878136000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 2001 ] ] }, "references-count" : 37, "URL" : "http://dx.doi.org/10.1002/1097-0274(200102)39:2<218::aid-ajim1009>3.0.co;2-4", "relation" : { "cites" : [] }, "ISSN" : [ "0271-3586", "1097-0274" ], "issn-type" : [ { "value" : "0271-3586", "type" : "print" }, { "value" : "1097-0274", "type" : "electronic" } ], "subject" : [ "Public Health, Environmental and Occupational Health" ] } { "_id" : { "$oid" : "5a553b4388a035a45bf39150" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T17:10:15Z", "timestamp" : { "$numberLong" : "1508778615346" } }, "reference-count" : 22, "publisher" : "Elsevier BV", "issue" : "4", "license" : [ { "URL" : "http://www.elsevier.com/tdm/userlicense/1.0/", "start" : { "date-parts" : [ [ 2001, 12, 1 ] ], "date-time" : "2001-12-01T00:00:00Z", "timestamp" : { "$numberLong" : "1007164800000" } }, "delay-in-days" : 0, "content-version" : "tdm" } ], "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "International Journal of Hospitality Management" ], "published-print" : { "date-parts" : [ [ 2001, 12 ] ] }, "DOI" : "10.1016/s0278-4319(01)00020-2", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 7, 25 ] ], "date-time" : "2002-07-25T14:28:16Z", "timestamp" : { "$numberLong" : "1027607296000" } }, "page" : "325-338", "source" : "Crossref", "is-referenced-by-count" : 14, "title" : [ "Hotel management style: a study of employee perceptions and preferences" ], "prefix" : "10.1016", "volume" : "20", "author" : [ { "given" : "Margaret", "family" : "Deery", "affiliation" : [] }, { "given" : "Leo K", "family" : "Jago", "affiliation" : [] } ], "member" : "78", "container-title" : [ "International Journal of Hospitality Management" ], "link" : [ { "URL" : "http://api.elsevier.com/content/article/PII:S0278431901000202?httpAccept=text/xml", "content-type" : "text/xml", "content-version" : "vor", "intended-application" : "text-mining" }, { "URL" : "http://api.elsevier.com/content/article/PII:S0278431901000202?httpAccept=text/plain", "content-type" : "text/plain", "content-version" : "vor", "intended-application" : "text-mining" } ], "deposited" : { "date-parts" : [ [ 2017, 6, 14 ] ], "date-time" : "2017-06-14T21:24:09Z", "timestamp" : { "$numberLong" : "1497475449000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 2001, 12 ] ] }, "references-count" : 22, "alternative-id" : [ "S0278431901000202" ], "URL" : "http://dx.doi.org/10.1016/s0278-4319(01)00020-2", "ISSN" : [ "0278-4319" ], "issn-type" : [ { "value" : "0278-4319", "type" : "print" } ], "subject" : [ "Tourism, Leisure and Hospitality Management", "Strategy and Management" ] } +{ "_id" : { "$oid" : "5a55176088a035a45bd8802c" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T14:31:47Z", "timestamp" : { "$numberLong" : "1508769107897" } }, "reference-count" : 1, "publisher" : "Hindawi Limited", "issue" : "2", "license" : [ { "URL" : "http://creativecommons.org/licenses/by/3.0/", "start" : { "date-parts" : [ [ 2002, 1, 1 ] ], "date-time" : "2002-01-01T00:00:00Z", "timestamp" : { "$numberLong" : "1009843200000" } }, "delay-in-days" : 0, "content-version" : "vor" } ], "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "Comparative and Functional Genomics" ], "published-print" : { "date-parts" : [ [ 2002 ] ] }, "abstract" : "This brief meeting review summarizes the recommendations of NSF and NPGI funded bioinformaticians concerning the future requirements for plant bioinformatics systems and databases.", "DOI" : "10.1002/cfg.158", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 8, 25 ] ], "date-time" : "2002-08-25T23:45:33Z", "timestamp" : { "$numberLong" : "1030319133000" } }, "page" : "176-176", "source" : "Crossref", "is-referenced-by-count" : 4, "title" : [ "Meeting Review: Plant Bioinformatics at the NSF and NPGI (PAMGX Satellite) Meetings" ], "prefix" : "10.1155", "volume" : "3", "author" : [ { "ORCID" : "http://orcid.org/0000-0002-4447-597X", "authenticated-orcid" : true, "given" : "Richard", "family" : "Bruskiewich", "affiliation" : [ { "name" : "International Rice Research Institute (IRRI), Metro Manila DAPO 7777, Philippines" } ] } ], "member" : "98", "reference" : [ { "key" : "10.1002/cfg.158-BIB1", "author" : "Brazma", "volume" : "29", "first-page" : "365", "year" : "2001", "journal-title" : "Nature Genetics", "DOI" : "10.1038/ng1201-365", "doi-asserted-by" : "crossref" } ], "container-title" : [ "Comparative and Functional Genomics" ], "link" : [ { "URL" : "http://downloads.hindawi.com/journals/ijg/2002/250628.pdf", "content-type" : "application/pdf", "content-version" : "vor", "intended-application" : "text-mining" }, { "URL" : "http://downloads.hindawi.com/journals/ijg/2002/250628.pdf", "content-type" : "unspecified", "content-version" : "vor", "intended-application" : "similarity-checking" } ], "deposited" : { "date-parts" : [ [ 2017, 8, 5 ] ], "date-time" : "2017-08-05T06:32:00Z", "timestamp" : { "$numberLong" : "1501914720000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 2002 ] ] }, "references-count" : 1, "alternative-id" : [ "250628" ], "URL" : "http://dx.doi.org/10.1002/cfg.158", "relation" : { "cites" : [] }, "ISSN" : [ "1531-6912", "1532-6268" ], "issn-type" : [ { "value" : "1531-6912", "type" : "print" }, { "value" : "1532-6268", "type" : "electronic" } ], "subject" : [ "Biotechnology", "Genetics", "Molecular Biology" ] } { "_id" : { "$oid" : "5a55176088a035a45bd8802c" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T14:31:47Z", "timestamp" : { "$numberLong" : "1508769107897" } }, "reference-count" : 1, "publisher" : "Hindawi Limited", "issue" : "2", "license" : [ { "URL" : "http://creativecommons.org/licenses/by/3.0/", "start" : { "date-parts" : [ [ 2002, 1, 1 ] ], "date-time" : "2002-01-01T00:00:00Z", "timestamp" : { "$numberLong" : "1009843200000" } }, "delay-in-days" : 0, "content-version" : "vor" } ], "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "Comparative and Functional Genomics" ], "published-print" : { "date-parts" : [ [ 2002 ] ] }, "abstract" : "This brief meeting review summarizes the recommendations of NSF and NPGI funded bioinformaticians concerning the future requirements for plant bioinformatics systems and databases.", "DOI" : "10.1002/cfg.158", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 8, 25 ] ], "date-time" : "2002-08-25T23:45:33Z", "timestamp" : { "$numberLong" : "1030319133000" } }, "page" : "176-176", "source" : "Crossref", "is-referenced-by-count" : 4, "title" : [ "Meeting Review: Plant Bioinformatics at the NSF and NPGI (PAMGX Satellite) Meetings" ], "prefix" : "10.1155", "volume" : "3", "author" : [ { "ORCID" : "http://orcid.org/0000-0002-4447-5978", "authenticated-orcid" : true, "given" : "Richard", "family" : "Bruskiewich", "affiliation" : [ { "name" : "International Rice Research Institute (IRRI), Metro Manila DAPO 7777, Philippines" } ] } ], "member" : "98", "reference" : [ { "key" : "10.1002/cfg.158-BIB1", "author" : "Brazma", "volume" : "29", "first-page" : "365", "year" : "2001", "journal-title" : "Nature Genetics", "DOI" : "10.1038/ng1201-365", "doi-asserted-by" : "crossref" } ], "container-title" : [ "Comparative and Functional Genomics" ], "link" : [ { "URL" : "http://downloads.hindawi.com/journals/ijg/2002/250628.pdf", "content-type" : "application/pdf", "content-version" : "vor", "intended-application" : "text-mining" }, { "URL" : "http://downloads.hindawi.com/journals/ijg/2002/250628.pdf", "content-type" : "unspecified", "content-version" : "vor", "intended-application" : "similarity-checking" } ], "deposited" : { "date-parts" : [ [ 2017, 8, 5 ] ], "date-time" : "2017-08-05T06:32:00Z", "timestamp" : { "$numberLong" : "1501914720000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 2002 ] ] }, "references-count" : 1, "alternative-id" : [ "250628" ], "URL" : "http://dx.doi.org/10.1002/cfg.158", "relation" : { "cites" : [] }, "ISSN" : [ "1531-6912", "1532-6268" ], "issn-type" : [ { "value" : "1531-6912", "type" : "print" }, { "value" : "1532-6268", "type" : "electronic" } ], "subject" : [ "Biotechnology", "Genetics", "Molecular Biology" ] } { "_id" : { "$oid" : "5a551fbe88a035a45bdf19fd" }, "indexed" : { "date-parts" : [ [ 2017, 10, 23 ] ], "date-time" : "2017-10-23T15:12:12Z", "timestamp" : { "$numberLong" : "1508771532055" } }, "reference-count" : 0, "publisher" : "Springer Nature", "issue" : "11", "content-domain" : { "domain" : [], "crossmark-restriction" : false }, "short-container-title" : [ "Skeletal Radiol" ], "published-print" : { "date-parts" : [ [ 2001, 11 ] ] }, "DOI" : "10.1007/s002560100423", "type" : "journal-article", "created" : { "date-parts" : [ [ 2002, 10, 6 ] ], "date-time" : "2002-10-06T13:44:04Z", "timestamp" : { "$numberLong" : "1033911844000" } }, "page" : "643-647", "source" : "Crossref", "is-referenced-by-count" : 2, "title" : [ "Unilateral osteonecrosis in a patient with bilateral os centrale carpi: imaging findings" ], "prefix" : "10.1007", "volume" : "30", "author" : [ { "given" : "F.", "family" : "Abascal", "affiliation" : [] }, { "given" : "L.", "family" : "Cerezal", "affiliation" : [] }, { "given" : "F.", "family" : "del Piñal", "affiliation" : [] }, { "given" : "R.", "family" : "García-Valtuille", "affiliation" : [] }, { "given" : "A.", "family" : "García-Valtuille", "affiliation" : [] }, { "given" : "A.", "family" : "Canga", "affiliation" : [] }, { "given" : "J.", "family" : "Torcida", "affiliation" : [] } ], "member" : "297", "published-online" : { "date-parts" : [ [ 2001, 9, 14 ] ] }, "container-title" : [ "Skeletal Radiology" ], "link" : [ { "URL" : "http://link.springer.com/content/pdf/10.1007/s002560100423", "content-type" : "unspecified", "content-version" : "vor", "intended-application" : "similarity-checking" } ], "deposited" : { "date-parts" : [ [ 2014, 4, 9 ] ], "date-time" : "2014-04-09T05:21:52Z", "timestamp" : { "$numberLong" : "1397020912000" } }, "score" : 1, "issued" : { "date-parts" : [ [ 2001, 9, 14 ] ] }, "references-count" : 0, "alternative-id" : [ "423" ], "URL" : "http://dx.doi.org/10.1007/s002560100423", "ISSN" : [ "0364-2348", "1432-2161" ], "issn-type" : [ { "value" : "0364-2348", "type" : "print" }, { "value" : "1432-2161", "type" : "electronic" } ], "subject" : [ "Radiology Nuclear Medicine and imaging" ] } diff --git a/python/tests/importer.py b/python/tests/importer.py index 190acbed..4d49e794 100644 --- a/python/tests/importer.py +++ b/python/tests/importer.py @@ -13,3 +13,23 @@ def test_issnl_mapping_lookup(): assert fi.issn2issnl('9999-0027') == None assert fi.lookup_issnl('9999-9999') == None + +def test_identifiers(): + + with open('tests/files/ISSN-to-ISSN-L.snip.txt', 'r') as issn_file: + fi = FatcatImporter("http://localhost:9411/v0", issn_file) + + assert fi.is_issnl("1234-5678") == True + assert fi.is_issnl("1234-5678.") == False + assert fi.is_issnl("12345678") == False + assert fi.is_issnl("1-2345678") == False + + assert fi.is_doi("10.1234/56789") == True + assert fi.is_doi("101234/56789") == False + assert fi.is_doi("10.1234_56789") == False + + assert fi.is_orcid("0000-0003-3118-6591") == True + assert fi.is_orcid("0000-00x3-3118-659") == False + assert fi.is_orcid("0000-00033118-659") == False + assert fi.is_orcid("0000-0003-3118-659.") == False + diff --git a/python/tests/orcid.py b/python/tests/orcid.py index 00748972..e07583ac 100644 --- a/python/tests/orcid.py +++ b/python/tests/orcid.py @@ -13,6 +13,10 @@ def test_orcid_importer_batch(orcid_importer): with open('tests/files/0000-0001-8254-7103.json', 'r') as f: orcid_importer.process_batch(f) +def test_orcid_importer_badid(orcid_importer): + with open('tests/files/0000-0001-8254-710X.json', 'r') as f: + orcid_importer.process_batch(f) + def test_orcid_importer(orcid_importer): with open('tests/files/0000-0001-8254-7103.json', 'r') as f: orcid_importer.process_source(f) -- cgit v1.2.3 From 68e847aadc728d63057be5b8d547c851b02a0008 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 15 Aug 2018 21:47:47 -0700 Subject: WIP on fatcat_export --- python/fatcat/fcid.py | 17 ++++++++++++ python/fatcat_export.py | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 python/fatcat/fcid.py create mode 100755 python/fatcat_export.py (limited to 'python') diff --git a/python/fatcat/fcid.py b/python/fatcat/fcid.py new file mode 100644 index 00000000..dd72b242 --- /dev/null +++ b/python/fatcat/fcid.py @@ -0,0 +1,17 @@ + +import base64 +import uuid + +def fcid2uuid(s): + s = s.split('_')[-1].upper().encode('utf-8') + assert len(s) == 26 + raw = base64.b32decode(s + b"======") + return str(uuid.UUID(bytes=raw)).lower() + +def uuid2fcid(s): + raw = uuid.UUID(s).bytes + return base64.b32encode(raw)[:26].lower().decode('utf-8') + +def test_fcid(): + test_uuid = '00000000-0000-0000-3333-000000000001' + assert test_uuid == fcid2uuid(uuid2fcid(test_uuid)) diff --git a/python/fatcat_export.py b/python/fatcat_export.py new file mode 100755 index 00000000..6c4502af --- /dev/null +++ b/python/fatcat_export.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +import sys +import json +import argparse +import fatcat_client +from fatcat_client.rest import ApiException +from fatcat.fcid import uuid2fcid + +def run_export_releases(args): + conf = fatcat_client.Configuration() + conf.host = args.host_url + api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) + + for line in args.ident_file: + ident = uuid2fcid(line.split()[0]) + release = api.get_release(id=ident, expand="all") + args.json_output.write(json.dumps(release.to_dict()) + "\n") + +def run_export_changelog(args): + conf = fatcat_client.Configuration() + conf.host = args.host_url + api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) + + end = args.end + if end is None: + latest = api.get_changelog(limit=1)[0] + end = latest.index + + for i in range(args.start, end): + entry = api.get_changelog_entry(id=i) + args.json_output.write(json.dumps(entry.to_dict()) + "\n") + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--debug', + action='store_true', + help="enable debugging interface") + parser.add_argument('--host-url', + default="http://localhost:9411/v0", + help="connect to this host/port") + subparsers = parser.add_subparsers() + + sub_releases = subparsers.add_parser('releases') + sub_releases.set_defaults(func=run_export_releases) + sub_releases.add_argument('ident_file', + help="TSV list of fatcat release idents to dump", + default=sys.stdin, type=argparse.FileType('r')) + sub_releases.add_argument('json_output', + help="where to send output", + default=sys.stdout, type=argparse.FileType('w')) + + sub_changelog = subparsers.add_parser('changelog') + sub_changelog.set_defaults(func=run_export_changelog) + sub_changelog.add_argument('--start', + help="index to start dumping at", + default=1, type=int) + sub_changelog.add_argument('--end', + help="index to stop dumping at (else detect most recent)", + default=None, type=int) + sub_changelog.add_argument('json_output', + help="where to send output", + default=sys.stdout, type=argparse.FileType('w')) + + args = parser.parse_args() + if not args.__dict__.get("func"): + print("tell me what to do!") + sys.exit(-1) + args.func(args) + +if __name__ == '__main__': + main() -- cgit v1.2.3 From b83347388d17dfd58c9f3d123d3d96d050ca6e9b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 16 Aug 2018 09:42:55 -0700 Subject: ORCIDs can end in X character --- fatcat-openapi2.yml | 2 +- python/fatcat_client/api/default_api.py | 4 ++-- python/fatcat_client/models/creator_entity.py | 4 ++-- rust/fatcat-api/README.md | 2 +- rust/fatcat-api/api.yaml | 2 +- rust/fatcat-api/api/swagger.yaml | 6 +++--- rust/src/api_helpers.rs | 10 +++++++++- 7 files changed, 19 insertions(+), 11 deletions(-) (limited to 'python') diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index 7ec91bad..524333ce 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -37,7 +37,7 @@ x-issn: &FATCATISSN x-orcid: &FATCATORCID type: string example: "0000-0002-1825-0097" - pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{4}" + pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" minLength: 19 maxLength: 19 diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index b7f23e25..acd33c88 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -3255,8 +3255,8 @@ class DefaultApi(object): if ('orcid' in params and len(params['orcid']) < 19): raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, length must be greater than or equal to `19`") # noqa: E501 - if 'orcid' in params and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{4}', params['orcid']): # noqa: E501 - raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, must conform to the pattern `/\\d{4}-\\d{4}-\\d{4}-\\d{4}/`") # noqa: E501 + if 'orcid' in params and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]', params['orcid']): # noqa: E501 + raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, must conform to the pattern `/\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]/`") # noqa: E501 collection_formats = {} path_params = {} diff --git a/python/fatcat_client/models/creator_entity.py b/python/fatcat_client/models/creator_entity.py index a9e459ee..de096281 100644 --- a/python/fatcat_client/models/creator_entity.py +++ b/python/fatcat_client/models/creator_entity.py @@ -139,8 +139,8 @@ class CreatorEntity(object): raise ValueError("Invalid value for `orcid`, length must be less than or equal to `19`") # noqa: E501 if orcid is not None and len(orcid) < 19: raise ValueError("Invalid value for `orcid`, length must be greater than or equal to `19`") # noqa: E501 - if orcid is not None and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{4}', orcid): # noqa: E501 - raise ValueError("Invalid value for `orcid`, must be a follow pattern or equal to `/\\d{4}-\\d{4}-\\d{4}-\\d{4}/`") # noqa: E501 + if orcid is not None and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]', orcid): # noqa: E501 + raise ValueError("Invalid value for `orcid`, must be a follow pattern or equal to `/\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]/`") # noqa: E501 self._orcid = orcid diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index af4e6a5b..1e382370 100644 --- a/rust/fatcat-api/README.md +++ b/rust/fatcat-api/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-08-15T00:04:03.771Z +- Build date: 2018-08-16T16:42:27.600Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml index 7ec91bad..524333ce 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -37,7 +37,7 @@ x-issn: &FATCATISSN x-orcid: &FATCATORCID type: string example: "0000-0002-1825-0097" - pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{4}" + pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" minLength: 19 maxLength: 19 diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index c572fd29..021594c0 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -612,7 +612,7 @@ paths: type: "string" maxLength: 19 minLength: 19 - pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{4}" + pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" formatString: "\\\"{}\\\"" example: "\"orcid_example\".to_string()" responses: @@ -2061,7 +2061,7 @@ definitions: example: "0000-0002-1825-0097" minLength: 19 maxLength: 19 - pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{4}" + pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" surname: type: "string" given_name: @@ -3180,7 +3180,7 @@ x-issn: x-orcid: type: "string" example: "0000-0002-1825-0097" - pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{4}" + pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]" minLength: 19 maxLength: 19 x-entity-props: diff --git a/rust/src/api_helpers.rs b/rust/src/api_helpers.rs index 489631b3..020aad76 100644 --- a/rust/src/api_helpers.rs +++ b/rust/src/api_helpers.rs @@ -181,7 +181,7 @@ pub fn check_issn(raw: &str) -> Result<()> { pub fn check_orcid(raw: &str) -> Result<()> { lazy_static! { - static ref RE: Regex = Regex::new(r"^\d{4}-\d{4}-\d{4}-\d{4}$").unwrap(); + static ref RE: Regex = Regex::new(r"^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$").unwrap(); } if RE.is_match(raw) { Ok(()) @@ -193,6 +193,14 @@ pub fn check_orcid(raw: &str) -> Result<()> { } } +#[test] +fn test_check_orcid() { + assert!(check_orcid("0123-4567-3456-6789").is_ok()); + assert!(check_orcid("0123-4567-3456-678X").is_ok()); + assert!(check_orcid("01234567-3456-6780").is_err()); + assert!(check_orcid("0x23-4567-3456-6780").is_err()); +} + // TODO: make the above checks "more correct" // TODO: check ISBN-13 // TODO: check hashes (SHA-1, etc) -- cgit v1.2.3 From 0c400f377bb02c3ea6290de865650f00f1f1abbd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Aug 2018 02:22:32 -0700 Subject: python autoaccept implementation More to review: - duplicate containers getting created in batch mode? eg, if multiple releases with same container. should push+autoaccept those anyways? --- python/fatcat/crossref_importer.py | 2 +- python/fatcat/importer_common.py | 3 --- python/fatcat/issn_importer.py | 2 +- python/fatcat/orcid_importer.py | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) (limited to 'python') diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index d3e525a4..b12851dc 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -152,4 +152,4 @@ class FatcatCrossrefImporter(FatcatImporter): re.container_id = container.ident self._issnl_id_map[ce.issnl] = container.ident release_batch.append(re) - self.api.create_release_batch(release_batch) + self.api.create_release_batch(release_batch, autoaccept=True) diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py index e084d8c4..9949d847 100644 --- a/python/fatcat/importer_common.py +++ b/python/fatcat/importer_common.py @@ -43,10 +43,7 @@ class FatcatImporter: def process_batch(self, source, size=50): """Reads and processes in batches (not API-call-per-)""" for rows in grouper(source, size): - eg = self.api.create_editgroup( - fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae')) self.create_batch(rows, eg.id) - self.api.accept_editgroup(eg.id) def process_csv_source(self, source, group_size=100, delimiter=','): reader = csv.DictReader(source, delimiter=delimiter) diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py index 181137ac..6b806b40 100644 --- a/python/fatcat/issn_importer.py +++ b/python/fatcat/issn_importer.py @@ -70,4 +70,4 @@ class FatcatIssnImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_container_batch(objects) + self.api.create_container_batch(objects, autoaccept=True) diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py index e57703d5..cc12d50d 100644 --- a/python/fatcat/orcid_importer.py +++ b/python/fatcat/orcid_importer.py @@ -71,4 +71,4 @@ class FatcatOrcidImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_creator_batch(objects) + self.api.create_creator_batch(objects, autoaccept=True) -- cgit v1.2.3 From 223afdced05ebebdda2b8d40992662f3340258a2 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Aug 2018 02:27:43 -0700 Subject: fix default editor_id in manifest importer --- python/fatcat/manifest_importer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/fatcat/manifest_importer.py b/python/fatcat/manifest_importer.py index 7762d132..2965d0ef 100644 --- a/python/fatcat/manifest_importer.py +++ b/python/fatcat/manifest_importer.py @@ -66,7 +66,7 @@ class FatcatManifestImporter(FatcatImporter): total_count = int(list(db.execute("SELECT COUNT(*) FROM files_metadata;"))[0][0]) print("{} rows to process".format(total_count)) - eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id=1)) + eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id="aaaaaaaaaaaabkvkaaaaaaaaae")) i = 0 j = -1 for row in db.execute(QUERY): @@ -81,7 +81,7 @@ class FatcatManifestImporter(FatcatImporter): self.create_entity(fe, editgroup_id=eg.id) if i > 0 and (i % size) == 0: self.api.accept_editgroup(eg.id) - eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id=1)) + eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id="aaaaaaaaaaaabkvkaaaaaaaaae")) print("Finished a batch; row {} of {} ({:.2f}%).\tTotal inserted: {}".format( j, total_count, 100.0*j/total_count, i)) i = i + 1 -- cgit v1.2.3 From 693b9a0bb99aa6a691357c1e7c2b018150a3380b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Aug 2018 02:34:10 -0700 Subject: fix bug in new batch create python importer --- python/fatcat/importer_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py index 9949d847..c1566e65 100644 --- a/python/fatcat/importer_common.py +++ b/python/fatcat/importer_common.py @@ -43,7 +43,7 @@ class FatcatImporter: def process_batch(self, source, size=50): """Reads and processes in batches (not API-call-per-)""" for rows in grouper(source, size): - self.create_batch(rows, eg.id) + self.create_batch(rows) def process_csv_source(self, source, group_size=100, delimiter=','): reader = csv.DictReader(source, delimiter=delimiter) -- cgit v1.2.3 From 6207a12627830f1e524f1ea36d02871510b2bd28 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Aug 2018 02:34:28 -0700 Subject: codegen python --- python/fatcat_client/api/default_api.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'python') diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index acd33c88..914f747c 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -245,6 +245,7 @@ class DefaultApi(object): :param async bool :param list[ContainerEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -266,12 +267,13 @@ class DefaultApi(object): :param async bool :param list[ContainerEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list'] # noqa: E501 + all_params = ['entity_list', 'autoaccept'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -296,6 +298,8 @@ class DefaultApi(object): path_params = {} query_params = [] + if 'autoaccept' in params: + query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 header_params = {} @@ -439,6 +443,7 @@ class DefaultApi(object): :param async bool :param list[CreatorEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -460,12 +465,13 @@ class DefaultApi(object): :param async bool :param list[CreatorEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list'] # noqa: E501 + all_params = ['entity_list', 'autoaccept'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -490,6 +496,8 @@ class DefaultApi(object): path_params = {} query_params = [] + if 'autoaccept' in params: + query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 header_params = {} @@ -730,6 +738,7 @@ class DefaultApi(object): :param async bool :param list[FileEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -751,12 +760,13 @@ class DefaultApi(object): :param async bool :param list[FileEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list'] # noqa: E501 + all_params = ['entity_list', 'autoaccept'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -781,6 +791,8 @@ class DefaultApi(object): path_params = {} query_params = [] + if 'autoaccept' in params: + query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 header_params = {} @@ -924,6 +936,7 @@ class DefaultApi(object): :param async bool :param list[ReleaseEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -945,12 +958,13 @@ class DefaultApi(object): :param async bool :param list[ReleaseEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list'] # noqa: E501 + all_params = ['entity_list', 'autoaccept'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -975,6 +989,8 @@ class DefaultApi(object): path_params = {} query_params = [] + if 'autoaccept' in params: + query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 header_params = {} @@ -1118,6 +1134,7 @@ class DefaultApi(object): :param async bool :param list[WorkEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -1139,12 +1156,13 @@ class DefaultApi(object): :param async bool :param list[WorkEntity] entity_list: (required) + :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list'] # noqa: E501 + all_params = ['entity_list', 'autoaccept'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1169,6 +1187,8 @@ class DefaultApi(object): path_params = {} query_params = [] + if 'autoaccept' in params: + query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 header_params = {} -- cgit v1.2.3 From 1b10d844f20df008fa9848d4ee83e294ed9c6523 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 30 Aug 2018 19:37:04 -0700 Subject: importers: create editgroup and pass --- python/fatcat/crossref_importer.py | 2 +- python/fatcat/importer_common.py | 4 +++- python/fatcat/issn_importer.py | 2 +- python/fatcat/orcid_importer.py | 2 +- python/fatcat_client/api/default_api.py | 30 +++++++++++++++++++++++++----- 5 files changed, 31 insertions(+), 9 deletions(-) (limited to 'python') diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index b12851dc..7540cf61 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -152,4 +152,4 @@ class FatcatCrossrefImporter(FatcatImporter): re.container_id = container.ident self._issnl_id_map[ce.issnl] = container.ident release_batch.append(re) - self.api.create_release_batch(release_batch, autoaccept=True) + self.api.create_release_batch(release_batch, autoaccept=True, editgroup=editgroup_id) diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py index c1566e65..0b02d175 100644 --- a/python/fatcat/importer_common.py +++ b/python/fatcat/importer_common.py @@ -43,7 +43,9 @@ class FatcatImporter: def process_batch(self, source, size=50): """Reads and processes in batches (not API-call-per-)""" for rows in grouper(source, size): - self.create_batch(rows) + eg = self.api.create_editgroup( + fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae')) + self.create_batch(rows, editgroup_id=eg.id) def process_csv_source(self, source, group_size=100, delimiter=','): reader = csv.DictReader(source, delimiter=delimiter) diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py index 6b806b40..2cb954e9 100644 --- a/python/fatcat/issn_importer.py +++ b/python/fatcat/issn_importer.py @@ -70,4 +70,4 @@ class FatcatIssnImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_container_batch(objects, autoaccept=True) + self.api.create_container_batch(objects, autoaccept=True, editgroup=editgroup_id) diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py index cc12d50d..0b9860eb 100644 --- a/python/fatcat/orcid_importer.py +++ b/python/fatcat/orcid_importer.py @@ -71,4 +71,4 @@ class FatcatOrcidImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_creator_batch(objects, autoaccept=True) + self.api.create_creator_batch(objects, autoaccept=True, editgroup=editgroup_id) diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 914f747c..a0298750 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -246,6 +246,7 @@ class DefaultApi(object): :param async bool :param list[ContainerEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -268,12 +269,13 @@ class DefaultApi(object): :param async bool :param list[ContainerEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list', 'autoaccept'] # noqa: E501 + all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -300,6 +302,8 @@ class DefaultApi(object): query_params = [] if 'autoaccept' in params: query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -444,6 +448,7 @@ class DefaultApi(object): :param async bool :param list[CreatorEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -466,12 +471,13 @@ class DefaultApi(object): :param async bool :param list[CreatorEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list', 'autoaccept'] # noqa: E501 + all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -498,6 +504,8 @@ class DefaultApi(object): query_params = [] if 'autoaccept' in params: query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -739,6 +747,7 @@ class DefaultApi(object): :param async bool :param list[FileEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -761,12 +770,13 @@ class DefaultApi(object): :param async bool :param list[FileEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list', 'autoaccept'] # noqa: E501 + all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -793,6 +803,8 @@ class DefaultApi(object): query_params = [] if 'autoaccept' in params: query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -937,6 +949,7 @@ class DefaultApi(object): :param async bool :param list[ReleaseEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -959,12 +972,13 @@ class DefaultApi(object): :param async bool :param list[ReleaseEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list', 'autoaccept'] # noqa: E501 + all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -991,6 +1005,8 @@ class DefaultApi(object): query_params = [] if 'autoaccept' in params: query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1135,6 +1151,7 @@ class DefaultApi(object): :param async bool :param list[WorkEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. @@ -1157,12 +1174,13 @@ class DefaultApi(object): :param async bool :param list[WorkEntity] entity_list: (required) :param bool autoaccept: If true, and editor is authorized, batch is accepted all at once + :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True) :return: list[EntityEdit] If the method is called asynchronously, returns the request thread. """ - all_params = ['entity_list', 'autoaccept'] # noqa: E501 + all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1189,6 +1207,8 @@ class DefaultApi(object): query_params = [] if 'autoaccept' in params: query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} -- cgit v1.2.3 From 6006c7406716ae15d0101a8980a2ae955de71690 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 30 Aug 2018 19:59:38 -0700 Subject: "true" is the only truthy value (oh no) --- python/fatcat/crossref_importer.py | 2 +- python/fatcat/issn_importer.py | 2 +- python/fatcat/orcid_importer.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index 7540cf61..54a3e84f 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -152,4 +152,4 @@ class FatcatCrossrefImporter(FatcatImporter): re.container_id = container.ident self._issnl_id_map[ce.issnl] = container.ident release_batch.append(re) - self.api.create_release_batch(release_batch, autoaccept=True, editgroup=editgroup_id) + self.api.create_release_batch(release_batch, autoaccept="true", editgroup=editgroup_id) diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py index 2cb954e9..eb8a50ba 100644 --- a/python/fatcat/issn_importer.py +++ b/python/fatcat/issn_importer.py @@ -70,4 +70,4 @@ class FatcatIssnImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_container_batch(objects, autoaccept=True, editgroup=editgroup_id) + self.api.create_container_batch(objects, autoaccept="true", editgroup=editgroup_id) diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py index 0b9860eb..fe76b02c 100644 --- a/python/fatcat/orcid_importer.py +++ b/python/fatcat/orcid_importer.py @@ -71,4 +71,4 @@ class FatcatOrcidImporter(FatcatImporter): objects = [o for o in objects if o != None] for o in objects: o.editgroup_id = editgroup_id - self.api.create_creator_batch(objects, autoaccept=True, editgroup=editgroup_id) + self.api.create_creator_batch(objects, autoaccept="true", editgroup=editgroup_id) -- cgit v1.2.3 From 7354899493f6448bed5698ad6ade1dbebcf39379 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 7 Sep 2018 22:37:09 -0700 Subject: TODO and comment --- python/README_codegen.md | 10 + python/fatcat_client/api/default_api.py | 1948 ++++++++++++++++++------ python/tests/codegen_tests/test_default_api.py | 60 + rust/TODO | 2 + rust/src/api_server.rs | 1 - 5 files changed, 1561 insertions(+), 460 deletions(-) (limited to 'python') diff --git a/python/README_codegen.md b/python/README_codegen.md index 393fae32..0d072dde 100644 --- a/python/README_codegen.md +++ b/python/README_codegen.md @@ -80,6 +80,11 @@ Class | Method | HTTP request | Description *DefaultApi* | [**create_release_batch**](docs/DefaultApi.md#create_release_batch) | **POST** /release/batch | *DefaultApi* | [**create_work**](docs/DefaultApi.md#create_work) | **POST** /work | *DefaultApi* | [**create_work_batch**](docs/DefaultApi.md#create_work_batch) | **POST** /work/batch | +*DefaultApi* | [**delete_container**](docs/DefaultApi.md#delete_container) | **DELETE** /container/{id} | +*DefaultApi* | [**delete_creator**](docs/DefaultApi.md#delete_creator) | **DELETE** /creator/{id} | +*DefaultApi* | [**delete_file**](docs/DefaultApi.md#delete_file) | **DELETE** /file/{id} | +*DefaultApi* | [**delete_release**](docs/DefaultApi.md#delete_release) | **DELETE** /release/{id} | +*DefaultApi* | [**delete_work**](docs/DefaultApi.md#delete_work) | **DELETE** /work/{id} | *DefaultApi* | [**get_changelog**](docs/DefaultApi.md#get_changelog) | **GET** /changelog | *DefaultApi* | [**get_changelog_entry**](docs/DefaultApi.md#get_changelog_entry) | **GET** /changelog/{id} | *DefaultApi* | [**get_container**](docs/DefaultApi.md#get_container) | **GET** /container/{id} | @@ -103,6 +108,11 @@ Class | Method | HTTP request | Description *DefaultApi* | [**lookup_creator**](docs/DefaultApi.md#lookup_creator) | **GET** /creator/lookup | *DefaultApi* | [**lookup_file**](docs/DefaultApi.md#lookup_file) | **GET** /file/lookup | *DefaultApi* | [**lookup_release**](docs/DefaultApi.md#lookup_release) | **GET** /release/lookup | +*DefaultApi* | [**update_container**](docs/DefaultApi.md#update_container) | **PUT** /container/{id} | +*DefaultApi* | [**update_creator**](docs/DefaultApi.md#update_creator) | **PUT** /creator/{id} | +*DefaultApi* | [**update_file**](docs/DefaultApi.md#update_file) | **PUT** /file/{id} | +*DefaultApi* | [**update_release**](docs/DefaultApi.md#update_release) | **PUT** /release/{id} | +*DefaultApi* | [**update_work**](docs/DefaultApi.md#update_work) | **PUT** /work/{id} | ## Documentation For Models diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index a0298750..23c8d7ca 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -1245,43 +1245,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_changelog(self, **kwargs): # noqa: E501 - """get_changelog # noqa: E501 + def delete_container(self, id, **kwargs): # noqa: E501 + """delete_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_changelog(async=True) + >>> thread = api.delete_container(id, async=True) >>> result = thread.get() :param async bool - :param int limit: - :return: list[ChangelogEntry] + :param str id: (required) + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_changelog_with_http_info(**kwargs) # noqa: E501 + return self.delete_container_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_changelog_with_http_info(**kwargs) # noqa: E501 + (data) = self.delete_container_with_http_info(id, **kwargs) # noqa: E501 return data - def get_changelog_with_http_info(self, **kwargs): # noqa: E501 - """get_changelog # noqa: E501 + def delete_container_with_http_info(self, id, **kwargs): # noqa: E501 + """delete_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_changelog_with_http_info(async=True) + >>> thread = api.delete_container_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param int limit: - :return: list[ChangelogEntry] + :param str id: (required) + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['limit'] # noqa: E501 + all_params = ['id', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1292,18 +1294,24 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_changelog" % key + " to method delete_container" % key ) params[key] = val del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_container`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1323,14 +1331,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/changelog', 'GET', + '/container/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[ChangelogEntry]', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1338,43 +1346,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_changelog_entry(self, id, **kwargs): # noqa: E501 - """get_changelog_entry # noqa: E501 + def delete_creator(self, id, **kwargs): # noqa: E501 + """delete_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_changelog_entry(id, async=True) + >>> thread = api.delete_creator(id, async=True) >>> result = thread.get() :param async bool - :param int id: (required) - :return: ChangelogEntry + :param str id: (required) + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_changelog_entry_with_http_info(id, **kwargs) # noqa: E501 + return self.delete_creator_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_changelog_entry_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.delete_creator_with_http_info(id, **kwargs) # noqa: E501 return data - def get_changelog_entry_with_http_info(self, id, **kwargs): # noqa: E501 - """get_changelog_entry # noqa: E501 + def delete_creator_with_http_info(self, id, **kwargs): # noqa: E501 + """delete_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_changelog_entry_with_http_info(id, async=True) + >>> thread = api.delete_creator_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param int id: (required) - :return: ChangelogEntry + :param str id: (required) + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1385,14 +1395,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_changelog_entry" % key + " to method delete_creator" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_changelog_entry`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `delete_creator`") # noqa: E501 collection_formats = {} @@ -1401,6 +1411,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1420,14 +1432,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/changelog/{id}', 'GET', + '/creator/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ChangelogEntry', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1435,45 +1447,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_container(self, id, **kwargs): # noqa: E501 - """get_container # noqa: E501 + def delete_file(self, id, **kwargs): # noqa: E501 + """delete_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_container(id, async=True) + >>> thread = api.delete_file(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: ContainerEntity + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_container_with_http_info(id, **kwargs) # noqa: E501 + return self.delete_file_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_container_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.delete_file_with_http_info(id, **kwargs) # noqa: E501 return data - def get_container_with_http_info(self, id, **kwargs): # noqa: E501 - """get_container # noqa: E501 + def delete_file_with_http_info(self, id, **kwargs): # noqa: E501 + """delete_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_container_with_http_info(id, async=True) + >>> thread = api.delete_file_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: ContainerEntity + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1484,14 +1496,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_container" % key + " to method delete_file" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_container`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `delete_file`") # noqa: E501 collection_formats = {} @@ -1500,8 +1512,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'expand' in params: - query_params.append(('expand', params['expand'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1521,14 +1533,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/container/{id}', 'GET', + '/file/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ContainerEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1536,45 +1548,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_container_history(self, id, **kwargs): # noqa: E501 - """get_container_history # noqa: E501 + def delete_release(self, id, **kwargs): # noqa: E501 + """delete_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_container_history(id, async=True) + >>> thread = api.delete_release(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_container_history_with_http_info(id, **kwargs) # noqa: E501 + return self.delete_release_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_container_history_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.delete_release_with_http_info(id, **kwargs) # noqa: E501 return data - def get_container_history_with_http_info(self, id, **kwargs): # noqa: E501 - """get_container_history # noqa: E501 + def delete_release_with_http_info(self, id, **kwargs): # noqa: E501 + """delete_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_container_history_with_http_info(id, async=True) + >>> thread = api.delete_release_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'limit'] # noqa: E501 + all_params = ['id', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1585,14 +1597,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_container_history" % key + " to method delete_release" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_container_history`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `delete_release`") # noqa: E501 collection_formats = {} @@ -1601,8 +1613,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1622,14 +1634,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/container/{id}/history', 'GET', + '/release/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[EntityHistoryEntry]', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1637,45 +1649,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_creator(self, id, **kwargs): # noqa: E501 - """get_creator # noqa: E501 + def delete_work(self, id, **kwargs): # noqa: E501 + """delete_work # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator(id, async=True) + >>> thread = api.delete_work(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: CreatorEntity + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_creator_with_http_info(id, **kwargs) # noqa: E501 + return self.delete_work_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_creator_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.delete_work_with_http_info(id, **kwargs) # noqa: E501 return data - def get_creator_with_http_info(self, id, **kwargs): # noqa: E501 - """get_creator # noqa: E501 + def delete_work_with_http_info(self, id, **kwargs): # noqa: E501 + """delete_work # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator_with_http_info(id, async=True) + >>> thread = api.delete_work_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: CreatorEntity + :param str editgroup: + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'editgroup'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1686,14 +1698,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_creator" % key + " to method delete_work" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_creator`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `delete_work`") # noqa: E501 collection_formats = {} @@ -1702,8 +1714,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'expand' in params: - query_params.append(('expand', params['expand'])) # noqa: E501 + if 'editgroup' in params: + query_params.append(('editgroup', params['editgroup'])) # noqa: E501 header_params = {} @@ -1723,14 +1735,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/creator/{id}', 'GET', + '/work/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='CreatorEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1738,45 +1750,43 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_creator_history(self, id, **kwargs): # noqa: E501 - """get_creator_history # noqa: E501 + def get_changelog(self, **kwargs): # noqa: E501 + """get_changelog # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator_history(id, async=True) + >>> thread = api.get_changelog(async=True) >>> result = thread.get() :param async bool - :param str id: (required) :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ChangelogEntry] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_creator_history_with_http_info(id, **kwargs) # noqa: E501 + return self.get_changelog_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.get_creator_history_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_changelog_with_http_info(**kwargs) # noqa: E501 return data - def get_creator_history_with_http_info(self, id, **kwargs): # noqa: E501 - """get_creator_history # noqa: E501 + def get_changelog_with_http_info(self, **kwargs): # noqa: E501 + """get_changelog # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator_history_with_http_info(id, async=True) + >>> thread = api.get_changelog_with_http_info(async=True) >>> result = thread.get() :param async bool - :param str id: (required) :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ChangelogEntry] If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'limit'] # noqa: E501 + all_params = ['limit'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1787,20 +1797,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_creator_history" % key + " to method get_changelog" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_creator_history`") # noqa: E501 collection_formats = {} path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 query_params = [] if 'limit' in params: @@ -1824,14 +1828,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/creator/{id}/history', 'GET', + '/changelog', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[EntityHistoryEntry]', # noqa: E501 + response_type='list[ChangelogEntry]', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1839,38 +1843,38 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_creator_releases(self, id, **kwargs): # noqa: E501 - """get_creator_releases # noqa: E501 + def get_changelog_entry(self, id, **kwargs): # noqa: E501 + """get_changelog_entry # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator_releases(id, async=True) + >>> thread = api.get_changelog_entry(id, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :return: list[ReleaseEntity] + :param int id: (required) + :return: ChangelogEntry If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_creator_releases_with_http_info(id, **kwargs) # noqa: E501 + return self.get_changelog_entry_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_creator_releases_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_changelog_entry_with_http_info(id, **kwargs) # noqa: E501 return data - def get_creator_releases_with_http_info(self, id, **kwargs): # noqa: E501 - """get_creator_releases # noqa: E501 + def get_changelog_entry_with_http_info(self, id, **kwargs): # noqa: E501 + """get_changelog_entry # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_creator_releases_with_http_info(id, async=True) + >>> thread = api.get_changelog_entry_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :return: list[ReleaseEntity] + :param int id: (required) + :return: ChangelogEntry If the method is called asynchronously, returns the request thread. """ @@ -1886,14 +1890,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_creator_releases" % key + " to method get_changelog_entry" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_creator_releases`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_changelog_entry`") # noqa: E501 collection_formats = {} @@ -1921,14 +1925,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/creator/{id}/releases', 'GET', + '/changelog/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[ReleaseEntity]', # noqa: E501 + response_type='ChangelogEntry', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -1936,43 +1940,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_editgroup(self, id, **kwargs): # noqa: E501 - """get_editgroup # noqa: E501 + def get_container(self, id, **kwargs): # noqa: E501 + """get_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editgroup(id, async=True) + >>> thread = api.get_container(id, async=True) >>> result = thread.get() :param async bool - :param str id: base32-encoded unique identifier (required) - :return: Editgroup + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: ContainerEntity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_editgroup_with_http_info(id, **kwargs) # noqa: E501 + return self.get_container_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_editgroup_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_container_with_http_info(id, **kwargs) # noqa: E501 return data - def get_editgroup_with_http_info(self, id, **kwargs): # noqa: E501 - """get_editgroup # noqa: E501 + def get_container_with_http_info(self, id, **kwargs): # noqa: E501 + """get_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editgroup_with_http_info(id, async=True) + >>> thread = api.get_container_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param str id: base32-encoded unique identifier (required) - :return: Editgroup + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: ContainerEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'expand'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1983,23 +1989,15 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_editgroup" % key + " to method get_container" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_editgroup`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_container`") # noqa: E501 - if ('id' in params and - len(params['id']) > 26): - raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, length must be less than or equal to `26`") # noqa: E501 - if ('id' in params and - len(params['id']) < 26): - raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, length must be greater than or equal to `26`") # noqa: E501 - if 'id' in params and not re.search('[a-zA-Z2-7]{26}', params['id']): # noqa: E501 - raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, must conform to the pattern `/[a-zA-Z2-7]{26}/`") # noqa: E501 collection_formats = {} path_params = {} @@ -2007,6 +2005,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'expand' in params: + query_params.append(('expand', params['expand'])) # noqa: E501 header_params = {} @@ -2026,14 +2026,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/editgroup/{id}', 'GET', + '/container/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Editgroup', # noqa: E501 + response_type='ContainerEntity', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2041,43 +2041,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_editor(self, id, **kwargs): # noqa: E501 - """get_editor # noqa: E501 + def get_container_history(self, id, **kwargs): # noqa: E501 + """get_container_history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editor(id, async=True) + >>> thread = api.get_container_history(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: Editor + :param int limit: + :return: list[EntityHistoryEntry] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_editor_with_http_info(id, **kwargs) # noqa: E501 + return self.get_container_history_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_editor_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_container_history_with_http_info(id, **kwargs) # noqa: E501 return data - def get_editor_with_http_info(self, id, **kwargs): # noqa: E501 - """get_editor # noqa: E501 - + def get_container_history_with_http_info(self, id, **kwargs): # noqa: E501 + """get_container_history # noqa: E501 + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editor_with_http_info(id, async=True) + >>> thread = api.get_container_history_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: Editor + :param int limit: + :return: list[EntityHistoryEntry] If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'limit'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2088,14 +2090,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_editor" % key + " to method get_container_history" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_editor`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_container_history`") # noqa: E501 collection_formats = {} @@ -2104,6 +2106,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 header_params = {} @@ -2123,14 +2127,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/editor/{id}', 'GET', + '/container/{id}/history', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Editor', # noqa: E501 + response_type='list[EntityHistoryEntry]', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2138,43 +2142,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_editor_changelog(self, id, **kwargs): # noqa: E501 - """get_editor_changelog # noqa: E501 + def get_creator(self, id, **kwargs): # noqa: E501 + """get_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editor_changelog(id, async=True) + >>> thread = api.get_creator(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[ChangelogEntry] + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: CreatorEntity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_editor_changelog_with_http_info(id, **kwargs) # noqa: E501 + return self.get_creator_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_editor_changelog_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_creator_with_http_info(id, **kwargs) # noqa: E501 return data - def get_editor_changelog_with_http_info(self, id, **kwargs): # noqa: E501 - """get_editor_changelog # noqa: E501 + def get_creator_with_http_info(self, id, **kwargs): # noqa: E501 + """get_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_editor_changelog_with_http_info(id, async=True) + >>> thread = api.get_creator_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[ChangelogEntry] + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: CreatorEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'expand'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2185,14 +2191,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_editor_changelog" % key + " to method get_creator" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_editor_changelog`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_creator`") # noqa: E501 collection_formats = {} @@ -2201,6 +2207,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] + if 'expand' in params: + query_params.append(('expand', params['expand'])) # noqa: E501 header_params = {} @@ -2220,14 +2228,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/editor/{id}/changelog', 'GET', + '/creator/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[ChangelogEntry]', # noqa: E501 + response_type='CreatorEntity', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2235,45 +2243,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_file(self, id, **kwargs): # noqa: E501 - """get_file # noqa: E501 + def get_creator_history(self, id, **kwargs): # noqa: E501 + """get_creator_history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_file(id, async=True) + >>> thread = api.get_creator_history(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: FileEntity + :param int limit: + :return: list[EntityHistoryEntry] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_file_with_http_info(id, **kwargs) # noqa: E501 + return self.get_creator_history_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_file_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_creator_history_with_http_info(id, **kwargs) # noqa: E501 return data - def get_file_with_http_info(self, id, **kwargs): # noqa: E501 - """get_file # noqa: E501 + def get_creator_history_with_http_info(self, id, **kwargs): # noqa: E501 + """get_creator_history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_file_with_http_info(id, async=True) + >>> thread = api.get_creator_history_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: FileEntity + :param int limit: + :return: list[EntityHistoryEntry] If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id', 'limit'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2284,14 +2292,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_file" % key + " to method get_creator_history" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_file`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_creator_history`") # noqa: E501 collection_formats = {} @@ -2300,8 +2308,8 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'expand' in params: - query_params.append(('expand', params['expand'])) # noqa: E501 + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 header_params = {} @@ -2321,14 +2329,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/file/{id}', 'GET', + '/creator/{id}/history', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FileEntity', # noqa: E501 + response_type='list[EntityHistoryEntry]', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2336,45 +2344,43 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_file_history(self, id, **kwargs): # noqa: E501 - """get_file_history # noqa: E501 + def get_creator_releases(self, id, **kwargs): # noqa: E501 + """get_creator_releases # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_file_history(id, async=True) + >>> thread = api.get_creator_releases(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_file_history_with_http_info(id, **kwargs) # noqa: E501 + return self.get_creator_releases_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_file_history_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_creator_releases_with_http_info(id, **kwargs) # noqa: E501 return data - def get_file_history_with_http_info(self, id, **kwargs): # noqa: E501 - """get_file_history # noqa: E501 + def get_creator_releases_with_http_info(self, id, **kwargs): # noqa: E501 + """get_creator_releases # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_file_history_with_http_info(id, async=True) + >>> thread = api.get_creator_releases_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ReleaseEntity] If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'limit'] # noqa: E501 + all_params = ['id'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2385,14 +2391,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_file_history" % key + " to method get_creator_releases" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_file_history`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_creator_releases`") # noqa: E501 collection_formats = {} @@ -2401,8 +2407,6 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 header_params = {} @@ -2422,14 +2426,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/file/{id}/history', 'GET', + '/creator/{id}/releases', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[EntityHistoryEntry]', # noqa: E501 + response_type='list[ReleaseEntity]', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2437,45 +2441,43 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_release(self, id, **kwargs): # noqa: E501 - """get_release # noqa: E501 + def get_editgroup(self, id, **kwargs): # noqa: E501 + """get_editgroup # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release(id, async=True) + >>> thread = api.get_editgroup(id, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: ReleaseEntity + :param str id: base32-encoded unique identifier (required) + :return: Editgroup If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_release_with_http_info(id, **kwargs) # noqa: E501 + return self.get_editgroup_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_release_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_editgroup_with_http_info(id, **kwargs) # noqa: E501 return data - def get_release_with_http_info(self, id, **kwargs): # noqa: E501 - """get_release # noqa: E501 + def get_editgroup_with_http_info(self, id, **kwargs): # noqa: E501 + """get_editgroup # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release_with_http_info(id, async=True) + >>> thread = api.get_editgroup_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: ReleaseEntity + :param str id: base32-encoded unique identifier (required) + :return: Editgroup If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'expand'] # noqa: E501 + all_params = ['id'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2486,15 +2488,23 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_release" % key + " to method get_editgroup" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_release`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_editgroup`") # noqa: E501 + if ('id' in params and + len(params['id']) > 26): + raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, length must be less than or equal to `26`") # noqa: E501 + if ('id' in params and + len(params['id']) < 26): + raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, length must be greater than or equal to `26`") # noqa: E501 + if 'id' in params and not re.search('[a-zA-Z2-7]{26}', params['id']): # noqa: E501 + raise ValueError("Invalid value for parameter `id` when calling `get_editgroup`, must conform to the pattern `/[a-zA-Z2-7]{26}/`") # noqa: E501 collection_formats = {} path_params = {} @@ -2502,8 +2512,6 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'expand' in params: - query_params.append(('expand', params['expand'])) # noqa: E501 header_params = {} @@ -2523,14 +2531,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/release/{id}', 'GET', + '/editgroup/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ReleaseEntity', # noqa: E501 + response_type='Editgroup', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2538,38 +2546,38 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_release_files(self, id, **kwargs): # noqa: E501 - """get_release_files # noqa: E501 + def get_editor(self, id, **kwargs): # noqa: E501 + """get_editor # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release_files(id, async=True) + >>> thread = api.get_editor(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[FileEntity] + :return: Editor If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_release_files_with_http_info(id, **kwargs) # noqa: E501 + return self.get_editor_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_release_files_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_editor_with_http_info(id, **kwargs) # noqa: E501 return data - def get_release_files_with_http_info(self, id, **kwargs): # noqa: E501 - """get_release_files # noqa: E501 + def get_editor_with_http_info(self, id, **kwargs): # noqa: E501 + """get_editor # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release_files_with_http_info(id, async=True) + >>> thread = api.get_editor_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[FileEntity] + :return: Editor If the method is called asynchronously, returns the request thread. """ @@ -2585,14 +2593,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_release_files" % key + " to method get_editor" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_release_files`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_editor`") # noqa: E501 collection_formats = {} @@ -2620,14 +2628,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/release/{id}/files', 'GET', + '/editor/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FileEntity]', # noqa: E501 + response_type='Editor', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2635,45 +2643,43 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_release_history(self, id, **kwargs): # noqa: E501 - """get_release_history # noqa: E501 + def get_editor_changelog(self, id, **kwargs): # noqa: E501 + """get_editor_changelog # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release_history(id, async=True) + >>> thread = api.get_editor_changelog(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ChangelogEntry] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_release_history_with_http_info(id, **kwargs) # noqa: E501 + return self.get_editor_changelog_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_release_history_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_editor_changelog_with_http_info(id, **kwargs) # noqa: E501 return data - def get_release_history_with_http_info(self, id, **kwargs): # noqa: E501 - """get_release_history # noqa: E501 + def get_editor_changelog_with_http_info(self, id, **kwargs): # noqa: E501 + """get_editor_changelog # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_release_history_with_http_info(id, async=True) + >>> thread = api.get_editor_changelog_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :return: list[ChangelogEntry] If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'limit'] # noqa: E501 + all_params = ['id'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2684,14 +2690,14 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_release_history" % key + " to method get_editor_changelog" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_release_history`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_editor_changelog`") # noqa: E501 collection_formats = {} @@ -2700,8 +2706,6 @@ class DefaultApi(object): path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 header_params = {} @@ -2721,14 +2725,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/release/{id}/history', 'GET', + '/editor/{id}/changelog', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[EntityHistoryEntry]', # noqa: E501 + response_type='list[ChangelogEntry]', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2736,43 +2740,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_stats(self, **kwargs): # noqa: E501 - """get_stats # noqa: E501 + def get_file(self, id, **kwargs): # noqa: E501 + """get_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_stats(async=True) + >>> thread = api.get_file(id, async=True) >>> result = thread.get() :param async bool - :param str more: - :return: StatsResponse + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: FileEntity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_stats_with_http_info(**kwargs) # noqa: E501 + return self.get_file_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_stats_with_http_info(**kwargs) # noqa: E501 + (data) = self.get_file_with_http_info(id, **kwargs) # noqa: E501 return data - def get_stats_with_http_info(self, **kwargs): # noqa: E501 - """get_stats # noqa: E501 + def get_file_with_http_info(self, id, **kwargs): # noqa: E501 + """get_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_stats_with_http_info(async=True) + >>> thread = api.get_file_with_http_info(id, async=True) >>> result = thread.get() :param async bool - :param str more: - :return: StatsResponse + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: FileEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['more'] # noqa: E501 + all_params = ['id', 'expand'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2783,18 +2789,24 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_stats" % key + " to method get_file" % key ) params[key] = val del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_file`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'more' in params: - query_params.append(('more', params['more'])) # noqa: E501 + if 'expand' in params: + query_params.append(('expand', params['expand'])) # noqa: E501 header_params = {} @@ -2814,14 +2826,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/stats', 'GET', + '/file/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='StatsResponse', # noqa: E501 + response_type='FileEntity', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2829,40 +2841,141 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_work(self, id, **kwargs): # noqa: E501 - """get_work # noqa: E501 + def get_file_history(self, id, **kwargs): # noqa: E501 + """get_file_history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work(id, async=True) + >>> thread = api.get_file_history(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_file_history_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_file_history_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_file_history_with_http_info(self, id, **kwargs): # noqa: E501 + """get_file_history # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_file_history_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id', 'limit'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_file_history" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_file_history`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/file/{id}/history', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityHistoryEntry]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_release(self, id, **kwargs): # noqa: E501 + """get_release # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_release(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: WorkEntity + :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_work_with_http_info(id, **kwargs) # noqa: E501 + return self.get_release_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_work_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.get_release_with_http_info(id, **kwargs) # noqa: E501 return data - def get_work_with_http_info(self, id, **kwargs): # noqa: E501 - """get_work # noqa: E501 + def get_release_with_http_info(self, id, **kwargs): # noqa: E501 + """get_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work_with_http_info(id, async=True) + >>> thread = api.get_release_with_http_info(id, async=True) >>> result = thread.get() :param async bool :param str id: (required) :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. - :return: WorkEntity + :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ @@ -2878,24 +2991,921 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_work" % key + " to method get_release" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_work`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `get_release`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + if 'expand' in params: + query_params.append(('expand', params['expand'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/release/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ReleaseEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_release_files(self, id, **kwargs): # noqa: E501 + """get_release_files # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_release_files(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: list[FileEntity] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_release_files_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_release_files_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_release_files_with_http_info(self, id, **kwargs): # noqa: E501 + """get_release_files # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_release_files_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: list[FileEntity] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_release_files" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_release_files`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/release/{id}/files', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[FileEntity]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_release_history(self, id, **kwargs): # noqa: E501 + """get_release_history # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_release_history(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_release_history_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_release_history_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_release_history_with_http_info(self, id, **kwargs): # noqa: E501 + """get_release_history # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_release_history_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id', 'limit'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_release_history" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_release_history`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/release/{id}/history', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityHistoryEntry]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_stats(self, **kwargs): # noqa: E501 + """get_stats # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_stats(async=True) + >>> result = thread.get() + + :param async bool + :param str more: + :return: StatsResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_stats_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_stats_with_http_info(**kwargs) # noqa: E501 + return data + + def get_stats_with_http_info(self, **kwargs): # noqa: E501 + """get_stats # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_stats_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param str more: + :return: StatsResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['more'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_stats" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'more' in params: + query_params.append(('more', params['more'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/stats', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='StatsResponse', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_work(self, id, **kwargs): # noqa: E501 + """get_work # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_work_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_work_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_work_with_http_info(self, id, **kwargs): # noqa: E501 + """get_work # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param str expand: List of sub-entities to expand in response. For now, only 'all' accepted. + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id', 'expand'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_work" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_work`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + if 'expand' in params: + query_params.append(('expand', params['expand'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/work/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WorkEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_work_history(self, id, **kwargs): # noqa: E501 + """get_work_history # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work_history(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_work_history_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_work_history_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_work_history_with_http_info(self, id, **kwargs): # noqa: E501 + """get_work_history # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work_history_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :param int limit: + :return: list[EntityHistoryEntry] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id', 'limit'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_work_history" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_work_history`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/work/{id}/history', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityHistoryEntry]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_work_releases(self, id, **kwargs): # noqa: E501 + """get_work_releases # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work_releases(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: list[ReleaseEntity] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_work_releases_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_work_releases_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_work_releases_with_http_info(self, id, **kwargs): # noqa: E501 + """get_work_releases # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_work_releases_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: list[ReleaseEntity] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_work_releases" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_work_releases`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/work/{id}/releases', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ReleaseEntity]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def lookup_container(self, issnl, **kwargs): # noqa: E501 + """lookup_container # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_container(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.lookup_container_with_http_info(issnl, **kwargs) # noqa: E501 + else: + (data) = self.lookup_container_with_http_info(issnl, **kwargs) # noqa: E501 + return data + + def lookup_container_with_http_info(self, issnl, **kwargs): # noqa: E501 + """lookup_container # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_container_with_http_info(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['issnl'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method lookup_container" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'issnl' is set + if ('issnl' not in params or + params['issnl'] is None): + raise ValueError("Missing the required parameter `issnl` when calling `lookup_container`") # noqa: E501 + + if ('issnl' in params and + len(params['issnl']) > 9): + raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, length must be less than or equal to `9`") # noqa: E501 + if ('issnl' in params and + len(params['issnl']) < 9): + raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, length must be greater than or equal to `9`") # noqa: E501 + if 'issnl' in params and not re.search('\\d{4}-\\d{3}[0-9X]', params['issnl']): # noqa: E501 + raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, must conform to the pattern `/\\d{4}-\\d{3}[0-9X]/`") # noqa: E501 + collection_formats = {} + + path_params = {} + + query_params = [] + if 'issnl' in params: + query_params.append(('issnl', params['issnl'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/container/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ContainerEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def lookup_creator(self, orcid, **kwargs): # noqa: E501 + """lookup_creator # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_creator(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.lookup_creator_with_http_info(orcid, **kwargs) # noqa: E501 + else: + (data) = self.lookup_creator_with_http_info(orcid, **kwargs) # noqa: E501 + return data + + def lookup_creator_with_http_info(self, orcid, **kwargs): # noqa: E501 + """lookup_creator # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_creator_with_http_info(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['orcid'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method lookup_creator" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'orcid' is set + if ('orcid' not in params or + params['orcid'] is None): + raise ValueError("Missing the required parameter `orcid` when calling `lookup_creator`") # noqa: E501 + + if ('orcid' in params and + len(params['orcid']) > 19): + raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, length must be less than or equal to `19`") # noqa: E501 + if ('orcid' in params and + len(params['orcid']) < 19): + raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, length must be greater than or equal to `19`") # noqa: E501 + if 'orcid' in params and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]', params['orcid']): # noqa: E501 + raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, must conform to the pattern `/\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]/`") # noqa: E501 + collection_formats = {} + + path_params = {} + + query_params = [] + if 'orcid' in params: + query_params.append(('orcid', params['orcid'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/creator/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CreatorEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def lookup_file(self, sha1, **kwargs): # noqa: E501 + """lookup_file # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_file(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.lookup_file_with_http_info(sha1, **kwargs) # noqa: E501 + else: + (data) = self.lookup_file_with_http_info(sha1, **kwargs) # noqa: E501 + return data + + def lookup_file_with_http_info(self, sha1, **kwargs): # noqa: E501 + """lookup_file # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.lookup_file_with_http_info(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sha1'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method lookup_file" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sha1' is set + if ('sha1' not in params or + params['sha1'] is None): + raise ValueError("Missing the required parameter `sha1` when calling `lookup_file`") # noqa: E501 collection_formats = {} path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'expand' in params: - query_params.append(('expand', params['expand'])) # noqa: E501 + if 'sha1' in params: + query_params.append(('sha1', params['sha1'])) # noqa: E501 header_params = {} @@ -2915,14 +3925,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/work/{id}', 'GET', + '/file/lookup', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='WorkEntity', # noqa: E501 + response_type='FileEntity', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -2930,45 +3940,43 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_work_history(self, id, **kwargs): # noqa: E501 - """get_work_history # noqa: E501 + def lookup_release(self, doi, **kwargs): # noqa: E501 + """lookup_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work_history(id, async=True) + >>> thread = api.lookup_release(doi, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :param str doi: (required) + :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_work_history_with_http_info(id, **kwargs) # noqa: E501 + return self.lookup_release_with_http_info(doi, **kwargs) # noqa: E501 else: - (data) = self.get_work_history_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.lookup_release_with_http_info(doi, **kwargs) # noqa: E501 return data - def get_work_history_with_http_info(self, id, **kwargs): # noqa: E501 - """get_work_history # noqa: E501 + def lookup_release_with_http_info(self, doi, **kwargs): # noqa: E501 + """lookup_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work_history_with_http_info(id, async=True) + >>> thread = api.lookup_release_with_http_info(doi, async=True) >>> result = thread.get() :param async bool - :param str id: (required) - :param int limit: - :return: list[EntityHistoryEntry] + :param str doi: (required) + :return: ReleaseEntity If the method is called asynchronously, returns the request thread. """ - all_params = ['id', 'limit'] # noqa: E501 + all_params = ['doi'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -2979,24 +3987,22 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_work_history" % key + " to method lookup_release" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_work_history`") # noqa: E501 + # verify the required parameter 'doi' is set + if ('doi' not in params or + params['doi'] is None): + raise ValueError("Missing the required parameter `doi` when calling `lookup_release`") # noqa: E501 collection_formats = {} path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 + if 'doi' in params: + query_params.append(('doi', params['doi'])) # noqa: E501 header_params = {} @@ -3016,14 +4022,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/work/{id}/history', 'GET', + '/release/lookup', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[EntityHistoryEntry]', # noqa: E501 + response_type='ReleaseEntity', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -3031,43 +4037,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def get_work_releases(self, id, **kwargs): # noqa: E501 - """get_work_releases # noqa: E501 + def update_container(self, id, entity, **kwargs): # noqa: E501 + """update_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work_releases(id, async=True) + >>> thread = api.update_container(id, entity, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[ReleaseEntity] + :param ContainerEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.get_work_releases_with_http_info(id, **kwargs) # noqa: E501 + return self.update_container_with_http_info(id, entity, **kwargs) # noqa: E501 else: - (data) = self.get_work_releases_with_http_info(id, **kwargs) # noqa: E501 + (data) = self.update_container_with_http_info(id, entity, **kwargs) # noqa: E501 return data - def get_work_releases_with_http_info(self, id, **kwargs): # noqa: E501 - """get_work_releases # noqa: E501 + def update_container_with_http_info(self, id, entity, **kwargs): # noqa: E501 + """update_container # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.get_work_releases_with_http_info(id, async=True) + >>> thread = api.update_container_with_http_info(id, entity, async=True) >>> result = thread.get() :param async bool :param str id: (required) - :return: list[ReleaseEntity] + :param ContainerEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['id'] # noqa: E501 + all_params = ['id', 'entity'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3078,14 +4086,18 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_work_releases" % key + " to method update_container" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `get_work_releases`") # noqa: E501 + raise ValueError("Missing the required parameter `id` when calling `update_container`") # noqa: E501 + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `update_container`") # noqa: E501 collection_formats = {} @@ -3101,6 +4113,8 @@ class DefaultApi(object): local_var_files = {} body_params = None + if 'entity' in params: + body_params = params['entity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -3113,14 +4127,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/work/{id}/releases', 'GET', + '/container/{id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[ReleaseEntity]', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -3128,43 +4142,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def lookup_container(self, issnl, **kwargs): # noqa: E501 - """lookup_container # noqa: E501 + def update_creator(self, id, entity, **kwargs): # noqa: E501 + """update_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_container(issnl, async=True) + >>> thread = api.update_creator(id, entity, async=True) >>> result = thread.get() :param async bool - :param str issnl: (required) - :return: ContainerEntity + :param str id: (required) + :param CreatorEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.lookup_container_with_http_info(issnl, **kwargs) # noqa: E501 + return self.update_creator_with_http_info(id, entity, **kwargs) # noqa: E501 else: - (data) = self.lookup_container_with_http_info(issnl, **kwargs) # noqa: E501 + (data) = self.update_creator_with_http_info(id, entity, **kwargs) # noqa: E501 return data - def lookup_container_with_http_info(self, issnl, **kwargs): # noqa: E501 - """lookup_container # noqa: E501 + def update_creator_with_http_info(self, id, entity, **kwargs): # noqa: E501 + """update_creator # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_container_with_http_info(issnl, async=True) + >>> thread = api.update_creator_with_http_info(id, entity, async=True) >>> result = thread.get() :param async bool - :param str issnl: (required) - :return: ContainerEntity + :param str id: (required) + :param CreatorEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['issnl'] # noqa: E501 + all_params = ['id', 'entity'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3175,30 +4191,26 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method lookup_container" % key + " to method update_creator" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'issnl' is set - if ('issnl' not in params or - params['issnl'] is None): - raise ValueError("Missing the required parameter `issnl` when calling `lookup_container`") # noqa: E501 + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `update_creator`") # noqa: E501 + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `update_creator`") # noqa: E501 - if ('issnl' in params and - len(params['issnl']) > 9): - raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, length must be less than or equal to `9`") # noqa: E501 - if ('issnl' in params and - len(params['issnl']) < 9): - raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, length must be greater than or equal to `9`") # noqa: E501 - if 'issnl' in params and not re.search('\\d{4}-\\d{3}[0-9X]', params['issnl']): # noqa: E501 - raise ValueError("Invalid value for parameter `issnl` when calling `lookup_container`, must conform to the pattern `/\\d{4}-\\d{3}[0-9X]/`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'issnl' in params: - query_params.append(('issnl', params['issnl'])) # noqa: E501 header_params = {} @@ -3206,6 +4218,8 @@ class DefaultApi(object): local_var_files = {} body_params = None + if 'entity' in params: + body_params = params['entity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -3218,14 +4232,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/container/lookup', 'GET', + '/creator/{id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ContainerEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -3233,43 +4247,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def lookup_creator(self, orcid, **kwargs): # noqa: E501 - """lookup_creator # noqa: E501 + def update_file(self, id, entity, **kwargs): # noqa: E501 + """update_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_creator(orcid, async=True) + >>> thread = api.update_file(id, entity, async=True) >>> result = thread.get() :param async bool - :param str orcid: (required) - :return: CreatorEntity + :param str id: (required) + :param FileEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.lookup_creator_with_http_info(orcid, **kwargs) # noqa: E501 + return self.update_file_with_http_info(id, entity, **kwargs) # noqa: E501 else: - (data) = self.lookup_creator_with_http_info(orcid, **kwargs) # noqa: E501 + (data) = self.update_file_with_http_info(id, entity, **kwargs) # noqa: E501 return data - def lookup_creator_with_http_info(self, orcid, **kwargs): # noqa: E501 - """lookup_creator # noqa: E501 + def update_file_with_http_info(self, id, entity, **kwargs): # noqa: E501 + """update_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_creator_with_http_info(orcid, async=True) + >>> thread = api.update_file_with_http_info(id, entity, async=True) >>> result = thread.get() :param async bool - :param str orcid: (required) - :return: CreatorEntity + :param str id: (required) + :param FileEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['orcid'] # noqa: E501 + all_params = ['id', 'entity'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3280,30 +4296,26 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method lookup_creator" % key + " to method update_file" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'orcid' is set - if ('orcid' not in params or - params['orcid'] is None): - raise ValueError("Missing the required parameter `orcid` when calling `lookup_creator`") # noqa: E501 + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `update_file`") # noqa: E501 + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `update_file`") # noqa: E501 - if ('orcid' in params and - len(params['orcid']) > 19): - raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, length must be less than or equal to `19`") # noqa: E501 - if ('orcid' in params and - len(params['orcid']) < 19): - raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, length must be greater than or equal to `19`") # noqa: E501 - if 'orcid' in params and not re.search('\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]', params['orcid']): # noqa: E501 - raise ValueError("Invalid value for parameter `orcid` when calling `lookup_creator`, must conform to the pattern `/\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]/`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'orcid' in params: - query_params.append(('orcid', params['orcid'])) # noqa: E501 header_params = {} @@ -3311,6 +4323,8 @@ class DefaultApi(object): local_var_files = {} body_params = None + if 'entity' in params: + body_params = params['entity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -3323,14 +4337,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/creator/lookup', 'GET', + '/file/{id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='CreatorEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -3338,43 +4352,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def lookup_file(self, sha1, **kwargs): # noqa: E501 - """lookup_file # noqa: E501 + def update_release(self, id, entity, **kwargs): # noqa: E501 + """update_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_file(sha1, async=True) + >>> thread = api.update_release(id, entity, async=True) >>> result = thread.get() :param async bool - :param str sha1: (required) - :return: FileEntity + :param str id: (required) + :param ReleaseEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.lookup_file_with_http_info(sha1, **kwargs) # noqa: E501 + return self.update_release_with_http_info(id, entity, **kwargs) # noqa: E501 else: - (data) = self.lookup_file_with_http_info(sha1, **kwargs) # noqa: E501 + (data) = self.update_release_with_http_info(id, entity, **kwargs) # noqa: E501 return data - def lookup_file_with_http_info(self, sha1, **kwargs): # noqa: E501 - """lookup_file # noqa: E501 + def update_release_with_http_info(self, id, entity, **kwargs): # noqa: E501 + """update_release # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_file_with_http_info(sha1, async=True) + >>> thread = api.update_release_with_http_info(id, entity, async=True) >>> result = thread.get() :param async bool - :param str sha1: (required) - :return: FileEntity + :param str id: (required) + :param ReleaseEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['sha1'] # noqa: E501 + all_params = ['id', 'entity'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3385,22 +4401,26 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method lookup_file" % key + " to method update_release" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'sha1' is set - if ('sha1' not in params or - params['sha1'] is None): - raise ValueError("Missing the required parameter `sha1` when calling `lookup_file`") # noqa: E501 + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `update_release`") # noqa: E501 + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `update_release`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'sha1' in params: - query_params.append(('sha1', params['sha1'])) # noqa: E501 header_params = {} @@ -3408,6 +4428,8 @@ class DefaultApi(object): local_var_files = {} body_params = None + if 'entity' in params: + body_params = params['entity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -3420,14 +4442,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/file/lookup', 'GET', + '/release/{id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FileEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), @@ -3435,43 +4457,45 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) - def lookup_release(self, doi, **kwargs): # noqa: E501 - """lookup_release # noqa: E501 + def update_work(self, id, entity, **kwargs): # noqa: E501 + """update_work # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_release(doi, async=True) + >>> thread = api.update_work(id, entity, async=True) >>> result = thread.get() :param async bool - :param str doi: (required) - :return: ReleaseEntity + :param str id: (required) + :param WorkEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async'): - return self.lookup_release_with_http_info(doi, **kwargs) # noqa: E501 + return self.update_work_with_http_info(id, entity, **kwargs) # noqa: E501 else: - (data) = self.lookup_release_with_http_info(doi, **kwargs) # noqa: E501 + (data) = self.update_work_with_http_info(id, entity, **kwargs) # noqa: E501 return data - def lookup_release_with_http_info(self, doi, **kwargs): # noqa: E501 - """lookup_release # noqa: E501 + def update_work_with_http_info(self, id, entity, **kwargs): # noqa: E501 + """update_work # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True - >>> thread = api.lookup_release_with_http_info(doi, async=True) + >>> thread = api.update_work_with_http_info(id, entity, async=True) >>> result = thread.get() :param async bool - :param str doi: (required) - :return: ReleaseEntity + :param str id: (required) + :param WorkEntity entity: (required) + :return: EntityEdit If the method is called asynchronously, returns the request thread. """ - all_params = ['doi'] # noqa: E501 + all_params = ['id', 'entity'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -3482,22 +4506,26 @@ class DefaultApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method lookup_release" % key + " to method update_work" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'doi' is set - if ('doi' not in params or - params['doi'] is None): - raise ValueError("Missing the required parameter `doi` when calling `lookup_release`") # noqa: E501 + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `update_work`") # noqa: E501 + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `update_work`") # noqa: E501 collection_formats = {} path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if 'doi' in params: - query_params.append(('doi', params['doi'])) # noqa: E501 header_params = {} @@ -3505,6 +4533,8 @@ class DefaultApi(object): local_var_files = {} body_params = None + if 'entity' in params: + body_params = params['entity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 @@ -3517,14 +4547,14 @@ class DefaultApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/release/lookup', 'GET', + '/work/{id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ReleaseEntity', # noqa: E501 + response_type='EntityEdit', # noqa: E501 auth_settings=auth_settings, async=params.get('async'), _return_http_data_only=params.get('_return_http_data_only'), diff --git a/python/tests/codegen_tests/test_default_api.py b/python/tests/codegen_tests/test_default_api.py index e3008898..ec36887b 100644 --- a/python/tests/codegen_tests/test_default_api.py +++ b/python/tests/codegen_tests/test_default_api.py @@ -101,6 +101,36 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_delete_container(self): + """Test case for delete_container + + """ + pass + + def test_delete_creator(self): + """Test case for delete_creator + + """ + pass + + def test_delete_file(self): + """Test case for delete_file + + """ + pass + + def test_delete_release(self): + """Test case for delete_release + + """ + pass + + def test_delete_work(self): + """Test case for delete_work + + """ + pass + def test_get_changelog(self): """Test case for get_changelog @@ -239,6 +269,36 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_update_container(self): + """Test case for update_container + + """ + pass + + def test_update_creator(self): + """Test case for update_creator + + """ + pass + + def test_update_file(self): + """Test case for update_file + + """ + pass + + def test_update_release(self): + """Test case for update_release + + """ + pass + + def test_update_work(self): + """Test case for update_work + + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/rust/TODO b/rust/TODO index ed38b915..05ad76d8 100644 --- a/rust/TODO +++ b/rust/TODO @@ -1,4 +1,6 @@ +- database_entity_crud -> api_entity_crud +- merge autoaccept branch in with http-verbs branch - fatcat_api -> fatcat_api_schema (or spec? models? types?) - fatcat -> fatcat-api-server - refactor rev creation (from an entity) into it's own function, across the board diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 56fbca19..31b71395 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -39,7 +39,6 @@ macro_rules! entity_batch_handler { if autoaccept { let _clr: ChangelogRow = diesel::insert_into(changelog::table) - // if autoaccept, eg_id is always Some .values((changelog::editgroup_id.eq(edit_context.editgroup_id.to_uuid()),)) .get_result(conn)?; } -- cgit v1.2.3