aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fatcat-openapi2.yml28
-rw-r--r--rust/fatcat-api-spec/README.md22
-rw-r--r--rust/fatcat-api-spec/api.yaml458
-rw-r--r--rust/fatcat-api-spec/api/swagger.yaml1260
-rw-r--r--rust/fatcat-api-spec/examples/client.rs169
-rw-r--r--rust/fatcat-api-spec/examples/server_lib/server.rs213
-rw-r--r--rust/fatcat-api-spec/src/client.rs1393
-rw-r--r--rust/fatcat-api-spec/src/lib.rs464
-rw-r--r--rust/fatcat-api-spec/src/mimetypes.rs320
-rw-r--r--rust/fatcat-api-spec/src/models.rs34
-rw-r--r--rust/fatcat-api-spec/src/server.rs1866
11 files changed, 6071 insertions, 156 deletions
diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml
index f7deb6d4..e452e945 100644
--- a/fatcat-openapi2.yml
+++ b/fatcat-openapi2.yml
@@ -135,14 +135,14 @@ definitions:
type: integer
example: 1048576
format: int64
- sha1:
- type: string
- #format: custom
- example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8"
md5:
type: string
#format: custom
example: "d41efcc592d1e40ac13905377399eb9b"
+ sha1:
+ type: string
+ #format: custom
+ example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8"
sha256:
type: string
#format: custom
@@ -673,7 +673,7 @@ paths:
200:
description: Deleted Edit
schema:
- $ref: "#/definitions/entity_edit"
+ $ref: "#/definitions/success"
<<: *ENTITYRESPONSES
/creator:
post:
@@ -863,7 +863,7 @@ paths:
items:
$ref: "#/definitions/release_entity"
<<: *ENTITYRESPONSES
- /release/{id}/redirects:
+ /creator/{id}/redirects:
parameters:
- name: id
in: path
@@ -871,8 +871,8 @@ paths:
required: true
get:
tags: # TAGLINE
- - releases # TAGLINE
- operationId: "get_release_redirects"
+ - creators # TAGLINE
+ operationId: "get_creator_redirects"
responses:
200:
description: Found Entity Redirects
@@ -937,7 +937,7 @@ paths:
200:
description: Deleted Edit
schema:
- $ref: "#/definitions/entity_edit"
+ $ref: "#/definitions/success"
<<: *ENTITYRESPONSES
/file:
post:
@@ -1129,11 +1129,11 @@ paths:
tags: # TAGLINE
- files # TAGLINE
parameters:
- - name: sha1
+ - name: md5
in: query
type: string
required: false
- - name: md5
+ - name: sha1
in: query
type: string
required: false
@@ -1183,7 +1183,7 @@ paths:
200:
description: Deleted Edit
schema:
- $ref: "#/definitions/entity_edit"
+ $ref: "#/definitions/success"
<<: *ENTITYRESPONSES
/release:
post:
@@ -1460,7 +1460,7 @@ paths:
200:
description: Deleted Edit
schema:
- $ref: "#/definitions/entity_edit"
+ $ref: "#/definitions/success"
<<: *ENTITYRESPONSES
/work:
post:
@@ -1700,7 +1700,7 @@ paths:
200:
description: Deleted Edit
schema:
- $ref: "#/definitions/entity_edit"
+ $ref: "#/definitions/success"
<<: *ENTITYRESPONSES
/editor/{id}:
parameters:
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md
index 0be0b94c..f0466320 100644
--- a/rust/fatcat-api-spec/README.md
+++ b/rust/fatcat-api-spec/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-11-27T07:17:13.513Z
+- Build date: 2018-12-13T11:34:47.140Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
@@ -59,16 +59,24 @@ To run a client, follow one of the following simple steps:
cargo run --example client CreateContainer
cargo run --example client CreateContainerBatch
cargo run --example client DeleteContainer
+cargo run --example client DeleteContainerEdit
cargo run --example client GetContainer
+cargo run --example client GetContainerEdit
cargo run --example client GetContainerHistory
+cargo run --example client GetContainerRedirects
+cargo run --example client GetContainerRevision
cargo run --example client LookupContainer
cargo run --example client UpdateContainer
cargo run --example client CreateCreator
cargo run --example client CreateCreatorBatch
cargo run --example client DeleteCreator
+cargo run --example client DeleteCreatorEdit
cargo run --example client GetCreator
+cargo run --example client GetCreatorEdit
cargo run --example client GetCreatorHistory
+cargo run --example client GetCreatorRedirects
cargo run --example client GetCreatorReleases
+cargo run --example client GetCreatorRevision
cargo run --example client LookupCreator
cargo run --example client UpdateCreator
cargo run --example client GetEditor
@@ -82,24 +90,36 @@ cargo run --example client GetEditgroup
cargo run --example client CreateFile
cargo run --example client CreateFileBatch
cargo run --example client DeleteFile
+cargo run --example client DeleteFileEdit
cargo run --example client GetFile
+cargo run --example client GetFileEdit
cargo run --example client GetFileHistory
+cargo run --example client GetFileRedirects
+cargo run --example client GetFileRevision
cargo run --example client LookupFile
cargo run --example client UpdateFile
cargo run --example client CreateRelease
cargo run --example client CreateReleaseBatch
cargo run --example client CreateWork
cargo run --example client DeleteRelease
+cargo run --example client DeleteReleaseEdit
cargo run --example client GetRelease
+cargo run --example client GetReleaseEdit
cargo run --example client GetReleaseFiles
cargo run --example client GetReleaseHistory
+cargo run --example client GetReleaseRedirects
+cargo run --example client GetReleaseRevision
cargo run --example client LookupRelease
cargo run --example client UpdateRelease
cargo run --example client CreateWorkBatch
cargo run --example client DeleteWork
+cargo run --example client DeleteWorkEdit
cargo run --example client GetWork
+cargo run --example client GetWorkEdit
cargo run --example client GetWorkHistory
+cargo run --example client GetWorkRedirects
cargo run --example client GetWorkReleases
+cargo run --example client GetWorkRevision
cargo run --example client UpdateWork
```
diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml
index d998b63b..e452e945 100644
--- a/rust/fatcat-api-spec/api.yaml
+++ b/rust/fatcat-api-spec/api.yaml
@@ -92,13 +92,13 @@ definitions:
example: "The computers did the thing successfully!"
container_entity:
type: object
- required:
- - name
+ # required for creation: name
properties:
<<: *ENTITYPROPS
name:
type: string
example: "Journal of Important Results"
+ description: "Required for valid entities"
publisher:
type: string
example: "Society of Curious Students"
@@ -112,13 +112,13 @@ definitions:
type: string
creator_entity:
type: object
- required:
- - display_name
+ # required for creation: display_name
properties:
<<: *ENTITYPROPS
display_name:
type: string
example: "Grace Hopper"
+ description: "Required for valid entities"
given_name:
type: string
surname:
@@ -135,14 +135,14 @@ definitions:
type: integer
example: 1048576
format: int64
- sha1:
- type: string
- #format: custom
- example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8"
md5:
type: string
#format: custom
example: "d41efcc592d1e40ac13905377399eb9b"
+ sha1:
+ type: string
+ #format: custom
+ example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8"
sha256:
type: string
#format: custom
@@ -172,12 +172,12 @@ definitions:
#format: uuid
release_entity:
type: object
- required:
- - title
+ # required for creation: title
properties:
<<: *ENTITYPROPS
title:
type: string
+ description: "Required for valid entities"
work_id:
type: string
example: "q3nouwy3nnbsvo3h5klxsx4a7y"
@@ -548,6 +548,34 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+ /container/rev/{id}:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ #format: uuid
+ required: true
+ get:
+ operationId: "get_container_revision"
+ tags: # TAGLINE
+ - containers # TAGLINE
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For containers, none accepted (yet)."
+ - name: hide
+ in: query
+ type: string
+ required: false
+ description: "List of entity fields to elide in response. For containers, none accepted (yet)."
+ responses:
+ 200:
+ description: Found Entity Revision
+ schema:
+ $ref: "#/definitions/container_entity"
+ <<: *ENTITYRESPONSES
/container/{id}/history:
parameters:
- name: id
@@ -571,6 +599,25 @@ paths:
items:
$ref: "#/definitions/entity_history_entry"
<<: *ENTITYRESPONSES
+ /container/{id}/redirects:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ required: true
+ get:
+ tags: # TAGLINE
+ - containers # TAGLINE
+ operationId: "get_container_redirects"
+ responses:
+ 200:
+ description: Found Entity Redirects
+ schema:
+ type: array
+ items:
+ type: string
+ #format: ident
+ <<: *ENTITYRESPONSES
/container/lookup:
get:
operationId: "lookup_container"
@@ -579,8 +626,11 @@ paths:
parameters:
- name: issnl
in: query
- required: true
+ required: false
<<: *FATCATISSN
+ - name: wikidata_qid
+ in: query
+ required: false
- name: hide
in: query
type: string
@@ -592,6 +642,39 @@ paths:
schema:
$ref: "#/definitions/container_entity"
<<: *ENTITYRESPONSES
+ /container/edit/{edit_id}:
+ get:
+ operationId: "get_container_edit"
+ tags: # TAGLINE
+ - containers # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Found Edit
+ schema:
+ $ref: "#/definitions/entity_edit"
+ <<: *ENTITYRESPONSES
+ delete:
+ operationId: "delete_container_edit"
+ tags: # TAGLINE
+ - containers # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Deleted Edit
+ schema:
+ $ref: "#/definitions/success"
+ <<: *ENTITYRESPONSES
/creator:
post:
operationId: "create_creator"
@@ -706,6 +789,34 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+ /creator/rev/{id}:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ #format: uuid
+ required: true
+ get:
+ operationId: "get_creator_revision"
+ tags: # TAGLINE
+ - creators # TAGLINE
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For creators, none accepted (yet)."
+ - name: hide
+ in: query
+ type: string
+ required: false
+ description: "List of entity fields to elide in response. For creators, none accepted (yet)."
+ responses:
+ 200:
+ description: Found Entity Revision
+ schema:
+ $ref: "#/definitions/creator_entity"
+ <<: *ENTITYRESPONSES
/creator/{id}/history:
parameters:
- name: id
@@ -752,6 +863,25 @@ paths:
items:
$ref: "#/definitions/release_entity"
<<: *ENTITYRESPONSES
+ /creator/{id}/redirects:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ required: true
+ get:
+ tags: # TAGLINE
+ - creators # TAGLINE
+ operationId: "get_creator_redirects"
+ responses:
+ 200:
+ description: Found Entity Redirects
+ schema:
+ type: array
+ items:
+ type: string
+ #format: ident
+ <<: *ENTITYRESPONSES
/creator/lookup:
get:
operationId: "lookup_creator"
@@ -760,8 +890,11 @@ paths:
parameters:
- name: orcid
in: query
- required: true
+ required: false
<<: *FATCATORCID
+ - name: wikidata_qid
+ in: query
+ required: false
- name: hide
in: query
type: string
@@ -773,6 +906,39 @@ paths:
schema:
$ref: "#/definitions/creator_entity"
<<: *ENTITYRESPONSES
+ /creator/edit/{edit_id}:
+ get:
+ operationId: "get_creator_edit"
+ tags: # TAGLINE
+ - creators # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Found Edit
+ schema:
+ $ref: "#/definitions/entity_edit"
+ <<: *ENTITYRESPONSES
+ delete:
+ operationId: "delete_creator_edit"
+ tags: # TAGLINE
+ - creators # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Deleted Edit
+ schema:
+ $ref: "#/definitions/success"
+ <<: *ENTITYRESPONSES
/file:
post:
operationId: "create_file"
@@ -887,6 +1053,34 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+ /file/rev/{id}:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ #format: uuid
+ required: true
+ get:
+ operationId: "get_file_revision"
+ tags: # TAGLINE
+ - files # TAGLINE
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For files, none accepted (yet)."
+ - name: hide
+ in: query
+ type: string
+ required: false
+ description: "List of entity fields to elide in response. For files, none accepted (yet)."
+ responses:
+ 200:
+ description: Found Entity Revision
+ schema:
+ $ref: "#/definitions/file_entity"
+ <<: *ENTITYRESPONSES
/file/{id}/history:
parameters:
- name: id
@@ -910,16 +1104,43 @@ paths:
items:
$ref: "#/definitions/entity_history_entry"
<<: *ENTITYRESPONSES
+ /file/{id}/redirects:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ required: true
+ get:
+ tags: # TAGLINE
+ - files # TAGLINE
+ operationId: "get_file_redirects"
+ responses:
+ 200:
+ description: Found Entity Redirects
+ schema:
+ type: array
+ items:
+ type: string
+ #format: ident
+ <<: *ENTITYRESPONSES
/file/lookup:
get:
operationId: "lookup_file"
tags: # TAGLINE
- files # TAGLINE
parameters:
+ - name: md5
+ in: query
+ type: string
+ required: false
- name: sha1
in: query
type: string
- required: true
+ required: false
+ - name: sha256
+ in: query
+ type: string
+ required: false
- name: hide
in: query
type: string
@@ -931,6 +1152,39 @@ paths:
schema:
$ref: "#/definitions/file_entity"
<<: *ENTITYRESPONSES
+ /file/edit/{edit_id}:
+ get:
+ operationId: "get_file_edit"
+ tags: # TAGLINE
+ - files # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Found Edit
+ schema:
+ $ref: "#/definitions/entity_edit"
+ <<: *ENTITYRESPONSES
+ delete:
+ operationId: "delete_file_edit"
+ tags: # TAGLINE
+ - files # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Deleted Edit
+ schema:
+ $ref: "#/definitions/success"
+ <<: *ENTITYRESPONSES
/release:
post:
operationId: "create_release"
@@ -1045,6 +1299,34 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+ /release/rev/{id}:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ #format: uuid
+ required: true
+ get:
+ operationId: "get_release_revision"
+ tags: # TAGLINE
+ - releases # TAGLINE
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For releases, none accepted (yet)."
+ - name: hide
+ in: query
+ type: string
+ required: false
+ description: "List of entity fields to elide in response. For releases, none accepted (yet)."
+ responses:
+ 200:
+ description: Found Entity Revision
+ schema:
+ $ref: "#/definitions/release_entity"
+ <<: *ENTITYRESPONSES
/release/{id}/history:
parameters:
- name: id
@@ -1091,6 +1373,25 @@ paths:
items:
$ref: "#/definitions/file_entity"
<<: *ENTITYRESPONSES
+ /release/{id}/redirects:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ required: true
+ get:
+ tags: # TAGLINE
+ - releases # TAGLINE
+ operationId: "get_release_redirects"
+ responses:
+ 200:
+ description: Found Entity Redirects
+ schema:
+ type: array
+ items:
+ type: string
+ #format: ident
+ <<: *ENTITYRESPONSES
/release/lookup:
get:
operationId: "lookup_release"
@@ -1100,7 +1401,23 @@ paths:
- name: doi
in: query
type: string
- required: true
+ required: false
+ - name: wikidata_qid
+ in: query
+ type: string
+ required: false
+ - name: isbn13
+ in: query
+ type: string
+ required: false
+ - name: pmid
+ in: query
+ type: string
+ required: false
+ - name: pmcid
+ in: query
+ type: string
+ required: false
- name: hide
in: query
type: string
@@ -1112,6 +1429,39 @@ paths:
schema:
$ref: "#/definitions/release_entity"
<<: *ENTITYRESPONSES
+ /release/edit/{edit_id}:
+ get:
+ operationId: "get_release_edit"
+ tags: # TAGLINE
+ - releases # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Found Edit
+ schema:
+ $ref: "#/definitions/entity_edit"
+ <<: *ENTITYRESPONSES
+ delete:
+ operationId: "delete_release_edit"
+ tags: # TAGLINE
+ - releases # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Deleted Edit
+ schema:
+ $ref: "#/definitions/success"
+ <<: *ENTITYRESPONSES
/work:
post:
operationId: "create_work"
@@ -1226,6 +1576,34 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+ /work/rev/{id}:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ #format: uuid
+ required: true
+ get:
+ operationId: "get_work_revision"
+ tags: # TAGLINE
+ - works # TAGLINE
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For works, none accepted (yet)."
+ - name: hide
+ in: query
+ type: string
+ required: false
+ description: "List of entity fields to elide in response. For works, none accepted (yet)."
+ responses:
+ 200:
+ description: Found Entity Revision
+ schema:
+ $ref: "#/definitions/work_entity"
+ <<: *ENTITYRESPONSES
/work/{id}/history:
parameters:
- name: id
@@ -1249,6 +1627,25 @@ paths:
items:
$ref: "#/definitions/entity_history_entry"
<<: *ENTITYRESPONSES
+ /work/{id}/redirects:
+ parameters:
+ - name: id
+ in: path
+ type: string
+ required: true
+ get:
+ tags: # TAGLINE
+ - works # TAGLINE
+ operationId: "get_work_redirects"
+ responses:
+ 200:
+ description: Found Entity Redirects
+ schema:
+ type: array
+ items:
+ type: string
+ #format: ident
+ <<: *ENTITYRESPONSES
/work/{id}/releases:
parameters:
- name: id
@@ -1272,6 +1669,39 @@ paths:
items:
$ref: "#/definitions/release_entity"
<<: *ENTITYRESPONSES
+ /work/edit/{edit_id}:
+ get:
+ operationId: "get_work_edit"
+ tags: # TAGLINE
+ - works # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Found Edit
+ schema:
+ $ref: "#/definitions/entity_edit"
+ <<: *ENTITYRESPONSES
+ delete:
+ operationId: "delete_work_edit"
+ tags: # TAGLINE
+ - works # TAGLINE
+ parameters:
+ - name: edit_id
+ in: path
+ type: integer
+ format: int64
+ required: true
+ responses:
+ 200:
+ description: Deleted Edit
+ schema:
+ $ref: "#/definitions/success"
+ <<: *ENTITYRESPONSES
/editor/{id}:
parameters:
- name: id
diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml
index 51f0630e..5891a24e 100644
--- a/rust/fatcat-api-spec/api/swagger.yaml
+++ b/rust/fatcat-api-spec/api/swagger.yaml
@@ -367,6 +367,76 @@ paths:
path: "/container/:id"
HttpMethod: "Delete"
httpmethod: "delete"
+ /container/rev/{id}:
+ get:
+ tags:
+ - "containers"
+ operationId: "get_container_revision"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For containers,\
+ \ none accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "hide"
+ in: "query"
+ description: "List of entity fields to elide in response. For containers,\
+ \ none accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"hide_example\".to_string())"
+ responses:
+ 200:
+ description: "Found Entity Revision"
+ schema:
+ $ref: "#/definitions/container_entity"
+ x-responseId: "FoundEntityRevision"
+ x-uppercaseResponseId: "FOUND_ENTITY_REVISION"
+ uppercase_operation_id: "GET_CONTAINER_REVISION"
+ uppercase_data_type: "CONTAINERENTITY"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CONTAINER_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CONTAINER_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CONTAINER_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_container_revision"
+ uppercase_operation_id: "GET_CONTAINER_REVISION"
+ path: "/container/rev/:id"
+ HttpMethod: "Get"
+ httpmethod: "get"
/container/{id}/history:
get:
tags:
@@ -430,6 +500,62 @@ paths:
path: "/container/:id/history"
HttpMethod: "Get"
httpmethod: "get"
+ /container/{id}/redirects:
+ get:
+ tags:
+ - "containers"
+ operationId: "get_container_redirects"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ responses:
+ 200:
+ description: "Found Entity Redirects"
+ schema:
+ type: "array"
+ items:
+ type: "string"
+ x-responseId: "FoundEntityRedirects"
+ x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS"
+ uppercase_operation_id: "GET_CONTAINER_REDIRECTS"
+ uppercase_data_type: "VEC<STRING>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CONTAINER_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CONTAINER_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CONTAINER_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_container_redirects"
+ uppercase_operation_id: "GET_CONTAINER_REDIRECTS"
+ path: "/container/:id/redirects"
+ HttpMethod: "Get"
+ httpmethod: "get"
/container/lookup:
get:
tags:
@@ -438,13 +564,18 @@ paths:
parameters:
- name: "issnl"
in: "query"
- required: true
+ required: false
type: "string"
maxLength: 9
minLength: 9
pattern: "\\d{4}-\\d{3}[0-9X]"
- formatString: "\\\"{}\\\""
- example: "\"issnl_example\".to_string()"
+ formatString: "{:?}"
+ example: "Some(\"issnl_example\".to_string())"
+ - name: "wikidata_qid"
+ in: "query"
+ required: false
+ formatString: "{:?}"
+ example: "Some(\"wikidata_qid_example\".to_string())"
- name: "hide"
in: "query"
description: "List of entity fields to elide in response. For container, none\
@@ -495,6 +626,115 @@ paths:
path: "/container/lookup"
HttpMethod: "Get"
httpmethod: "get"
+ /container/edit/{edit_id}:
+ get:
+ tags:
+ - "containers"
+ operationId: "get_container_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Found Edit"
+ schema:
+ $ref: "#/definitions/entity_edit"
+ x-responseId: "FoundEdit"
+ x-uppercaseResponseId: "FOUND_EDIT"
+ uppercase_operation_id: "GET_CONTAINER_EDIT"
+ uppercase_data_type: "ENTITYEDIT"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_container_edit"
+ uppercase_operation_id: "GET_CONTAINER_EDIT"
+ path: "/container/edit/:edit_id"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ delete:
+ tags:
+ - "containers"
+ operationId: "delete_container_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Deleted Edit"
+ schema:
+ $ref: "#/definitions/success"
+ x-responseId: "DeletedEdit"
+ x-uppercaseResponseId: "DELETED_EDIT"
+ uppercase_operation_id: "DELETE_CONTAINER_EDIT"
+ uppercase_data_type: "SUCCESS"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "DELETE_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "DELETE_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "DELETE_CONTAINER_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "delete_container_edit"
+ uppercase_operation_id: "DELETE_CONTAINER_EDIT"
+ path: "/container/edit/:edit_id"
+ HttpMethod: "Delete"
+ httpmethod: "delete"
/creator:
post:
tags:
@@ -841,6 +1081,76 @@ paths:
path: "/creator/:id"
HttpMethod: "Delete"
httpmethod: "delete"
+ /creator/rev/{id}:
+ get:
+ tags:
+ - "creators"
+ operationId: "get_creator_revision"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For creators, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "hide"
+ in: "query"
+ description: "List of entity fields to elide in response. For creators, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"hide_example\".to_string())"
+ responses:
+ 200:
+ description: "Found Entity Revision"
+ schema:
+ $ref: "#/definitions/creator_entity"
+ x-responseId: "FoundEntityRevision"
+ x-uppercaseResponseId: "FOUND_ENTITY_REVISION"
+ uppercase_operation_id: "GET_CREATOR_REVISION"
+ uppercase_data_type: "CREATORENTITY"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CREATOR_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CREATOR_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CREATOR_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_creator_revision"
+ uppercase_operation_id: "GET_CREATOR_REVISION"
+ path: "/creator/rev/:id"
+ HttpMethod: "Get"
+ httpmethod: "get"
/creator/{id}/history:
get:
tags:
@@ -968,6 +1278,62 @@ paths:
path: "/creator/:id/releases"
HttpMethod: "Get"
httpmethod: "get"
+ /creator/{id}/redirects:
+ get:
+ tags:
+ - "creators"
+ operationId: "get_creator_redirects"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ responses:
+ 200:
+ description: "Found Entity Redirects"
+ schema:
+ type: "array"
+ items:
+ type: "string"
+ x-responseId: "FoundEntityRedirects"
+ x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS"
+ uppercase_operation_id: "GET_CREATOR_REDIRECTS"
+ uppercase_data_type: "VEC<STRING>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CREATOR_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CREATOR_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CREATOR_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_creator_redirects"
+ uppercase_operation_id: "GET_CREATOR_REDIRECTS"
+ path: "/creator/:id/redirects"
+ HttpMethod: "Get"
+ httpmethod: "get"
/creator/lookup:
get:
tags:
@@ -976,13 +1342,18 @@ paths:
parameters:
- name: "orcid"
in: "query"
- required: true
+ required: false
type: "string"
maxLength: 19
minLength: 19
pattern: "\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]"
- formatString: "\\\"{}\\\""
- example: "\"orcid_example\".to_string()"
+ formatString: "{:?}"
+ example: "Some(\"orcid_example\".to_string())"
+ - name: "wikidata_qid"
+ in: "query"
+ required: false
+ formatString: "{:?}"
+ example: "Some(\"wikidata_qid_example\".to_string())"
- name: "hide"
in: "query"
description: "List of entity fields to elide in response. For creator, none\
@@ -1033,6 +1404,115 @@ paths:
path: "/creator/lookup"
HttpMethod: "Get"
httpmethod: "get"
+ /creator/edit/{edit_id}:
+ get:
+ tags:
+ - "creators"
+ operationId: "get_creator_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Found Edit"
+ schema:
+ $ref: "#/definitions/entity_edit"
+ x-responseId: "FoundEdit"
+ x-uppercaseResponseId: "FOUND_EDIT"
+ uppercase_operation_id: "GET_CREATOR_EDIT"
+ uppercase_data_type: "ENTITYEDIT"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_creator_edit"
+ uppercase_operation_id: "GET_CREATOR_EDIT"
+ path: "/creator/edit/:edit_id"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ delete:
+ tags:
+ - "creators"
+ operationId: "delete_creator_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Deleted Edit"
+ schema:
+ $ref: "#/definitions/success"
+ x-responseId: "DeletedEdit"
+ x-uppercaseResponseId: "DELETED_EDIT"
+ uppercase_operation_id: "DELETE_CREATOR_EDIT"
+ uppercase_data_type: "SUCCESS"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "DELETE_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "DELETE_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "DELETE_CREATOR_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "delete_creator_edit"
+ uppercase_operation_id: "DELETE_CREATOR_EDIT"
+ path: "/creator/edit/:edit_id"
+ HttpMethod: "Delete"
+ httpmethod: "delete"
/file:
post:
tags:
@@ -1379,6 +1859,76 @@ paths:
path: "/file/:id"
HttpMethod: "Delete"
httpmethod: "delete"
+ /file/rev/{id}:
+ get:
+ tags:
+ - "files"
+ operationId: "get_file_revision"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For files, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "hide"
+ in: "query"
+ description: "List of entity fields to elide in response. For files, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"hide_example\".to_string())"
+ responses:
+ 200:
+ description: "Found Entity Revision"
+ schema:
+ $ref: "#/definitions/file_entity"
+ x-responseId: "FoundEntityRevision"
+ x-uppercaseResponseId: "FOUND_ENTITY_REVISION"
+ uppercase_operation_id: "GET_FILE_REVISION"
+ uppercase_data_type: "FILEENTITY"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_FILE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_FILE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_FILE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_file_revision"
+ uppercase_operation_id: "GET_FILE_REVISION"
+ path: "/file/rev/:id"
+ HttpMethod: "Get"
+ httpmethod: "get"
/file/{id}/history:
get:
tags:
@@ -1442,18 +1992,86 @@ paths:
path: "/file/:id/history"
HttpMethod: "Get"
httpmethod: "get"
+ /file/{id}/redirects:
+ get:
+ tags:
+ - "files"
+ operationId: "get_file_redirects"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ responses:
+ 200:
+ description: "Found Entity Redirects"
+ schema:
+ type: "array"
+ items:
+ type: "string"
+ x-responseId: "FoundEntityRedirects"
+ x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS"
+ uppercase_operation_id: "GET_FILE_REDIRECTS"
+ uppercase_data_type: "VEC<STRING>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_FILE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_FILE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_FILE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_file_redirects"
+ uppercase_operation_id: "GET_FILE_REDIRECTS"
+ path: "/file/:id/redirects"
+ HttpMethod: "Get"
+ httpmethod: "get"
/file/lookup:
get:
tags:
- "files"
operationId: "lookup_file"
parameters:
+ - name: "md5"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"md5_example\".to_string())"
- name: "sha1"
in: "query"
- required: true
+ required: false
type: "string"
- formatString: "\\\"{}\\\""
- example: "\"sha1_example\".to_string()"
+ formatString: "{:?}"
+ example: "Some(\"sha1_example\".to_string())"
+ - name: "sha256"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"sha256_example\".to_string())"
- name: "hide"
in: "query"
description: "List of entity fields to elide in response. For files, none\
@@ -1504,6 +2122,115 @@ paths:
path: "/file/lookup"
HttpMethod: "Get"
httpmethod: "get"
+ /file/edit/{edit_id}:
+ get:
+ tags:
+ - "files"
+ operationId: "get_file_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Found Edit"
+ schema:
+ $ref: "#/definitions/entity_edit"
+ x-responseId: "FoundEdit"
+ x-uppercaseResponseId: "FOUND_EDIT"
+ uppercase_operation_id: "GET_FILE_EDIT"
+ uppercase_data_type: "ENTITYEDIT"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_file_edit"
+ uppercase_operation_id: "GET_FILE_EDIT"
+ path: "/file/edit/:edit_id"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ delete:
+ tags:
+ - "files"
+ operationId: "delete_file_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Deleted Edit"
+ schema:
+ $ref: "#/definitions/success"
+ x-responseId: "DeletedEdit"
+ x-uppercaseResponseId: "DELETED_EDIT"
+ uppercase_operation_id: "DELETE_FILE_EDIT"
+ uppercase_data_type: "SUCCESS"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "DELETE_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "DELETE_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "DELETE_FILE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "delete_file_edit"
+ uppercase_operation_id: "DELETE_FILE_EDIT"
+ path: "/file/edit/:edit_id"
+ HttpMethod: "Delete"
+ httpmethod: "delete"
/release:
post:
tags:
@@ -1850,6 +2577,76 @@ paths:
path: "/release/:id"
HttpMethod: "Delete"
httpmethod: "delete"
+ /release/rev/{id}:
+ get:
+ tags:
+ - "releases"
+ operationId: "get_release_revision"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For releases, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "hide"
+ in: "query"
+ description: "List of entity fields to elide in response. For releases, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"hide_example\".to_string())"
+ responses:
+ 200:
+ description: "Found Entity Revision"
+ schema:
+ $ref: "#/definitions/release_entity"
+ x-responseId: "FoundEntityRevision"
+ x-uppercaseResponseId: "FOUND_ENTITY_REVISION"
+ uppercase_operation_id: "GET_RELEASE_REVISION"
+ uppercase_data_type: "RELEASEENTITY"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_RELEASE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_RELEASE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_RELEASE_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_release_revision"
+ uppercase_operation_id: "GET_RELEASE_REVISION"
+ path: "/release/rev/:id"
+ HttpMethod: "Get"
+ httpmethod: "get"
/release/{id}/history:
get:
tags:
@@ -1977,6 +2774,62 @@ paths:
path: "/release/:id/files"
HttpMethod: "Get"
httpmethod: "get"
+ /release/{id}/redirects:
+ get:
+ tags:
+ - "releases"
+ operationId: "get_release_redirects"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ responses:
+ 200:
+ description: "Found Entity Redirects"
+ schema:
+ type: "array"
+ items:
+ type: "string"
+ x-responseId: "FoundEntityRedirects"
+ x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS"
+ uppercase_operation_id: "GET_RELEASE_REDIRECTS"
+ uppercase_data_type: "VEC<STRING>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_RELEASE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_RELEASE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_RELEASE_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_release_redirects"
+ uppercase_operation_id: "GET_RELEASE_REDIRECTS"
+ path: "/release/:id/redirects"
+ HttpMethod: "Get"
+ httpmethod: "get"
/release/lookup:
get:
tags:
@@ -1985,10 +2838,34 @@ paths:
parameters:
- name: "doi"
in: "query"
- required: true
+ required: false
type: "string"
- formatString: "\\\"{}\\\""
- example: "\"doi_example\".to_string()"
+ formatString: "{:?}"
+ example: "Some(\"doi_example\".to_string())"
+ - name: "wikidata_qid"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"wikidata_qid_example\".to_string())"
+ - name: "isbn13"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"isbn13_example\".to_string())"
+ - name: "pmid"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"pmid_example\".to_string())"
+ - name: "pmcid"
+ in: "query"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"pmcid_example\".to_string())"
- name: "hide"
in: "query"
description: "List of entity fields to elide in response. For releases, 'abstracts',\
@@ -2039,6 +2916,115 @@ paths:
path: "/release/lookup"
HttpMethod: "Get"
httpmethod: "get"
+ /release/edit/{edit_id}:
+ get:
+ tags:
+ - "releases"
+ operationId: "get_release_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Found Edit"
+ schema:
+ $ref: "#/definitions/entity_edit"
+ x-responseId: "FoundEdit"
+ x-uppercaseResponseId: "FOUND_EDIT"
+ uppercase_operation_id: "GET_RELEASE_EDIT"
+ uppercase_data_type: "ENTITYEDIT"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_release_edit"
+ uppercase_operation_id: "GET_RELEASE_EDIT"
+ path: "/release/edit/:edit_id"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ delete:
+ tags:
+ - "releases"
+ operationId: "delete_release_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Deleted Edit"
+ schema:
+ $ref: "#/definitions/success"
+ x-responseId: "DeletedEdit"
+ x-uppercaseResponseId: "DELETED_EDIT"
+ uppercase_operation_id: "DELETE_RELEASE_EDIT"
+ uppercase_data_type: "SUCCESS"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "DELETE_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "DELETE_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "DELETE_RELEASE_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "delete_release_edit"
+ uppercase_operation_id: "DELETE_RELEASE_EDIT"
+ path: "/release/edit/:edit_id"
+ HttpMethod: "Delete"
+ httpmethod: "delete"
/work:
post:
tags:
@@ -2385,6 +3371,76 @@ paths:
path: "/work/:id"
HttpMethod: "Delete"
httpmethod: "delete"
+ /work/rev/{id}:
+ get:
+ tags:
+ - "works"
+ operationId: "get_work_revision"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For works, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "hide"
+ in: "query"
+ description: "List of entity fields to elide in response. For works, none\
+ \ accepted (yet)."
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"hide_example\".to_string())"
+ responses:
+ 200:
+ description: "Found Entity Revision"
+ schema:
+ $ref: "#/definitions/work_entity"
+ x-responseId: "FoundEntityRevision"
+ x-uppercaseResponseId: "FOUND_ENTITY_REVISION"
+ uppercase_operation_id: "GET_WORK_REVISION"
+ uppercase_data_type: "WORKENTITY"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_WORK_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_WORK_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_WORK_REVISION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_work_revision"
+ uppercase_operation_id: "GET_WORK_REVISION"
+ path: "/work/rev/:id"
+ HttpMethod: "Get"
+ httpmethod: "get"
/work/{id}/history:
get:
tags:
@@ -2448,6 +3504,62 @@ paths:
path: "/work/:id/history"
HttpMethod: "Get"
httpmethod: "get"
+ /work/{id}/redirects:
+ get:
+ tags:
+ - "works"
+ operationId: "get_work_redirects"
+ parameters:
+ - name: "id"
+ in: "path"
+ required: true
+ type: "string"
+ formatString: "\\\"{}\\\""
+ example: "\"id_example\".to_string()"
+ responses:
+ 200:
+ description: "Found Entity Redirects"
+ schema:
+ type: "array"
+ items:
+ type: "string"
+ x-responseId: "FoundEntityRedirects"
+ x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS"
+ uppercase_operation_id: "GET_WORK_REDIRECTS"
+ uppercase_data_type: "VEC<STRING>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_WORK_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_WORK_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_WORK_REDIRECTS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_work_redirects"
+ uppercase_operation_id: "GET_WORK_REDIRECTS"
+ path: "/work/:id/redirects"
+ HttpMethod: "Get"
+ httpmethod: "get"
/work/{id}/releases:
get:
tags:
@@ -2512,6 +3624,115 @@ paths:
path: "/work/:id/releases"
HttpMethod: "Get"
httpmethod: "get"
+ /work/edit/{edit_id}:
+ get:
+ tags:
+ - "works"
+ operationId: "get_work_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Found Edit"
+ schema:
+ $ref: "#/definitions/entity_edit"
+ x-responseId: "FoundEdit"
+ x-uppercaseResponseId: "FOUND_EDIT"
+ uppercase_operation_id: "GET_WORK_EDIT"
+ uppercase_data_type: "ENTITYEDIT"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "GET_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "GET_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_work_edit"
+ uppercase_operation_id: "GET_WORK_EDIT"
+ path: "/work/edit/:edit_id"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ delete:
+ tags:
+ - "works"
+ operationId: "delete_work_edit"
+ parameters:
+ - name: "edit_id"
+ in: "path"
+ required: true
+ type: "integer"
+ format: "int64"
+ formatString: "{}"
+ example: "789"
+ responses:
+ 200:
+ description: "Deleted Edit"
+ schema:
+ $ref: "#/definitions/success"
+ x-responseId: "DeletedEdit"
+ x-uppercaseResponseId: "DELETED_EDIT"
+ uppercase_operation_id: "DELETE_WORK_EDIT"
+ uppercase_data_type: "SUCCESS"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "DELETE_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 404:
+ description: "Not Found"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "NotFound"
+ x-uppercaseResponseId: "NOT_FOUND"
+ uppercase_operation_id: "DELETE_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 500:
+ description: "Generic Error"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "GenericError"
+ x-uppercaseResponseId: "GENERIC_ERROR"
+ uppercase_operation_id: "DELETE_WORK_EDIT"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "delete_work_edit"
+ uppercase_operation_id: "DELETE_WORK_EDIT"
+ path: "/work/edit/:edit_id"
+ HttpMethod: "Delete"
+ httpmethod: "delete"
/editor/{id}:
get:
operationId: "get_editor"
@@ -2937,8 +4158,6 @@ definitions:
upperCaseName: "SUCCESS"
container_entity:
type: "object"
- required:
- - "name"
properties:
coden:
type: "string"
@@ -2958,6 +4177,7 @@ definitions:
name:
type: "string"
example: "Journal of Important Results"
+ description: "Required for valid entities"
edit_extra:
type: "object"
extra:
@@ -3006,8 +4226,6 @@ definitions:
upperCaseName: "CONTAINER_ENTITY"
creator_entity:
type: "object"
- required:
- - "display_name"
properties:
wikidata_qid:
type: "string"
@@ -3024,6 +4242,7 @@ definitions:
display_name:
type: "string"
example: "Grace Hopper"
+ description: "Required for valid entities"
state:
type: "string"
enum:
@@ -3086,12 +4305,12 @@ definitions:
sha256:
type: "string"
example: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832"
- md5:
- type: "string"
- example: "d41efcc592d1e40ac13905377399eb9b"
sha1:
type: "string"
example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8"
+ md5:
+ type: "string"
+ example: "d41efcc592d1e40ac13905377399eb9b"
size:
type: "integer"
format: "int64"
@@ -3151,8 +4370,6 @@ definitions:
upperCaseName: "FILE_ENTITY"
release_entity:
type: "object"
- required:
- - "title"
properties:
abstracts:
type: "array"
@@ -3216,6 +4433,7 @@ definitions:
example: "q3nouwy3nnbsvo3h5klxsx4a7y"
title:
type: "string"
+ description: "Required for valid entities"
state:
type: "string"
enum:
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs
index 1273d892..f2d7a859 100644
--- a/rust/fatcat-api-spec/examples/client.rs
+++ b/rust/fatcat-api-spec/examples/client.rs
@@ -13,11 +13,14 @@ use clap::{App, Arg};
#[allow(unused_imports)]
use fatcat::{
AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse,
- CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse,
- DeleteCreatorResponse, DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse,
- GetCreatorHistoryResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse,
- GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse,
- LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
+ CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse,
+ DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse,
+ DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse,
+ GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse,
+ GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse,
+ GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse,
+ GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse,
+ LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
};
#[allow(unused_imports)]
use futures::{future, stream, Future, Stream};
@@ -30,14 +33,22 @@ fn main() {
.possible_values(&[
"CreateContainerBatch",
"DeleteContainer",
+ "DeleteContainerEdit",
"GetContainer",
+ "GetContainerEdit",
"GetContainerHistory",
+ "GetContainerRedirects",
+ "GetContainerRevision",
"LookupContainer",
"CreateCreatorBatch",
"DeleteCreator",
+ "DeleteCreatorEdit",
"GetCreator",
+ "GetCreatorEdit",
"GetCreatorHistory",
+ "GetCreatorRedirects",
"GetCreatorReleases",
+ "GetCreatorRevision",
"LookupCreator",
"GetEditor",
"GetEditorChangelog",
@@ -48,20 +59,32 @@ fn main() {
"GetEditgroup",
"CreateFileBatch",
"DeleteFile",
+ "DeleteFileEdit",
"GetFile",
+ "GetFileEdit",
"GetFileHistory",
+ "GetFileRedirects",
+ "GetFileRevision",
"LookupFile",
"CreateReleaseBatch",
"DeleteRelease",
+ "DeleteReleaseEdit",
"GetRelease",
+ "GetReleaseEdit",
"GetReleaseFiles",
"GetReleaseHistory",
+ "GetReleaseRedirects",
+ "GetReleaseRevision",
"LookupRelease",
"CreateWorkBatch",
"DeleteWork",
+ "DeleteWorkEdit",
"GetWork",
+ "GetWorkEdit",
"GetWorkHistory",
+ "GetWorkRedirects",
"GetWorkReleases",
+ "GetWorkRevision",
]).required(true)
.index(1),
).arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not"))
@@ -103,6 +126,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("DeleteContainerEdit") => {
+ let result = client.delete_container_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetContainer") => {
let result = client
.get_container("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
@@ -110,13 +138,32 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetContainerEdit") => {
+ let result = client.get_container_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetContainerHistory") => {
let result = client.get_container_history("id_example".to_string(), Some(789)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetContainerRedirects") => {
+ let result = client.get_container_redirects("id_example".to_string()).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
+ Some("GetContainerRevision") => {
+ let result = client
+ .get_container_revision("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
+ .wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("LookupContainer") => {
- let result = client.lookup_container("issnl_example".to_string(), Some("hide_example".to_string())).wait();
+ let result = client
+ .lookup_container(Some("issnl_example".to_string()), Some("wikidata_qid_example".to_string()), Some("hide_example".to_string()))
+ .wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -141,6 +188,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("DeleteCreatorEdit") => {
+ let result = client.delete_creator_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetCreator") => {
let result = client
.get_creator("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
@@ -148,18 +200,37 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetCreatorEdit") => {
+ let result = client.get_creator_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetCreatorHistory") => {
let result = client.get_creator_history("id_example".to_string(), Some(789)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetCreatorRedirects") => {
+ let result = client.get_creator_redirects("id_example".to_string()).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetCreatorReleases") => {
let result = client.get_creator_releases("id_example".to_string(), Some("hide_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetCreatorRevision") => {
+ let result = client
+ .get_creator_revision("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
+ .wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("LookupCreator") => {
- let result = client.lookup_creator("orcid_example".to_string(), Some("hide_example".to_string())).wait();
+ let result = client
+ .lookup_creator(Some("orcid_example".to_string()), Some("wikidata_qid_example".to_string()), Some("hide_example".to_string()))
+ .wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -223,18 +294,46 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("DeleteFileEdit") => {
+ let result = client.delete_file_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetFile") => {
let result = client.get_file("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetFileEdit") => {
+ let result = client.get_file_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetFileHistory") => {
let result = client.get_file_history("id_example".to_string(), Some(789)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetFileRedirects") => {
+ let result = client.get_file_redirects("id_example".to_string()).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
+ Some("GetFileRevision") => {
+ let result = client
+ .get_file_revision("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
+ .wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("LookupFile") => {
- let result = client.lookup_file("sha1_example".to_string(), Some("hide_example".to_string())).wait();
+ let result = client
+ .lookup_file(
+ Some("md5_example".to_string()),
+ Some("sha1_example".to_string()),
+ Some("sha256_example".to_string()),
+ Some("hide_example".to_string()),
+ ).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -264,6 +363,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("DeleteReleaseEdit") => {
+ let result = client.delete_release_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetRelease") => {
let result = client
.get_release("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
@@ -271,6 +375,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetReleaseEdit") => {
+ let result = client.get_release_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetReleaseFiles") => {
let result = client.get_release_files("id_example".to_string(), Some("hide_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
@@ -281,8 +390,28 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetReleaseRedirects") => {
+ let result = client.get_release_redirects("id_example".to_string()).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
+ Some("GetReleaseRevision") => {
+ let result = client
+ .get_release_revision("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
+ .wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("LookupRelease") => {
- let result = client.lookup_release("doi_example".to_string(), Some("hide_example".to_string())).wait();
+ let result = client
+ .lookup_release(
+ Some("doi_example".to_string()),
+ Some("wikidata_qid_example".to_string()),
+ Some("isbn13_example".to_string()),
+ Some("pmid_example".to_string()),
+ Some("pmcid_example".to_string()),
+ Some("hide_example".to_string()),
+ ).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -301,21 +430,43 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("DeleteWorkEdit") => {
+ let result = client.delete_work_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetWork") => {
let result = client.get_work("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetWorkEdit") => {
+ let result = client.get_work_edit(789).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetWorkHistory") => {
let result = client.get_work_history("id_example".to_string(), Some(789)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetWorkRedirects") => {
+ let result = client.get_work_redirects("id_example".to_string()).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetWorkReleases") => {
let result = client.get_work_releases("id_example".to_string(), Some("hide_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetWorkRevision") => {
+ let result = client
+ .get_work_revision("id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string()))
+ .wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
// Disabled because there's no example.
// Some("UpdateWork") => {
// let result = client.update_work("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs
index b11f26c3..7341e528 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-api-spec/examples/server_lib/server.rs
@@ -12,11 +12,14 @@ use swagger;
use fatcat::models;
use fatcat::{
AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse,
- CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse,
- DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse,
- GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse,
- GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse,
- LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
+ CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse,
+ DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse,
+ GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse,
+ GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse,
+ GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse, GetWorkHistoryResponse,
+ GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse,
+ UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
};
#[derive(Copy, Clone)]
@@ -63,6 +66,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -75,6 +84,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -86,11 +101,30 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_container(&self, issnl: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ fn get_container_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_container_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "get_container_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_container({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
issnl,
+ wikidata_qid,
hide,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
@@ -149,6 +183,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -161,6 +201,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -172,6 +218,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_creator_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_creator_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -183,11 +235,24 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_creator(&self, orcid: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "get_creator_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_creator({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
orcid,
+ wikidata_qid,
hide,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
@@ -294,6 +359,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -306,6 +377,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -317,9 +394,41 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_file(&self, sha1: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn get_file_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_file_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_file_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_file(
+ &self,
+ md5: Option<String>,
+ sha1: Option<String>,
+ sha256: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "lookup_file({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ md5,
+ sha1,
+ sha256,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -386,6 +495,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -398,6 +513,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_release_files(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -420,9 +541,45 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_release(&self, doi: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ fn get_release_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_release_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_release_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_release_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_release(
+ &self,
+ doi: Option<String>,
+ wikidata_qid: Option<String>,
+ isbn13: Option<String>,
+ pmid: Option<String>,
+ pmcid: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ doi,
+ wikidata_qid,
+ isbn13,
+ pmid,
+ pmcid,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -467,6 +624,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -479,6 +642,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -490,6 +659,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -501,6 +676,18 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_work_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index bc325361..5a5f4693 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -36,11 +36,14 @@ use swagger::{ApiError, Context, XSpanId};
use models;
use {
AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
- CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse, DeleteFileResponse,
- DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse,
- GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse,
- GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse,
- LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse,
+ DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse,
+ GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse,
+ GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse,
+ GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse, GetWorkHistoryResponse,
+ GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse,
+ UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
};
/// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes.
@@ -382,6 +385,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn delete_container_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/container/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteContainerEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
+
+ Ok(DeleteContainerEditResponse::DeletedEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteContainerEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteContainerEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteContainerEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_container(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
// Query parameters
let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
@@ -452,6 +519,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_container_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/container/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ Ok(GetContainerEditResponse::FoundEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_container_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
// Query parameters
let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
@@ -520,15 +651,163 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_container(&self, param_issnl: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ fn get_container_redirects(&self, param_id: String, context: &Context) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/container/{id}/redirects",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerRedirectsResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<Vec<String>>(&buf)?;
+
+ Ok(GetContainerRedirectsResponse::FoundEntityRedirects(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRedirectsResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRedirectsResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRedirectsResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn get_container_revision(
+ &self,
+ param_id: String,
+ param_expand: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
+
+ let url = format!(
+ "{}/v0/container/rev/{id}?{expand}{hide}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerRevisionResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
+
+ Ok(GetContainerRevisionResponse::FoundEntityRevision(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRevisionResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRevisionResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetContainerRevisionResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn lookup_container(
+ &self,
+ param_issnl: Option<String>,
+ param_wikidata_qid: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
+ let query_issnl = param_issnl.map_or_else(String::new, |query| format!("issnl={issnl}&", issnl = query.to_string()));
+ let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = query.to_string()));
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
let url = format!(
- "{}/v0/container/lookup?{issnl}{hide}",
+ "{}/v0/container/lookup?{issnl}{wikidata_qid}{hide}",
self.base_path,
issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET),
+ wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET),
hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
);
@@ -884,6 +1163,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn delete_creator_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/creator/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteCreatorEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
+
+ Ok(DeleteCreatorEditResponse::DeletedEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteCreatorEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteCreatorEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteCreatorEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_creator(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
@@ -954,6 +1297,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_creator_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/creator/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ Ok(GetCreatorEditResponse::FoundEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_creator_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
// Query parameters
let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
@@ -1022,6 +1429,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_creator_redirects(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator/{id}/redirects", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorRedirectsResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<Vec<String>>(&buf)?;
+
+ Ok(GetCreatorRedirectsResponse::FoundEntityRedirects(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRedirectsResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRedirectsResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRedirectsResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_creator_releases(&self, param_id: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
// Query parameters
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
@@ -1090,15 +1557,99 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_creator(&self, param_orcid: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_creator_revision(
+ &self,
+ param_id: String,
+ param_expand: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> {
// Query parameters
- let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
let url = format!(
- "{}/v0/creator/lookup?{orcid}{hide}",
+ "{}/v0/creator/rev/{id}?{expand}{hide}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorRevisionResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
+
+ Ok(GetCreatorRevisionResponse::FoundEntityRevision(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRevisionResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRevisionResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetCreatorRevisionResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn lookup_creator(
+ &self,
+ param_orcid: Option<String>,
+ param_wikidata_qid: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_orcid = param_orcid.map_or_else(String::new, |query| format!("orcid={orcid}&", orcid = query.to_string()));
+ let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = query.to_string()));
+ let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
+
+ let url = format!(
+ "{}/v0/creator/lookup?{orcid}{wikidata_qid}{hide}",
self.base_path,
orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET),
+ wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET),
hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
);
@@ -1910,6 +2461,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn delete_file_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/file/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteFileEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
+
+ Ok(DeleteFileEditResponse::DeletedEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteFileEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteFileEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteFileEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_file(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
// Query parameters
let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
@@ -1980,6 +2595,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_file_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/file/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetFileEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ Ok(GetFileEditResponse::FoundEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_file_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> {
// Query parameters
let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
@@ -2048,15 +2727,156 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_file(&self, param_sha1: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn get_file_redirects(&self, param_id: String, context: &Context) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file/{id}/redirects", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetFileRedirectsResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<Vec<String>>(&buf)?;
+
+ Ok(GetFileRedirectsResponse::FoundEntityRedirects(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRedirectsResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRedirectsResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRedirectsResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn get_file_revision(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> {
// Query parameters
- let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
let url = format!(
- "{}/v0/file/lookup?{sha1}{hide}",
+ "{}/v0/file/rev/{id}?{expand}{hide}",
self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetFileRevisionResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
+
+ Ok(GetFileRevisionResponse::FoundEntityRevision(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRevisionResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRevisionResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetFileRevisionResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn lookup_file(
+ &self,
+ param_md5: Option<String>,
+ param_sha1: Option<String>,
+ param_sha256: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_md5 = param_md5.map_or_else(String::new, |query| format!("md5={md5}&", md5 = query.to_string()));
+ let query_sha1 = param_sha1.map_or_else(String::new, |query| format!("sha1={sha1}&", sha1 = query.to_string()));
+ let query_sha256 = param_sha256.map_or_else(String::new, |query| format!("sha256={sha256}&", sha256 = query.to_string()));
+ let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/lookup?{md5}{sha1}{sha256}{hide}",
+ self.base_path,
+ md5 = utf8_percent_encode(&query_md5, QUERY_ENCODE_SET),
sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET),
+ sha256 = utf8_percent_encode(&query_sha256, QUERY_ENCODE_SET),
hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
);
@@ -2474,6 +3294,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn delete_release_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/release/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteReleaseEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
+
+ Ok(DeleteReleaseEditResponse::DeletedEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteReleaseEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteReleaseEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteReleaseEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_release(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
// Query parameters
let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
@@ -2544,6 +3428,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_release_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/release/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ Ok(GetReleaseEditResponse::FoundEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_release_files(&self, param_id: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
// Query parameters
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
@@ -2680,15 +3628,168 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_release(&self, param_doi: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ fn get_release_redirects(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release/{id}/redirects", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseRedirectsResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<Vec<String>>(&buf)?;
+
+ Ok(GetReleaseRedirectsResponse::FoundEntityRedirects(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRedirectsResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRedirectsResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRedirectsResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn get_release_revision(
+ &self,
+ param_id: String,
+ param_expand: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> {
// Query parameters
- let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
let url = format!(
- "{}/v0/release/lookup?{doi}{hide}",
+ "{}/v0/release/rev/{id}?{expand}{hide}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseRevisionResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
+
+ Ok(GetReleaseRevisionResponse::FoundEntityRevision(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRevisionResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRevisionResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetReleaseRevisionResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
+ fn lookup_release(
+ &self,
+ param_doi: Option<String>,
+ param_wikidata_qid: Option<String>,
+ param_isbn13: Option<String>,
+ param_pmid: Option<String>,
+ param_pmcid: Option<String>,
+ param_hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_doi = param_doi.map_or_else(String::new, |query| format!("doi={doi}&", doi = query.to_string()));
+ let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = query.to_string()));
+ let query_isbn13 = param_isbn13.map_or_else(String::new, |query| format!("isbn13={isbn13}&", isbn13 = query.to_string()));
+ let query_pmid = param_pmid.map_or_else(String::new, |query| format!("pmid={pmid}&", pmid = query.to_string()));
+ let query_pmcid = param_pmcid.map_or_else(String::new, |query| format!("pmcid={pmcid}&", pmcid = query.to_string()));
+ let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
+
+ let url = format!(
+ "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{hide}",
self.base_path,
doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET),
+ wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET),
+ isbn13 = utf8_percent_encode(&query_isbn13, QUERY_ENCODE_SET),
+ pmid = utf8_percent_encode(&query_pmid, QUERY_ENCODE_SET),
+ pmcid = utf8_percent_encode(&query_pmcid, QUERY_ENCODE_SET),
hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
);
@@ -2976,6 +4077,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn delete_work_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/work/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteWorkEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
+
+ Ok(DeleteWorkEditResponse::DeletedEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteWorkEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteWorkEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(DeleteWorkEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_work(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
// Query parameters
let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
@@ -3046,6 +4211,70 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_work_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/work/edit/{edit_id}",
+ self.base_path,
+ edit_id = utf8_percent_encode(&param_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkEditResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
+
+ Ok(GetWorkEditResponse::FoundEdit(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkEditResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkEditResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkEditResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_work_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
// Query parameters
let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
@@ -3114,6 +4343,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_work_redirects(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/{id}/redirects", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkRedirectsResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<Vec<String>>(&buf)?;
+
+ Ok(GetWorkRedirectsResponse::FoundEntityRedirects(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRedirectsResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRedirectsResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRedirectsResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn get_work_releases(&self, param_id: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
// Query parameters
let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
@@ -3182,6 +4471,76 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_work_revision(&self, param_id: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string()));
+
+ let url = format!(
+ "{}/v0/work/rev/{id}?{expand}{hide}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkRevisionResponse, ApiError> {
+ match response.status.to_u16() {
+ 200 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
+
+ Ok(GetWorkRevisionResponse::FoundEntityRevision(body))
+ }
+ 400 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRevisionResponse::BadRequest(body))
+ }
+ 404 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRevisionResponse::NotFound(body))
+ }
+ 500 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetWorkRevisionResponse::GenericError(body))
+ }
+ code => {
+ let mut buf = [0; 100];
+ let debug_body = match response.read(&mut buf) {
+ Ok(len) => match str::from_utf8(&buf[..len]) {
+ Ok(body) => Cow::from(body),
+ Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())),
+ },
+ Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
+ };
+ Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body)))
+ }
+ }
+ }
+
+ let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response);
+ Box::new(futures::done(result))
+ }
+
fn update_work(&self, param_id: String, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs
index 1650fbe6..dcc6e813 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -69,6 +69,18 @@ pub enum DeleteContainerResponse {
}
#[derive(Debug, PartialEq)]
+pub enum DeleteContainerEditResponse {
+ /// Deleted Edit
+ DeletedEdit(models::Success),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetContainerResponse {
/// Found Entity
FoundEntity(models::ContainerEntity),
@@ -81,6 +93,18 @@ pub enum GetContainerResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetContainerEditResponse {
+ /// Found Edit
+ FoundEdit(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetContainerHistoryResponse {
/// Found Entity History
FoundEntityHistory(Vec<models::EntityHistoryEntry>),
@@ -93,6 +117,30 @@ pub enum GetContainerHistoryResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetContainerRedirectsResponse {
+ /// Found Entity Redirects
+ FoundEntityRedirects(Vec<String>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
+pub enum GetContainerRevisionResponse {
+ /// Found Entity Revision
+ FoundEntityRevision(models::ContainerEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum LookupContainerResponse {
/// Found Entity
FoundEntity(models::ContainerEntity),
@@ -153,6 +201,18 @@ pub enum DeleteCreatorResponse {
}
#[derive(Debug, PartialEq)]
+pub enum DeleteCreatorEditResponse {
+ /// Deleted Edit
+ DeletedEdit(models::Success),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetCreatorResponse {
/// Found Entity
FoundEntity(models::CreatorEntity),
@@ -165,6 +225,18 @@ pub enum GetCreatorResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetCreatorEditResponse {
+ /// Found Edit
+ FoundEdit(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetCreatorHistoryResponse {
/// Found Entity History
FoundEntityHistory(Vec<models::EntityHistoryEntry>),
@@ -177,6 +249,18 @@ pub enum GetCreatorHistoryResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetCreatorRedirectsResponse {
+ /// Found Entity Redirects
+ FoundEntityRedirects(Vec<String>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetCreatorReleasesResponse {
/// Found
Found(Vec<models::ReleaseEntity>),
@@ -189,6 +273,18 @@ pub enum GetCreatorReleasesResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetCreatorRevisionResponse {
+ /// Found Entity Revision
+ FoundEntityRevision(models::CreatorEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum LookupCreatorResponse {
/// Found Entity
FoundEntity(models::CreatorEntity),
@@ -335,6 +431,18 @@ pub enum DeleteFileResponse {
}
#[derive(Debug, PartialEq)]
+pub enum DeleteFileEditResponse {
+ /// Deleted Edit
+ DeletedEdit(models::Success),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetFileResponse {
/// Found Entity
FoundEntity(models::FileEntity),
@@ -347,6 +455,18 @@ pub enum GetFileResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetFileEditResponse {
+ /// Found Edit
+ FoundEdit(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetFileHistoryResponse {
/// Found Entity History
FoundEntityHistory(Vec<models::EntityHistoryEntry>),
@@ -359,6 +479,30 @@ pub enum GetFileHistoryResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetFileRedirectsResponse {
+ /// Found Entity Redirects
+ FoundEntityRedirects(Vec<String>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
+pub enum GetFileRevisionResponse {
+ /// Found Entity Revision
+ FoundEntityRevision(models::FileEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum LookupFileResponse {
/// Found Entity
FoundEntity(models::FileEntity),
@@ -431,6 +575,18 @@ pub enum DeleteReleaseResponse {
}
#[derive(Debug, PartialEq)]
+pub enum DeleteReleaseEditResponse {
+ /// Deleted Edit
+ DeletedEdit(models::Success),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetReleaseResponse {
/// Found Entity
FoundEntity(models::ReleaseEntity),
@@ -443,6 +599,18 @@ pub enum GetReleaseResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetReleaseEditResponse {
+ /// Found Edit
+ FoundEdit(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetReleaseFilesResponse {
/// Found
Found(Vec<models::FileEntity>),
@@ -467,6 +635,30 @@ pub enum GetReleaseHistoryResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetReleaseRedirectsResponse {
+ /// Found Entity Redirects
+ FoundEntityRedirects(Vec<String>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
+pub enum GetReleaseRevisionResponse {
+ /// Found Entity Revision
+ FoundEntityRevision(models::ReleaseEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum LookupReleaseResponse {
/// Found Entity
FoundEntity(models::ReleaseEntity),
@@ -515,6 +707,18 @@ pub enum DeleteWorkResponse {
}
#[derive(Debug, PartialEq)]
+pub enum DeleteWorkEditResponse {
+ /// Deleted Edit
+ DeletedEdit(models::Success),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetWorkResponse {
/// Found Entity
FoundEntity(models::WorkEntity),
@@ -527,6 +731,18 @@ pub enum GetWorkResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetWorkEditResponse {
+ /// Found Edit
+ FoundEdit(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetWorkHistoryResponse {
/// Found Entity History
FoundEntityHistory(Vec<models::EntityHistoryEntry>),
@@ -539,6 +755,18 @@ pub enum GetWorkHistoryResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetWorkRedirectsResponse {
+ /// Found Entity Redirects
+ FoundEntityRedirects(Vec<String>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetWorkReleasesResponse {
/// Found
Found(Vec<models::ReleaseEntity>),
@@ -551,6 +779,18 @@ pub enum GetWorkReleasesResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetWorkRevisionResponse {
+ /// Found Entity Revision
+ FoundEntityRevision(models::WorkEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum UpdateWorkResponse {
/// Updated Entity
UpdatedEntity(models::EntityEdit),
@@ -576,11 +816,19 @@ pub trait Api {
fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
+ fn delete_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send>;
+
fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
+ fn get_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send>;
+
fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>;
- fn lookup_container(&self, issnl: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
+ fn get_container_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
@@ -596,13 +844,21 @@ pub trait Api {
fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
+ fn delete_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send>;
+
fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
+ fn get_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send>;
+
fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>;
+ fn get_creator_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send>;
+
fn get_creator_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
- fn lookup_creator(&self, orcid: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
+ fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
@@ -634,11 +890,26 @@ pub trait Api {
fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
+ fn delete_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send>;
+
fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
+ fn get_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send>;
+
fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>;
- fn lookup_file(&self, sha1: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
+ fn get_file_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_file(
+ &self,
+ md5: Option<String>,
+ sha1: Option<String>,
+ sha256: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
@@ -656,13 +927,30 @@ pub trait Api {
fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
+ fn delete_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send>;
+
fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
+ fn get_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send>;
+
fn get_release_files(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>;
- fn lookup_release(&self, doi: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
+ fn get_release_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_release_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_release(
+ &self,
+ doi: Option<String>,
+ wikidata_qid: Option<String>,
+ isbn13: Option<String>,
+ pmid: Option<String>,
+ pmcid: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
@@ -676,12 +964,20 @@ pub trait Api {
fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>;
+ fn delete_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send>;
+
fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
+ fn get_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send>;
+
fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>;
+ fn get_work_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send>;
+
fn get_work_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>;
+ fn get_work_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send>;
+
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
@@ -698,11 +994,19 @@ pub trait ApiNoContext {
fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
+ fn delete_container_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send>;
+
fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
+ fn get_container_edit(&self, edit_id: i64) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send>;
+
fn get_container_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>;
- fn lookup_container(&self, issnl: String, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
+ fn get_container_redirects(&self, id: String) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
@@ -717,13 +1021,21 @@ pub trait ApiNoContext {
fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
+ fn delete_creator_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send>;
+
fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
+ fn get_creator_edit(&self, edit_id: i64) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send>;
+
fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>;
+ fn get_creator_redirects(&self, id: String) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send>;
+
fn get_creator_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
- fn lookup_creator(&self, orcid: String, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
+ fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
@@ -749,11 +1061,19 @@ pub trait ApiNoContext {
fn delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
+ fn delete_file_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send>;
+
fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
+ fn get_file_edit(&self, edit_id: i64) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send>;
+
fn get_file_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>;
- fn lookup_file(&self, sha1: String, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
+ fn get_file_redirects(&self, id: String) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_file(&self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
@@ -770,13 +1090,29 @@ pub trait ApiNoContext {
fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
+ fn delete_release_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send>;
+
fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
+ fn get_release_edit(&self, edit_id: i64) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send>;
+
fn get_release_files(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>;
- fn lookup_release(&self, doi: String, hide: Option<String>) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
+ fn get_release_redirects(&self, id: String) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send>;
+
+ fn get_release_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send>;
+
+ fn lookup_release(
+ &self,
+ doi: Option<String>,
+ wikidata_qid: Option<String>,
+ isbn13: Option<String>,
+ pmid: Option<String>,
+ pmcid: Option<String>,
+ hide: Option<String>,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
@@ -784,12 +1120,20 @@ pub trait ApiNoContext {
fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>;
+ fn delete_work_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send>;
+
fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
+ fn get_work_edit(&self, edit_id: i64) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send>;
+
fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>;
+ fn get_work_redirects(&self, id: String) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send>;
+
fn get_work_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>;
+ fn get_work_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send>;
+
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
@@ -826,16 +1170,32 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().delete_container(id, editgroup, &self.context())
}
+ fn delete_container_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> {
+ self.api().delete_container_edit(edit_id, &self.context())
+ }
+
fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
self.api().get_container(id, expand, hide, &self.context())
}
+ fn get_container_edit(&self, edit_id: i64) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send> {
+ self.api().get_container_edit(edit_id, &self.context())
+ }
+
fn get_container_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
self.api().get_container_history(id, limit, &self.context())
}
- fn lookup_container(&self, issnl: String, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
- self.api().lookup_container(issnl, hide, &self.context())
+ fn get_container_redirects(&self, id: String) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> {
+ self.api().get_container_redirects(id, &self.context())
+ }
+
+ fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> {
+ self.api().get_container_revision(id, expand, hide, &self.context())
+ }
+
+ fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ self.api().lookup_container(issnl, wikidata_qid, hide, &self.context())
}
fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
@@ -859,20 +1219,36 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().delete_creator(id, editgroup, &self.context())
}
+ fn delete_creator_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> {
+ self.api().delete_creator_edit(edit_id, &self.context())
+ }
+
fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
self.api().get_creator(id, expand, hide, &self.context())
}
+ fn get_creator_edit(&self, edit_id: i64) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> {
+ self.api().get_creator_edit(edit_id, &self.context())
+ }
+
fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
self.api().get_creator_history(id, limit, &self.context())
}
+ fn get_creator_redirects(&self, id: String) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> {
+ self.api().get_creator_redirects(id, &self.context())
+ }
+
fn get_creator_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
self.api().get_creator_releases(id, hide, &self.context())
}
- fn lookup_creator(&self, orcid: String, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
- self.api().lookup_creator(orcid, hide, &self.context())
+ fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> {
+ self.api().get_creator_revision(id, expand, hide, &self.context())
+ }
+
+ fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ self.api().lookup_creator(orcid, wikidata_qid, hide, &self.context())
}
fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
@@ -923,16 +1299,32 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().delete_file(id, editgroup, &self.context())
}
+ fn delete_file_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> {
+ self.api().delete_file_edit(edit_id, &self.context())
+ }
+
fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
self.api().get_file(id, expand, hide, &self.context())
}
+ fn get_file_edit(&self, edit_id: i64) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send> {
+ self.api().get_file_edit(edit_id, &self.context())
+ }
+
fn get_file_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> {
self.api().get_file_history(id, limit, &self.context())
}
- fn lookup_file(&self, sha1: String, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
- self.api().lookup_file(sha1, hide, &self.context())
+ fn get_file_redirects(&self, id: String) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> {
+ self.api().get_file_redirects(id, &self.context())
+ }
+
+ fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> {
+ self.api().get_file_revision(id, expand, hide, &self.context())
+ }
+
+ fn lookup_file(&self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, hide: Option<String>) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ self.api().lookup_file(md5, sha1, sha256, hide, &self.context())
}
fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
@@ -960,10 +1352,18 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().delete_release(id, editgroup, &self.context())
}
+ fn delete_release_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> {
+ self.api().delete_release_edit(edit_id, &self.context())
+ }
+
fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
self.api().get_release(id, expand, hide, &self.context())
}
+ fn get_release_edit(&self, edit_id: i64) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> {
+ self.api().get_release_edit(edit_id, &self.context())
+ }
+
fn get_release_files(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
self.api().get_release_files(id, hide, &self.context())
}
@@ -972,8 +1372,24 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().get_release_history(id, limit, &self.context())
}
- fn lookup_release(&self, doi: String, hide: Option<String>) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
- self.api().lookup_release(doi, hide, &self.context())
+ fn get_release_redirects(&self, id: String) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> {
+ self.api().get_release_redirects(id, &self.context())
+ }
+
+ fn get_release_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> {
+ self.api().get_release_revision(id, expand, hide, &self.context())
+ }
+
+ fn lookup_release(
+ &self,
+ doi: Option<String>,
+ wikidata_qid: Option<String>,
+ isbn13: Option<String>,
+ pmid: Option<String>,
+ pmcid: Option<String>,
+ hide: Option<String>,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ self.api().lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, hide, &self.context())
}
fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
@@ -988,18 +1404,34 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().delete_work(id, editgroup, &self.context())
}
+ fn delete_work_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> {
+ self.api().delete_work_edit(edit_id, &self.context())
+ }
+
fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
self.api().get_work(id, expand, hide, &self.context())
}
+ fn get_work_edit(&self, edit_id: i64) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send> {
+ self.api().get_work_edit(edit_id, &self.context())
+ }
+
fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
self.api().get_work_history(id, limit, &self.context())
}
+ fn get_work_redirects(&self, id: String) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> {
+ self.api().get_work_redirects(id, &self.context())
+ }
+
fn get_work_releases(&self, id: String, hide: Option<String>) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
self.api().get_work_releases(id, hide, &self.context())
}
+ fn get_work_revision(&self, id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> {
+ self.api().get_work_revision(id, expand, hide, &self.context())
+ }
+
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
self.api().update_work(id, entity, editgroup, &self.context())
}
diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs
index dcf13f7a..b94aa6f6 100644
--- a/rust/fatcat-api-spec/src/mimetypes.rs
+++ b/rust/fatcat-api-spec/src/mimetypes.rs
@@ -52,6 +52,22 @@ pub mod responses {
lazy_static! {
pub static ref DELETE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for DeleteContainerEdit
+ lazy_static! {
+ pub static ref DELETE_CONTAINER_EDIT_DELETED_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteContainerEdit
+ lazy_static! {
+ pub static ref DELETE_CONTAINER_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteContainerEdit
+ lazy_static! {
+ pub static ref DELETE_CONTAINER_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteContainerEdit
+ lazy_static! {
+ pub static ref DELETE_CONTAINER_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetContainer
lazy_static! {
pub static ref GET_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -68,6 +84,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetContainerEdit
+ lazy_static! {
+ pub static ref GET_CONTAINER_EDIT_FOUND_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerEdit
+ lazy_static! {
+ pub static ref GET_CONTAINER_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerEdit
+ lazy_static! {
+ pub static ref GET_CONTAINER_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerEdit
+ lazy_static! {
+ pub static ref GET_CONTAINER_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetContainerHistory
lazy_static! {
pub static ref GET_CONTAINER_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
@@ -84,6 +116,38 @@ pub mod responses {
lazy_static! {
pub static ref GET_CONTAINER_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetContainerRedirects
+ lazy_static! {
+ pub static ref GET_CONTAINER_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRedirects
+ lazy_static! {
+ pub static ref GET_CONTAINER_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRedirects
+ lazy_static! {
+ pub static ref GET_CONTAINER_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRedirects
+ lazy_static! {
+ pub static ref GET_CONTAINER_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRevision
+ lazy_static! {
+ pub static ref GET_CONTAINER_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRevision
+ lazy_static! {
+ pub static ref GET_CONTAINER_REVISION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRevision
+ lazy_static! {
+ pub static ref GET_CONTAINER_REVISION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetContainerRevision
+ lazy_static! {
+ pub static ref GET_CONTAINER_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for LookupContainer
lazy_static! {
pub static ref LOOKUP_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -164,6 +228,22 @@ pub mod responses {
lazy_static! {
pub static ref DELETE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for DeleteCreatorEdit
+ lazy_static! {
+ pub static ref DELETE_CREATOR_EDIT_DELETED_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteCreatorEdit
+ lazy_static! {
+ pub static ref DELETE_CREATOR_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteCreatorEdit
+ lazy_static! {
+ pub static ref DELETE_CREATOR_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteCreatorEdit
+ lazy_static! {
+ pub static ref DELETE_CREATOR_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetCreator
lazy_static! {
pub static ref GET_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -180,6 +260,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetCreatorEdit
+ lazy_static! {
+ pub static ref GET_CREATOR_EDIT_FOUND_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorEdit
+ lazy_static! {
+ pub static ref GET_CREATOR_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorEdit
+ lazy_static! {
+ pub static ref GET_CREATOR_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorEdit
+ lazy_static! {
+ pub static ref GET_CREATOR_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetCreatorHistory
lazy_static! {
pub static ref GET_CREATOR_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
@@ -196,6 +292,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_CREATOR_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetCreatorRedirects
+ lazy_static! {
+ pub static ref GET_CREATOR_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRedirects
+ lazy_static! {
+ pub static ref GET_CREATOR_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRedirects
+ lazy_static! {
+ pub static ref GET_CREATOR_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRedirects
+ lazy_static! {
+ pub static ref GET_CREATOR_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
pub static ref GET_CREATOR_RELEASES_FOUND: Mime = mime!(Application / Json);
@@ -212,6 +324,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_CREATOR_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetCreatorRevision
+ lazy_static! {
+ pub static ref GET_CREATOR_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRevision
+ lazy_static! {
+ pub static ref GET_CREATOR_REVISION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRevision
+ lazy_static! {
+ pub static ref GET_CREATOR_REVISION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetCreatorRevision
+ lazy_static! {
+ pub static ref GET_CREATOR_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for LookupCreator
lazy_static! {
pub static ref LOOKUP_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -400,6 +528,22 @@ pub mod responses {
lazy_static! {
pub static ref DELETE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for DeleteFileEdit
+ lazy_static! {
+ pub static ref DELETE_FILE_EDIT_DELETED_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFileEdit
+ lazy_static! {
+ pub static ref DELETE_FILE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFileEdit
+ lazy_static! {
+ pub static ref DELETE_FILE_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFileEdit
+ lazy_static! {
+ pub static ref DELETE_FILE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetFile
lazy_static! {
pub static ref GET_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -416,6 +560,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetFileEdit
+ lazy_static! {
+ pub static ref GET_FILE_EDIT_FOUND_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileEdit
+ lazy_static! {
+ pub static ref GET_FILE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileEdit
+ lazy_static! {
+ pub static ref GET_FILE_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileEdit
+ lazy_static! {
+ pub static ref GET_FILE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetFileHistory
lazy_static! {
pub static ref GET_FILE_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
@@ -432,6 +592,38 @@ pub mod responses {
lazy_static! {
pub static ref GET_FILE_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetFileRedirects
+ lazy_static! {
+ pub static ref GET_FILE_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRedirects
+ lazy_static! {
+ pub static ref GET_FILE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRedirects
+ lazy_static! {
+ pub static ref GET_FILE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRedirects
+ lazy_static! {
+ pub static ref GET_FILE_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRevision
+ lazy_static! {
+ pub static ref GET_FILE_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRevision
+ lazy_static! {
+ pub static ref GET_FILE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRevision
+ lazy_static! {
+ pub static ref GET_FILE_REVISION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetFileRevision
+ lazy_static! {
+ pub static ref GET_FILE_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for LookupFile
lazy_static! {
pub static ref LOOKUP_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -528,6 +720,22 @@ pub mod responses {
lazy_static! {
pub static ref DELETE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for DeleteReleaseEdit
+ lazy_static! {
+ pub static ref DELETE_RELEASE_EDIT_DELETED_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteReleaseEdit
+ lazy_static! {
+ pub static ref DELETE_RELEASE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteReleaseEdit
+ lazy_static! {
+ pub static ref DELETE_RELEASE_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteReleaseEdit
+ lazy_static! {
+ pub static ref DELETE_RELEASE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetRelease
lazy_static! {
pub static ref GET_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -544,6 +752,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetReleaseEdit
+ lazy_static! {
+ pub static ref GET_RELEASE_EDIT_FOUND_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseEdit
+ lazy_static! {
+ pub static ref GET_RELEASE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseEdit
+ lazy_static! {
+ pub static ref GET_RELEASE_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseEdit
+ lazy_static! {
+ pub static ref GET_RELEASE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
pub static ref GET_RELEASE_FILES_FOUND: Mime = mime!(Application / Json);
@@ -576,6 +800,38 @@ pub mod responses {
lazy_static! {
pub static ref GET_RELEASE_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetReleaseRedirects
+ lazy_static! {
+ pub static ref GET_RELEASE_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRedirects
+ lazy_static! {
+ pub static ref GET_RELEASE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRedirects
+ lazy_static! {
+ pub static ref GET_RELEASE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRedirects
+ lazy_static! {
+ pub static ref GET_RELEASE_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRevision
+ lazy_static! {
+ pub static ref GET_RELEASE_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRevision
+ lazy_static! {
+ pub static ref GET_RELEASE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRevision
+ lazy_static! {
+ pub static ref GET_RELEASE_REVISION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetReleaseRevision
+ lazy_static! {
+ pub static ref GET_RELEASE_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for LookupRelease
lazy_static! {
pub static ref LOOKUP_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -640,6 +896,22 @@ pub mod responses {
lazy_static! {
pub static ref DELETE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for DeleteWorkEdit
+ lazy_static! {
+ pub static ref DELETE_WORK_EDIT_DELETED_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteWorkEdit
+ lazy_static! {
+ pub static ref DELETE_WORK_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteWorkEdit
+ lazy_static! {
+ pub static ref DELETE_WORK_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteWorkEdit
+ lazy_static! {
+ pub static ref DELETE_WORK_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetWork
lazy_static! {
pub static ref GET_WORK_FOUND_ENTITY: Mime = mime!(Application / Json);
@@ -656,6 +928,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetWorkEdit
+ lazy_static! {
+ pub static ref GET_WORK_EDIT_FOUND_EDIT: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkEdit
+ lazy_static! {
+ pub static ref GET_WORK_EDIT_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkEdit
+ lazy_static! {
+ pub static ref GET_WORK_EDIT_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkEdit
+ lazy_static! {
+ pub static ref GET_WORK_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetWorkHistory
lazy_static! {
pub static ref GET_WORK_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
@@ -672,6 +960,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_WORK_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetWorkRedirects
+ lazy_static! {
+ pub static ref GET_WORK_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRedirects
+ lazy_static! {
+ pub static ref GET_WORK_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRedirects
+ lazy_static! {
+ pub static ref GET_WORK_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRedirects
+ lazy_static! {
+ pub static ref GET_WORK_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetWorkReleases
lazy_static! {
pub static ref GET_WORK_RELEASES_FOUND: Mime = mime!(Application / Json);
@@ -688,6 +992,22 @@ pub mod responses {
lazy_static! {
pub static ref GET_WORK_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetWorkRevision
+ lazy_static! {
+ pub static ref GET_WORK_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRevision
+ lazy_static! {
+ pub static ref GET_WORK_REVISION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRevision
+ lazy_static! {
+ pub static ref GET_WORK_REVISION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkRevision
+ lazy_static! {
+ pub static ref GET_WORK_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for UpdateWork
lazy_static! {
pub static ref UPDATE_WORK_UPDATED_ENTITY: Mime = mime!(Application / Json);
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index 73418c45..6e374746 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -58,8 +58,10 @@ pub struct ContainerEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub publisher: Option<String>,
+ /// Required for valid entities
#[serde(rename = "name")]
- pub name: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub name: Option<String>,
#[serde(rename = "edit_extra")]
#[serde(skip_serializing_if = "Option::is_none")]
@@ -91,14 +93,14 @@ pub struct ContainerEntity {
}
impl ContainerEntity {
- pub fn new(name: String) -> ContainerEntity {
+ pub fn new() -> ContainerEntity {
ContainerEntity {
coden: None,
abbrev: None,
wikidata_qid: None,
issnl: None,
publisher: None,
- name: name,
+ name: None,
edit_extra: None,
extra: None,
redirect: None,
@@ -127,8 +129,10 @@ pub struct CreatorEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub given_name: Option<String>,
+ /// Required for valid entities
#[serde(rename = "display_name")]
- pub display_name: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub display_name: Option<String>,
// Note: inline enums are not fully supported by swagger-codegen
#[serde(rename = "state")]
@@ -160,13 +164,13 @@ pub struct CreatorEntity {
}
impl CreatorEntity {
- pub fn new(display_name: String) -> CreatorEntity {
+ pub fn new() -> CreatorEntity {
CreatorEntity {
wikidata_qid: None,
orcid: None,
surname: None,
given_name: None,
- display_name: display_name,
+ display_name: None,
state: None,
ident: None,
revision: None,
@@ -358,14 +362,14 @@ pub struct FileEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub sha256: Option<String>,
- #[serde(rename = "md5")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub md5: Option<String>,
-
#[serde(rename = "sha1")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sha1: Option<String>,
+ #[serde(rename = "md5")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub md5: Option<String>,
+
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
@@ -406,8 +410,8 @@ impl FileEntity {
mimetype: None,
urls: None,
sha256: None,
- md5: None,
sha1: None,
+ md5: None,
size: None,
edit_extra: None,
extra: None,
@@ -564,8 +568,10 @@ pub struct ReleaseEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub work_id: Option<String>,
+ /// Required for valid entities
#[serde(rename = "title")]
- pub title: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub title: Option<String>,
// Note: inline enums are not fully supported by swagger-codegen
#[serde(rename = "state")]
@@ -597,7 +603,7 @@ pub struct ReleaseEntity {
}
impl ReleaseEntity {
- pub fn new(title: String) -> ReleaseEntity {
+ pub fn new() -> ReleaseEntity {
ReleaseEntity {
abstracts: None,
refs: None,
@@ -620,7 +626,7 @@ impl ReleaseEntity {
files: None,
container: None,
work_id: None,
- title: title,
+ title: None,
state: None,
ident: None,
revision: None,
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs
index c4f491de..e8d8e1eb 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -38,11 +38,14 @@ use swagger::{ApiError, Context, XSpanId};
use models;
use {
AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
- CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse, DeleteFileResponse,
- DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse,
- GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse,
- GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse,
- LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse,
+ DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse,
+ GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse,
+ GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse,
+ GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse, GetWorkHistoryResponse,
+ GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse,
+ UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
};
header! { (Warning, "Warning") => [String] }
@@ -405,6 +408,95 @@ where
);
let api_clone = api.clone();
+ router.delete(
+ "/v0/container/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.delete_container_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteContainerEditResponse::DeletedEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_EDIT_DELETED_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteContainerEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteContainerEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteContainerEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "DeleteContainerEdit",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/container/:id",
move |req: &mut Request| {
@@ -500,6 +592,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/container/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.get_container_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetContainerEditResponse::FoundEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_EDIT_FOUND_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetContainerEdit",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/container/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -593,6 +774,189 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/container/:id/redirects",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ match api.get_container_redirects(param_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetContainerRedirectsResponse::FoundEntityRedirects(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRedirectsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REDIRECTS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRedirectsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REDIRECTS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRedirectsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REDIRECTS_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetContainerRedirects",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/container/rev/:id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_container_revision(param_id, param_expand, param_hide, context).wait() {
+ Ok(rsp) => match rsp {
+ GetContainerRevisionResponse::FoundEntityRevision(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REVISION_FOUND_ENTITY_REVISION.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRevisionResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REVISION_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRevisionResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REVISION_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetContainerRevisionResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_REVISION_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetContainerRevision",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/container/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -608,16 +972,11 @@ where
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
- let param_issnl = query_params
- .get("issnl")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter issnl".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter issnl was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter issnl - doesn't match schema: {}", e))))?;
+ let param_issnl = query_params.get("issnl").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_wikidata_qid = query_params.get("wikidata_qid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.lookup_container(param_issnl, param_hide, context).wait() {
+ match api.lookup_container(param_issnl, param_wikidata_qid, param_hide, context).wait() {
Ok(rsp) => match rsp {
LookupContainerResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1116,6 +1475,95 @@ where
);
let api_clone = api.clone();
+ router.delete(
+ "/v0/creator/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.delete_creator_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteCreatorEditResponse::DeletedEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_EDIT_DELETED_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteCreatorEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteCreatorEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteCreatorEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "DeleteCreatorEdit",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/creator/:id",
move |req: &mut Request| {
@@ -1211,6 +1659,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/creator/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.get_creator_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetCreatorEditResponse::FoundEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_EDIT_FOUND_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetCreatorEdit",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/creator/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1304,6 +1841,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/creator/:id/redirects",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ match api.get_creator_redirects(param_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetCreatorRedirectsResponse::FoundEntityRedirects(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRedirectsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REDIRECTS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRedirectsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REDIRECTS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRedirectsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REDIRECTS_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetCreatorRedirects",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/creator/:id/releases",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1397,6 +2023,100 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/creator/rev/:id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_creator_revision(param_id, param_expand, param_hide, context).wait() {
+ Ok(rsp) => match rsp {
+ GetCreatorRevisionResponse::FoundEntityRevision(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REVISION_FOUND_ENTITY_REVISION.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRevisionResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REVISION_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRevisionResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REVISION_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetCreatorRevisionResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_REVISION_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetCreatorRevision",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/creator/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1412,16 +2132,11 @@ where
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
- let param_orcid = query_params
- .get("orcid")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter orcid".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter orcid was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter orcid - doesn't match schema: {}", e))))?;
+ let param_orcid = query_params.get("orcid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_wikidata_qid = query_params.get("wikidata_qid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.lookup_creator(param_orcid, param_hide, context).wait() {
+ match api.lookup_creator(param_orcid, param_wikidata_qid, param_hide, context).wait() {
Ok(rsp) => match rsp {
LookupCreatorResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -2575,6 +3290,95 @@ where
);
let api_clone = api.clone();
+ router.delete(
+ "/v0/file/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.delete_file_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteFileEditResponse::DeletedEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_EDIT_DELETED_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteFileEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteFileEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteFileEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "DeleteFileEdit",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/file/:id",
move |req: &mut Request| {
@@ -2670,6 +3474,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/file/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.get_file_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetFileEditResponse::FoundEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_EDIT_FOUND_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetFileEdit",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/file/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2763,6 +3656,189 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/file/:id/redirects",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ match api.get_file_redirects(param_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetFileRedirectsResponse::FoundEntityRedirects(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRedirectsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REDIRECTS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRedirectsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REDIRECTS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRedirectsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REDIRECTS_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetFileRedirects",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/file/rev/:id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_file_revision(param_id, param_expand, param_hide, context).wait() {
+ Ok(rsp) => match rsp {
+ GetFileRevisionResponse::FoundEntityRevision(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REVISION_FOUND_ENTITY_REVISION.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRevisionResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REVISION_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRevisionResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REVISION_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetFileRevisionResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_REVISION_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetFileRevision",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/file/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2778,16 +3854,12 @@ where
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
- let param_sha1 = query_params
- .get("sha1")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter sha1".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter sha1 was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter sha1 - doesn't match schema: {}", e))))?;
+ let param_md5 = query_params.get("md5").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_sha1 = query_params.get("sha1").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_sha256 = query_params.get("sha256").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.lookup_file(param_sha1, param_hide, context).wait() {
+ match api.lookup_file(param_md5, param_sha1, param_sha256, param_hide, context).wait() {
Ok(rsp) => match rsp {
LookupFileResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -3396,6 +4468,95 @@ where
);
let api_clone = api.clone();
+ router.delete(
+ "/v0/release/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.delete_release_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteReleaseEditResponse::DeletedEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_DELETED_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteReleaseEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteReleaseEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteReleaseEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "DeleteReleaseEdit",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/release/:id",
move |req: &mut Request| {
@@ -3491,6 +4652,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/release/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.get_release_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetReleaseEditResponse::FoundEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_FOUND_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetReleaseEdit",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/release/:id/files",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3677,6 +4927,189 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/release/:id/redirects",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ match api.get_release_redirects(param_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetReleaseRedirectsResponse::FoundEntityRedirects(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRedirectsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRedirectsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRedirectsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetReleaseRedirects",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/release/rev/:id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_release_revision(param_id, param_expand, param_hide, context).wait() {
+ Ok(rsp) => match rsp {
+ GetReleaseRevisionResponse::FoundEntityRevision(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_FOUND_ENTITY_REVISION.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRevisionResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRevisionResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetReleaseRevisionResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetReleaseRevision",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/release/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3692,16 +5125,14 @@ where
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
- let param_doi = query_params
- .get("doi")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter doi".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?;
+ let param_doi = query_params.get("doi").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_wikidata_qid = query_params.get("wikidata_qid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_isbn13 = query_params.get("isbn13").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_pmid = query_params.get("pmid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_pmcid = query_params.get("pmcid").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.lookup_release(param_doi, param_hide, context).wait() {
+ match api.lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_hide, context).wait() {
Ok(rsp) => match rsp {
LookupReleaseResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -4090,6 +5521,95 @@ where
);
let api_clone = api.clone();
+ router.delete(
+ "/v0/work/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.delete_work_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteWorkEditResponse::DeletedEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_EDIT_DELETED_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteWorkEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteWorkEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteWorkEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "DeleteWorkEdit",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/work/:id",
move |req: &mut Request| {
@@ -4185,6 +5705,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/work/edit/:edit_id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_edit_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("edit_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))?
+ };
+
+ match api.get_work_edit(param_edit_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetWorkEditResponse::FoundEdit(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_EDIT_FOUND_EDIT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkEditResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_EDIT_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkEditResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_EDIT_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkEditResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_EDIT_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetWorkEdit",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/work/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -4278,6 +5887,95 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/work/:id/redirects",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ match api.get_work_redirects(param_id, context).wait() {
+ Ok(rsp) => match rsp {
+ GetWorkRedirectsResponse::FoundEntityRedirects(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRedirectsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REDIRECTS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRedirectsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REDIRECTS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRedirectsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REDIRECTS_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetWorkRedirects",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/work/:id/releases",
move |req: &mut Request| {
let mut context = Context::default();
@@ -4370,6 +6068,100 @@ where
);
let api_clone = api.clone();
+ router.get(
+ "/v0/work/rev/:id",
+ move |req: &mut Request| {
+ let mut context = Context::default();
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response>
+ where
+ T: Api,
+ {
+ context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string()));
+ context.auth_data = req.extensions.remove::<AuthData>();
+ context.authorization = req.extensions.remove::<Authorization>();
+
+ // Path parameters
+ let param_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter id".to_string())))?;
+ percent_decode(param.as_bytes())
+ .decode_utf8()
+ .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))?
+ .parse()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_work_revision(param_id, param_expand, param_hide, context).wait() {
+ Ok(rsp) => match rsp {
+ GetWorkRevisionResponse::FoundEntityRevision(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REVISION_FOUND_ENTITY_REVISION.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRevisionResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REVISION_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRevisionResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REVISION_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkRevisionResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_REVISION_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ },
+ Err(_) => {
+ // Application code returned an error. This should not happen, as the implementation should
+ // return a valid response.
+ Err(Response::with((status::InternalServerError, "An internal error occurred".to_string())))
+ }
+ }
+ }
+
+ handle_request(req, &api_clone, &mut context).or_else(|mut response| {
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ Ok(response)
+ })
+ },
+ "GetWorkRevision",
+ );
+
+ let api_clone = api.clone();
router.put(
"/v0/work/:id",
move |req: &mut Request| {