Skip to content

Commit

Permalink
Merge branch 'release/v0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Feb 1, 2022
2 parents 1e9c4e8 + 5e1b43b commit d73d0ae
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install is either via pip or cloning the repository.

From pip:
```sh
python3 -m pip install thothlibrary==0.8.3
python3 -m pip install thothlibrary==0.9.0
```

Or from the repo:
Expand Down
2 changes: 1 addition & 1 deletion thothlibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""GraphQL client for Thoth"""

__version__ = "0.8.3"
__version__ = "0.9.0"
__author__ = "Javier Arias <[email protected]>"
__copyright__ = "Copyright (c) 2020 Open Book Publishers"
__license__ = "Apache 2.0"
Expand Down
16 changes: 16 additions & 0 deletions thothlibrary/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ def create_contribution(self, contribution):
"""Construct and trigger a mutation to add a new contribution object"""
return self.mutation("createContribution", contribution)

def create_affiliation(self, affiliation):
"""Construct and trigger a mutation to add a new affiliation object"""
return self.mutation("createAffiliation", affiliation)

def create_institution(self, institution):
"""Construct and trigger a mutation to add a new institution object"""
return self.mutation("createInstitution", institution)

def create_location(self, location):
"""Construct and trigger a mutation to add a new location object"""
return self.mutation("createLocation", location)

def create_funding(self, funding):
"""Construct and trigger a mutation to add a new funding object"""
return self.mutation("createFunding", funding)

@staticmethod
def supported_versions():
"""
Expand Down
45 changes: 42 additions & 3 deletions thothlibrary/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ class ThothMutation():
"fields": [
("publicationType", False),
("workId", True),
("isbn", True),
("publicationUrl", True)
("isbn", True)
],
"return_value": "publicationId"
},
Expand Down Expand Up @@ -151,13 +150,53 @@ class ThothMutation():
("contributionType", False),
("mainContribution", False),
("biography", True),
("institution", True),
("contributionOrdinal", False),
("firstName", True),
("lastName", True),
("fullName", True)
],
"return_value": "workId"
},
"createAffiliation": {
"fields": [
("contributionId", True),
("institutionId", True),
("affiliationOrdinal", False),
("position", True)
],
"return_value": "affiliationId"
},
"createInstitution": {
"fields": [
("institutionName", True),
("institutionDoi", True),
("ror", True),
("countryCode", False)
],
"return_value": "institutionId"
},
"createLocation": {
"fields": [
("publicationId", True),
("landingPage", True),
("fullTextUrl", True),
("locationPlatform", False),
("canonical", False)
],
"return_value": "locationId"
},
"createFunding": {
"fields": [
("workId", True),
("institutionId", True),
("program", True),
("projectName", False),
("projectShortname", False),
("grantNumber", False),
("jurisdiction", False)
],
"return_value": "fundingId"
},
"updateWork": {
"fields": [
("workId", True),
Expand Down

0 comments on commit d73d0ae

Please sign in to comment.