From e18cbbc40f500bc76df9862658df2958568fd3c6 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 1 Feb 2022 14:42:12 +0000 Subject: [PATCH 1/5] Implement create affiliation mutation --- thothlibrary/client.py | 4 ++++ thothlibrary/mutation.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/thothlibrary/client.py b/thothlibrary/client.py index a6bc24a..ca29136 100644 --- a/thothlibrary/client.py +++ b/thothlibrary/client.py @@ -103,6 +103,10 @@ 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) + @staticmethod def supported_versions(): """ diff --git a/thothlibrary/mutation.py b/thothlibrary/mutation.py index 0e0dcdb..b1d13e3 100644 --- a/thothlibrary/mutation.py +++ b/thothlibrary/mutation.py @@ -151,13 +151,22 @@ 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" + }, "updateWork": { "fields": [ ("workId", True), From cd6a5a4310d316132e3f9500d27179a2b24d23c4 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 1 Feb 2022 14:44:52 +0000 Subject: [PATCH 2/5] Implement create institutionmutation --- thothlibrary/client.py | 5 +++++ thothlibrary/mutation.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/thothlibrary/client.py b/thothlibrary/client.py index ca29136..cd13e84 100644 --- a/thothlibrary/client.py +++ b/thothlibrary/client.py @@ -107,6 +107,11 @@ 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) + + @staticmethod def supported_versions(): """ diff --git a/thothlibrary/mutation.py b/thothlibrary/mutation.py index b1d13e3..84ec5db 100644 --- a/thothlibrary/mutation.py +++ b/thothlibrary/mutation.py @@ -167,6 +167,15 @@ class ThothMutation(): ], "return_value": "affiliationId" }, + "createInstitution": { + "fields": [ + ("institutionName", True), + ("institutionDoi", True), + ("ror", True), + ("countryCode", False) + ], + "return_value": "institutionId" + }, "updateWork": { "fields": [ ("workId", True), From 44e41b25515996d11a93af7bab024f0325e7ad84 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 1 Feb 2022 14:52:06 +0000 Subject: [PATCH 3/5] Implement create location mutation --- thothlibrary/client.py | 3 +++ thothlibrary/mutation.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/thothlibrary/client.py b/thothlibrary/client.py index cd13e84..9b5b82c 100644 --- a/thothlibrary/client.py +++ b/thothlibrary/client.py @@ -111,6 +111,9 @@ 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) @staticmethod def supported_versions(): diff --git a/thothlibrary/mutation.py b/thothlibrary/mutation.py index 84ec5db..7710080 100644 --- a/thothlibrary/mutation.py +++ b/thothlibrary/mutation.py @@ -84,8 +84,7 @@ class ThothMutation(): "fields": [ ("publicationType", False), ("workId", True), - ("isbn", True), - ("publicationUrl", True) + ("isbn", True) ], "return_value": "publicationId" }, @@ -176,6 +175,16 @@ class ThothMutation(): ], "return_value": "institutionId" }, + "createLocation": { + "fields": [ + ("publicationId", True), + ("landingPage", True), + ("fullTextUrl", True), + ("locationPlatform", False), + ("canonical", False) + ], + "return_value": "locationId" + }, "updateWork": { "fields": [ ("workId", True), From 8735bd6704791244bc28b7c9dfcf0889aa2bb839 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 1 Feb 2022 15:23:31 +0000 Subject: [PATCH 4/5] Implement create funding mutation --- thothlibrary/client.py | 4 ++++ thothlibrary/mutation.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/thothlibrary/client.py b/thothlibrary/client.py index 9b5b82c..9da2140 100644 --- a/thothlibrary/client.py +++ b/thothlibrary/client.py @@ -115,6 +115,10 @@ 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(): """ diff --git a/thothlibrary/mutation.py b/thothlibrary/mutation.py index 7710080..a0d8b97 100644 --- a/thothlibrary/mutation.py +++ b/thothlibrary/mutation.py @@ -185,6 +185,18 @@ class ThothMutation(): ], "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), From 5e1b43bd692ab340ccec1f9cf0144b73600317ec Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 1 Feb 2022 15:25:56 +0000 Subject: [PATCH 5/5] Bump v0.9.0 --- README.md | 2 +- thothlibrary/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d20c3cf..fa2a352 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/thothlibrary/__init__.py b/thothlibrary/__init__.py index b14b94d..3e034c4 100644 --- a/thothlibrary/__init__.py +++ b/thothlibrary/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """GraphQL client for Thoth""" -__version__ = "0.8.3" +__version__ = "0.9.0" __author__ = "Javier Arias " __copyright__ = "Copyright (c) 2020 Open Book Publishers" __license__ = "Apache 2.0"