aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:25:57 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:25:57 -0700
commite9d7d73339df14ef2fe35815e693f0dbd7d1d244 (patch)
tree78140de79fbc0c3ace5d65808cba251219d438f3 /rust
parent3b30465c2faa0b73ac2973f868105caad1a8e745 (diff)
downloadfatcat-e9d7d73339df14ef2fe35815e693f0dbd7d1d244.tar.gz
fatcat-e9d7d73339df14ef2fe35815e693f0dbd7d1d244.zip
codegen fatcat-api-spec
Diffstat (limited to 'rust')
-rw-r--r--rust/fatcat-api-spec/README.md54
-rw-r--r--rust/fatcat-api-spec/api.yaml103
-rw-r--r--rust/fatcat-api-spec/api/swagger.yaml101
-rw-r--r--rust/fatcat-api-spec/examples/client.rs253
-rw-r--r--rust/fatcat-api-spec/examples/server_lib/server.rs322
-rw-r--r--rust/fatcat-api-spec/src/client.rs1234
-rw-r--r--rust/fatcat-api-spec/src/lib.rs656
-rw-r--r--rust/fatcat-api-spec/src/mimetypes.rs668
-rw-r--r--rust/fatcat-api-spec/src/models.rs6
-rw-r--r--rust/fatcat-api-spec/src/server.rs2391
10 files changed, 2979 insertions, 2809 deletions
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md
index 6945d13d..7f98de30 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-09-11T22:56:39.846Z
+- Build date: 2018-09-23T00:19:26.675Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
@@ -56,50 +56,50 @@ cargo run --example server
To run a client, follow one of the following simple steps:
```
-cargo run --example client AcceptEditgroup
cargo run --example client CreateContainer
cargo run --example client CreateContainerBatch
-cargo run --example client CreateCreator
-cargo run --example client CreateCreatorBatch
-cargo run --example client CreateEditgroup
-cargo run --example client CreateFile
-cargo run --example client CreateFileBatch
-cargo run --example client CreateRelease
-cargo run --example client CreateReleaseBatch
-cargo run --example client CreateWork
-cargo run --example client CreateWorkBatch
cargo run --example client DeleteContainer
-cargo run --example client DeleteCreator
-cargo run --example client DeleteFile
-cargo run --example client DeleteRelease
-cargo run --example client DeleteWork
-cargo run --example client GetChangelog
-cargo run --example client GetChangelogEntry
cargo run --example client GetContainer
cargo run --example client GetContainerHistory
+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 GetCreator
cargo run --example client GetCreatorHistory
cargo run --example client GetCreatorReleases
-cargo run --example client GetEditgroup
+cargo run --example client LookupCreator
+cargo run --example client UpdateCreator
cargo run --example client GetEditor
cargo run --example client GetEditorChangelog
+cargo run --example client GetStats
+cargo run --example client AcceptEditgroup
+cargo run --example client CreateEditgroup
+cargo run --example client GetChangelog
+cargo run --example client GetChangelogEntry
+cargo run --example client GetEditgroup
+cargo run --example client CreateFile
+cargo run --example client CreateFileBatch
+cargo run --example client DeleteFile
cargo run --example client GetFile
cargo run --example client GetFileHistory
+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 GetRelease
cargo run --example client GetReleaseFiles
cargo run --example client GetReleaseHistory
-cargo run --example client GetStats
+cargo run --example client LookupRelease
+cargo run --example client UpdateRelease
+cargo run --example client CreateWorkBatch
+cargo run --example client DeleteWork
cargo run --example client GetWork
cargo run --example client GetWorkHistory
cargo run --example client GetWorkReleases
-cargo run --example client LookupContainer
-cargo run --example client LookupCreator
-cargo run --example client LookupFile
-cargo run --example client LookupRelease
-cargo run --example client UpdateContainer
-cargo run --example client UpdateCreator
-cargo run --example client UpdateFile
-cargo run --example client UpdateRelease
cargo run --example client UpdateWork
```
diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml
index 9652fd5e..f8d16f5b 100644
--- a/rust/fatcat-api-spec/api.yaml
+++ b/rust/fatcat-api-spec/api.yaml
@@ -5,6 +5,7 @@ info:
description: A scalable, versioned, API-oriented catalog of bibliographic entities
and file metadata
version: 0.1.0
+# Actually HTTPS in QA and production
schemes: [http]
basePath: /v0
#host: api.fatcat.wiki
@@ -13,6 +14,20 @@ consumes:
produces:
- application/json
+tags:
+ - name: containers
+ descriptions: "Container entities: such as journals, conferences, book series"
+ - name: creators
+ descriptions: "Creator entities: such as authors"
+ - name: files
+ descriptions: "File entities"
+ - name: releases
+ descriptions: "Release entities: individual articles, pre-prints, books"
+ - name: works
+ descriptions: "Work entities: grouping releases which are variants of the same work"
+ - name: edit-lifecycle
+ descriptions: "Endpoints relating to global edit submission and history"
+
# don't want these to be rust types (at least for now)
x-fatcat-ident: &FATCATIDENT
type: string
@@ -372,7 +387,7 @@ definitions:
year:
type: integer
format: int64
- container_title:
+ container_name:
type: string
title:
type: string
@@ -423,6 +438,8 @@ paths:
/container:
post:
operationId: "create_container"
+ tags:
+ - containers
parameters:
- name: entity
in: body
@@ -442,6 +459,8 @@ paths:
/container/batch:
post:
operationId: "create_container_batch"
+ tags:
+ - containers
parameters:
- name: autoaccept
in: query
@@ -476,6 +495,8 @@ paths:
required: true
get:
operationId: "get_container"
+ tags:
+ - containers
parameters:
- name: expand
in: query
@@ -490,6 +511,8 @@ paths:
<<: *ENTITYRESPONSES
put:
operationId: "update_container"
+ tags:
+ - containers
parameters:
- name: entity
in: body
@@ -508,6 +531,8 @@ paths:
<<: *ENTITYRESPONSES
delete:
operationId: "delete_container"
+ tags:
+ - containers
parameters:
- name: editgroup
in: query
@@ -531,6 +556,8 @@ paths:
format: int64
required: false
get:
+ tags:
+ - containers
operationId: "get_container_history"
responses:
200:
@@ -543,6 +570,8 @@ paths:
/container/lookup:
get:
operationId: "lookup_container"
+ tags:
+ - containers
parameters:
- name: issnl
in: query
@@ -557,6 +586,8 @@ paths:
/creator:
post:
operationId: "create_creator"
+ tags:
+ - creators
parameters:
- name: entity
in: body
@@ -576,6 +607,8 @@ paths:
/creator/batch:
post:
operationId: "create_creator_batch"
+ tags:
+ - creators
parameters:
- name: autoaccept
in: query
@@ -610,6 +643,8 @@ paths:
required: true
get:
operationId: "get_creator"
+ tags:
+ - creators
parameters:
- name: expand
in: query
@@ -624,6 +659,8 @@ paths:
<<: *ENTITYRESPONSES
put:
operationId: "update_creator"
+ tags:
+ - creators
parameters:
- name: entity
in: body
@@ -642,6 +679,8 @@ paths:
<<: *ENTITYRESPONSES
delete:
operationId: "delete_creator"
+ tags:
+ - creators
parameters:
- name: editgroup
in: query
@@ -666,6 +705,8 @@ paths:
required: false
get:
operationId: "get_creator_history"
+ tags:
+ - creators
responses:
200:
description: Found Entity History
@@ -682,6 +723,8 @@ paths:
required: true
get:
operationId: "get_creator_releases"
+ tags:
+ - creators
responses:
200:
description: Found
@@ -693,6 +736,8 @@ paths:
/creator/lookup:
get:
operationId: "lookup_creator"
+ tags:
+ - creators
parameters:
- name: orcid
in: query
@@ -707,6 +752,8 @@ paths:
/file:
post:
operationId: "create_file"
+ tags:
+ - files
parameters:
- name: entity
in: body
@@ -726,6 +773,8 @@ paths:
/file/batch:
post:
operationId: "create_file_batch"
+ tags:
+ - files
parameters:
- name: autoaccept
in: query
@@ -760,6 +809,8 @@ paths:
required: true
get:
operationId: "get_file"
+ tags:
+ - files
parameters:
- name: expand
in: query
@@ -774,6 +825,8 @@ paths:
<<: *ENTITYRESPONSES
put:
operationId: "update_file"
+ tags:
+ - files
parameters:
- name: entity
in: body
@@ -792,6 +845,8 @@ paths:
<<: *ENTITYRESPONSES
delete:
operationId: "delete_file"
+ tags:
+ - files
parameters:
- name: editgroup
in: query
@@ -816,6 +871,8 @@ paths:
required: false
get:
operationId: "get_file_history"
+ tags:
+ - files
responses:
200:
description: Found Entity History
@@ -827,6 +884,8 @@ paths:
/file/lookup:
get:
operationId: "lookup_file"
+ tags:
+ - files
parameters:
- name: sha1
in: query
@@ -841,6 +900,8 @@ paths:
/release:
post:
operationId: "create_release"
+ tags:
+ - releases
parameters:
- name: entity
in: body
@@ -860,6 +921,8 @@ paths:
/release/batch:
post:
operationId: "create_release_batch"
+ tags:
+ - releases
parameters:
- name: autoaccept
in: query
@@ -894,6 +957,8 @@ paths:
required: true
get:
operationId: "get_release"
+ tags:
+ - releases
parameters:
- name: expand
in: query
@@ -908,6 +973,8 @@ paths:
<<: *ENTITYRESPONSES
put:
operationId: "update_release"
+ tags:
+ - releases
parameters:
- name: entity
in: body
@@ -926,6 +993,8 @@ paths:
<<: *ENTITYRESPONSES
delete:
operationId: "delete_release"
+ tags:
+ - releases
parameters:
- name: editgroup
in: query
@@ -950,6 +1019,8 @@ paths:
required: false
get:
operationId: "get_release_history"
+ tags:
+ - releases
responses:
200:
description: Found Entity History
@@ -966,6 +1037,8 @@ paths:
required: true
get:
operationId: "get_release_files"
+ tags:
+ - releases
responses:
200:
description: Found
@@ -977,6 +1050,8 @@ paths:
/release/lookup:
get:
operationId: "lookup_release"
+ tags:
+ - releases
parameters:
- name: doi
in: query
@@ -991,6 +1066,8 @@ paths:
/work:
post:
operationId: "create_work"
+ tags:
+ - releases
parameters:
- name: entity
in: body
@@ -1010,6 +1087,8 @@ paths:
/work/batch:
post:
operationId: "create_work_batch"
+ tags:
+ - works
parameters:
- name: autoaccept
in: query
@@ -1044,6 +1123,8 @@ paths:
required: true
get:
operationId: "get_work"
+ tags:
+ - works
parameters:
- name: expand
in: query
@@ -1058,6 +1139,8 @@ paths:
<<: *ENTITYRESPONSES
put:
operationId: "update_work"
+ tags:
+ - works
parameters:
- name: entity
in: body
@@ -1076,6 +1159,8 @@ paths:
<<: *ENTITYRESPONSES
delete:
operationId: "delete_work"
+ tags:
+ - works
parameters:
- name: editgroup
in: query
@@ -1100,6 +1185,8 @@ paths:
required: false
get:
operationId: "get_work_history"
+ tags:
+ - works
responses:
200:
description: Found Entity History
@@ -1116,6 +1203,8 @@ paths:
required: true
get:
operationId: "get_work_releases"
+ tags:
+ - works
responses:
200:
description: Found
@@ -1179,8 +1268,10 @@ paths:
/editgroup:
post:
operationId: "create_editgroup"
+ tags:
+ - edit-lifecycle
parameters:
- - name: entity
+ - name: editgroup
in: body
required: true
schema:
@@ -1206,6 +1297,8 @@ paths:
<<: *FATCATIDENT
get:
operationId: "get_editgroup"
+ tags:
+ - edit-lifecycle
responses:
200:
description: Found
@@ -1231,6 +1324,8 @@ paths:
<<: *FATCATIDENT
post:
operationId: "accept_editgroup"
+ tags:
+ - edit-lifecycle
responses:
200:
description: Merged Successfully
@@ -1261,6 +1356,8 @@ paths:
required: false
get:
operationId: "get_changelog"
+ tags:
+ - edit-lifecycle
responses:
200:
description: Success
@@ -1281,6 +1378,8 @@ paths:
required: true
get:
operationId: "get_changelog_entry"
+ tags:
+ - edit-lifecycle
responses:
200:
description: Found Changelog Entry
diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml
index 5f54c5b4..f0f4cf05 100644
--- a/rust/fatcat-api-spec/api/swagger.yaml
+++ b/rust/fatcat-api-spec/api/swagger.yaml
@@ -6,6 +6,13 @@ info:
version: "0.1.0"
title: "fatcat"
basePath: "/v0"
+tags:
+- name: "containers"
+- name: "creators"
+- name: "files"
+- name: "releases"
+- name: "works"
+- name: "edit-lifecycle"
schemes:
- "http"
consumes:
@@ -15,6 +22,8 @@ produces:
paths:
/container:
post:
+ tags:
+ - "containers"
operationId: "create_container"
parameters:
- in: "body"
@@ -80,6 +89,8 @@ paths:
noClientExample: true
/container/batch:
post:
+ tags:
+ - "containers"
operationId: "create_container_batch"
parameters:
- name: "autoaccept"
@@ -156,6 +167,8 @@ paths:
httpmethod: "post"
/container/{id}:
get:
+ tags:
+ - "containers"
operationId: "get_container"
parameters:
- name: "id"
@@ -215,6 +228,8 @@ paths:
HttpMethod: "Get"
httpmethod: "get"
put:
+ tags:
+ - "containers"
operationId: "update_container"
parameters:
- name: "id"
@@ -285,6 +300,8 @@ paths:
httpmethod: "put"
noClientExample: true
delete:
+ tags:
+ - "containers"
operationId: "delete_container"
parameters:
- name: "id"
@@ -343,6 +360,8 @@ paths:
httpmethod: "delete"
/container/{id}/history:
get:
+ tags:
+ - "containers"
operationId: "get_container_history"
parameters:
- name: "id"
@@ -404,6 +423,8 @@ paths:
httpmethod: "get"
/container/lookup:
get:
+ tags:
+ - "containers"
operationId: "lookup_container"
parameters:
- name: "issnl"
@@ -459,6 +480,8 @@ paths:
httpmethod: "get"
/creator:
post:
+ tags:
+ - "creators"
operationId: "create_creator"
parameters:
- in: "body"
@@ -524,6 +547,8 @@ paths:
noClientExample: true
/creator/batch:
post:
+ tags:
+ - "creators"
operationId: "create_creator_batch"
parameters:
- name: "autoaccept"
@@ -600,6 +625,8 @@ paths:
httpmethod: "post"
/creator/{id}:
get:
+ tags:
+ - "creators"
operationId: "get_creator"
parameters:
- name: "id"
@@ -659,6 +686,8 @@ paths:
HttpMethod: "Get"
httpmethod: "get"
put:
+ tags:
+ - "creators"
operationId: "update_creator"
parameters:
- name: "id"
@@ -729,6 +758,8 @@ paths:
httpmethod: "put"
noClientExample: true
delete:
+ tags:
+ - "creators"
operationId: "delete_creator"
parameters:
- name: "id"
@@ -787,6 +818,8 @@ paths:
httpmethod: "delete"
/creator/{id}/history:
get:
+ tags:
+ - "creators"
operationId: "get_creator_history"
parameters:
- name: "id"
@@ -848,6 +881,8 @@ paths:
httpmethod: "get"
/creator/{id}/releases:
get:
+ tags:
+ - "creators"
operationId: "get_creator_releases"
parameters:
- name: "id"
@@ -902,6 +937,8 @@ paths:
httpmethod: "get"
/creator/lookup:
get:
+ tags:
+ - "creators"
operationId: "lookup_creator"
parameters:
- name: "orcid"
@@ -957,6 +994,8 @@ paths:
httpmethod: "get"
/file:
post:
+ tags:
+ - "files"
operationId: "create_file"
parameters:
- in: "body"
@@ -1022,6 +1061,8 @@ paths:
noClientExample: true
/file/batch:
post:
+ tags:
+ - "files"
operationId: "create_file_batch"
parameters:
- name: "autoaccept"
@@ -1098,6 +1139,8 @@ paths:
httpmethod: "post"
/file/{id}:
get:
+ tags:
+ - "files"
operationId: "get_file"
parameters:
- name: "id"
@@ -1157,6 +1200,8 @@ paths:
HttpMethod: "Get"
httpmethod: "get"
put:
+ tags:
+ - "files"
operationId: "update_file"
parameters:
- name: "id"
@@ -1227,6 +1272,8 @@ paths:
httpmethod: "put"
noClientExample: true
delete:
+ tags:
+ - "files"
operationId: "delete_file"
parameters:
- name: "id"
@@ -1285,6 +1332,8 @@ paths:
httpmethod: "delete"
/file/{id}/history:
get:
+ tags:
+ - "files"
operationId: "get_file_history"
parameters:
- name: "id"
@@ -1346,6 +1395,8 @@ paths:
httpmethod: "get"
/file/lookup:
get:
+ tags:
+ - "files"
operationId: "lookup_file"
parameters:
- name: "sha1"
@@ -1398,6 +1449,8 @@ paths:
httpmethod: "get"
/release:
post:
+ tags:
+ - "releases"
operationId: "create_release"
parameters:
- in: "body"
@@ -1463,6 +1516,8 @@ paths:
noClientExample: true
/release/batch:
post:
+ tags:
+ - "releases"
operationId: "create_release_batch"
parameters:
- name: "autoaccept"
@@ -1539,6 +1594,8 @@ paths:
httpmethod: "post"
/release/{id}:
get:
+ tags:
+ - "releases"
operationId: "get_release"
parameters:
- name: "id"
@@ -1598,6 +1655,8 @@ paths:
HttpMethod: "Get"
httpmethod: "get"
put:
+ tags:
+ - "releases"
operationId: "update_release"
parameters:
- name: "id"
@@ -1668,6 +1727,8 @@ paths:
httpmethod: "put"
noClientExample: true
delete:
+ tags:
+ - "releases"
operationId: "delete_release"
parameters:
- name: "id"
@@ -1726,6 +1787,8 @@ paths:
httpmethod: "delete"
/release/{id}/history:
get:
+ tags:
+ - "releases"
operationId: "get_release_history"
parameters:
- name: "id"
@@ -1787,6 +1850,8 @@ paths:
httpmethod: "get"
/release/{id}/files:
get:
+ tags:
+ - "releases"
operationId: "get_release_files"
parameters:
- name: "id"
@@ -1841,6 +1906,8 @@ paths:
httpmethod: "get"
/release/lookup:
get:
+ tags:
+ - "releases"
operationId: "lookup_release"
parameters:
- name: "doi"
@@ -1893,6 +1960,8 @@ paths:
httpmethod: "get"
/work:
post:
+ tags:
+ - "releases"
operationId: "create_work"
parameters:
- in: "body"
@@ -1958,6 +2027,8 @@ paths:
noClientExample: true
/work/batch:
post:
+ tags:
+ - "works"
operationId: "create_work_batch"
parameters:
- name: "autoaccept"
@@ -2034,6 +2105,8 @@ paths:
httpmethod: "post"
/work/{id}:
get:
+ tags:
+ - "works"
operationId: "get_work"
parameters:
- name: "id"
@@ -2093,6 +2166,8 @@ paths:
HttpMethod: "Get"
httpmethod: "get"
put:
+ tags:
+ - "works"
operationId: "update_work"
parameters:
- name: "id"
@@ -2163,6 +2238,8 @@ paths:
httpmethod: "put"
noClientExample: true
delete:
+ tags:
+ - "works"
operationId: "delete_work"
parameters:
- name: "id"
@@ -2221,6 +2298,8 @@ paths:
httpmethod: "delete"
/work/{id}/history:
get:
+ tags:
+ - "works"
operationId: "get_work_history"
parameters:
- name: "id"
@@ -2282,6 +2361,8 @@ paths:
httpmethod: "get"
/work/{id}/releases:
get:
+ tags:
+ - "works"
operationId: "get_work_releases"
parameters:
- name: "id"
@@ -2442,10 +2523,12 @@ paths:
httpmethod: "get"
/editgroup:
post:
+ tags:
+ - "edit-lifecycle"
operationId: "create_editgroup"
parameters:
- in: "body"
- name: "entity"
+ name: "editgroup"
required: true
schema:
$ref: "#/definitions/editgroup"
@@ -2492,6 +2575,8 @@ paths:
noClientExample: true
/editgroup/{id}:
get:
+ tags:
+ - "edit-lifecycle"
operationId: "get_editgroup"
parameters:
- name: "id"
@@ -2548,6 +2633,8 @@ paths:
httpmethod: "get"
/editgroup/{id}/accept:
post:
+ tags:
+ - "edit-lifecycle"
operationId: "accept_editgroup"
parameters:
- name: "id"
@@ -2613,6 +2700,8 @@ paths:
httpmethod: "post"
/changelog:
get:
+ tags:
+ - "edit-lifecycle"
operationId: "get_changelog"
parameters:
- name: "limit"
@@ -2650,6 +2739,8 @@ paths:
httpmethod: "get"
/changelog/{id}:
get:
+ tags:
+ - "edit-lifecycle"
operationId: "get_changelog_entry"
parameters:
- name: "id"
@@ -3137,16 +3228,16 @@ definitions:
volume: "volume"
refs:
- target_release_id: "target_release_id"
+ container_name: "container_name"
year: 6
- container_title: "container_title"
extra: "{}"
index: 0
title: "title"
locator: "p123"
key: "key"
- target_release_id: "target_release_id"
+ container_name: "container_name"
year: 6
- container_title: "container_title"
extra: "{}"
index: 0
title: "title"
@@ -3708,7 +3799,7 @@ definitions:
year:
type: "integer"
format: "int64"
- container_title:
+ container_name:
type: "string"
title:
type: "string"
@@ -3717,8 +3808,8 @@ definitions:
example: "p123"
example:
target_release_id: "target_release_id"
+ container_name: "container_name"
year: 6
- container_title: "container_title"
extra: "{}"
index: 0
title: "title"
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs
index 5d600965..43f002fc 100644
--- a/rust/fatcat-api-spec/examples/client.rs
+++ b/rust/fatcat-api-spec/examples/client.rs
@@ -28,45 +28,43 @@ fn main() {
Arg::with_name("operation")
.help("Sets the operation to run")
.possible_values(&[
- "AcceptEditgroup",
"CreateContainerBatch",
- "CreateCreatorBatch",
- "CreateFileBatch",
- "CreateReleaseBatch",
- "CreateWorkBatch",
"DeleteContainer",
- "DeleteCreator",
- "DeleteFile",
- "DeleteRelease",
- "DeleteWork",
- "GetChangelog",
- "GetChangelogEntry",
"GetContainer",
"GetContainerHistory",
+ "LookupContainer",
+ "CreateCreatorBatch",
+ "DeleteCreator",
"GetCreator",
"GetCreatorHistory",
"GetCreatorReleases",
- "GetEditgroup",
+ "LookupCreator",
"GetEditor",
"GetEditorChangelog",
+ "GetStats",
+ "AcceptEditgroup",
+ "GetChangelog",
+ "GetChangelogEntry",
+ "GetEditgroup",
+ "CreateFileBatch",
+ "DeleteFile",
"GetFile",
"GetFileHistory",
+ "LookupFile",
+ "CreateReleaseBatch",
+ "DeleteRelease",
"GetRelease",
"GetReleaseFiles",
"GetReleaseHistory",
- "GetStats",
+ "LookupRelease",
+ "CreateWorkBatch",
+ "DeleteWork",
"GetWork",
"GetWorkHistory",
"GetWorkReleases",
- "LookupContainer",
- "LookupCreator",
- "LookupFile",
- "LookupRelease",
- ])
- .required(true)
+ ]).required(true)
.index(1),
- )
- .arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not"))
+ ).arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not"))
.arg(Arg::with_name("host").long("host").takes_value(true).default_value("localhost").help("Hostname to contact"))
.arg(Arg::with_name("port").long("port").takes_value(true).default_value("8080").help("Port to contact"))
.get_matches();
@@ -90,11 +88,6 @@ fn main() {
let client = client.with_context(fatcat::Context::new_with_span_id(self::uuid::Uuid::new_v4().to_string()));
match matches.value_of("operation") {
- Some("AcceptEditgroup") => {
- let result = client.accept_editgroup("id_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("CreateContainer") => {
// let result = client.create_container(???, Some("editgroup_example".to_string())).wait();
@@ -105,54 +98,39 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- // Disabled because there's no example.
- // Some("CreateCreator") => {
- // let result = client.create_creator(???, Some("editgroup_example".to_string())).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("CreateCreatorBatch") => {
- let result = client.create_creator_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
+ Some("DeleteContainer") => {
+ let result = client.delete_container("id_example".to_string(), Some("editgroup_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("CreateEditgroup") => {
- // let result = client.create_editgroup(???).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())).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
- // Disabled because there's no example.
- // Some("CreateFile") => {
- // let result = client.create_file(???, Some("editgroup_example".to_string())).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("CreateFileBatch") => {
- let result = client.create_file_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
+ 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>")));
}
- // Disabled because there's no example.
- // Some("CreateRelease") => {
- // let result = client.create_release(???, Some("editgroup_example".to_string())).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("CreateReleaseBatch") => {
- let result = client.create_release_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
+ Some("LookupContainer") => {
+ let result = client.lookup_container("issnl_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("CreateWork") => {
- // let result = client.create_work(???, Some("editgroup_example".to_string())).wait();
+ // Some("UpdateContainer") => {
+ // let result = client.update_container("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
- Some("CreateWorkBatch") => {
- let result = client.create_work_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
- println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- }
- Some("DeleteContainer") => {
- let result = client.delete_container("id_example".to_string(), Some("editgroup_example".to_string())).wait();
+ // Disabled because there's no example.
+ // Some("CreateCreator") => {
+ // let result = client.create_creator(???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("CreateCreatorBatch") => {
+ let result = client.create_creator_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -161,53 +139,63 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("DeleteFile") => {
- let result = client.delete_file("id_example".to_string(), Some("editgroup_example".to_string())).wait();
+ Some("GetCreator") => {
+ let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("DeleteRelease") => {
- let result = client.delete_release("id_example".to_string(), Some("editgroup_example".to_string())).wait();
+ 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("DeleteWork") => {
- let result = client.delete_work("id_example".to_string(), Some("editgroup_example".to_string())).wait();
+ Some("GetCreatorReleases") => {
+ let result = client.get_creator_releases("id_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetChangelog") => {
- let result = client.get_changelog(Some(789)).wait();
+ Some("LookupCreator") => {
+ let result = client.lookup_creator("orcid_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetChangelogEntry") => {
- let result = client.get_changelog_entry(789).wait();
+ // Disabled because there's no example.
+ // Some("UpdateCreator") => {
+ // let result = client.update_creator("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("GetEditor") => {
+ let result = client.get_editor("id_example".to_string()).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())).wait();
+ Some("GetEditorChangelog") => {
+ let result = client.get_editor_changelog("id_example".to_string()).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();
+ Some("GetStats") => {
+ let result = client.get_stats(Some("more_example".to_string())).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())).wait();
+ Some("AcceptEditgroup") => {
+ let result = client.accept_editgroup("id_example".to_string()).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();
+ // Disabled because there's no example.
+ // Some("CreateEditgroup") => {
+ // let result = client.create_editgroup(???).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("GetChangelog") => {
+ let result = client.get_changelog(Some(789)).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()).wait();
+ Some("GetChangelogEntry") => {
+ let result = client.get_changelog_entry(789).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -216,13 +204,18 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetEditor") => {
- let result = client.get_editor("id_example".to_string()).wait();
+ // Disabled because there's no example.
+ // Some("CreateFile") => {
+ // let result = client.create_file(???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("CreateFileBatch") => {
+ let result = client.create_file_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetEditorChangelog") => {
- let result = client.get_editor_changelog("id_example".to_string()).wait();
+ Some("DeleteFile") => {
+ let result = client.delete_file("id_example".to_string(), Some("editgroup_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -236,84 +229,86 @@ fn main() {
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())).wait();
+ Some("LookupFile") => {
+ let result = client.lookup_file("sha1_example".to_string()).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()).wait();
+ // Disabled because there's no example.
+ // Some("UpdateFile") => {
+ // let result = client.update_file("id_example".to_string(), ???, Some("editgroup_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("CreateRelease") => {
+ // let result = client.create_release(???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("CreateReleaseBatch") => {
+ let result = client.create_release_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetReleaseHistory") => {
- let result = client.get_release_history("id_example".to_string(), Some(789)).wait();
+ // Disabled because there's no example.
+ // Some("CreateWork") => {
+ // let result = client.create_work(???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("DeleteRelease") => {
+ let result = client.delete_release("id_example".to_string(), Some("editgroup_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetStats") => {
- let result = client.get_stats(Some("more_example".to_string())).wait();
+ Some("GetRelease") => {
+ let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).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())).wait();
+ Some("GetReleaseFiles") => {
+ let result = client.get_release_files("id_example".to_string()).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();
+ Some("GetReleaseHistory") => {
+ let result = client.get_release_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("GetWorkReleases") => {
- let result = client.get_work_releases("id_example".to_string()).wait();
+ Some("LookupRelease") => {
+ let result = client.lookup_release("doi_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()).wait();
+ // Disabled because there's no example.
+ // Some("UpdateRelease") => {
+ // let result = client.update_release("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("CreateWorkBatch") => {
+ let result = client.create_work_batch(&Vec::new(), Some(true), Some("editgroup_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()).wait();
+ Some("DeleteWork") => {
+ let result = client.delete_work("id_example".to_string(), Some("editgroup_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()).wait();
+ Some("GetWork") => {
+ let result = client.get_work("id_example".to_string(), Some("expand_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()).wait();
+ 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>")));
}
- // Disabled because there's no example.
- // Some("UpdateContainer") => {
- // let result = client.update_container("id_example".to_string(), ???, Some("editgroup_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("UpdateCreator") => {
- // let result = client.update_creator("id_example".to_string(), ???, Some("editgroup_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("UpdateFile") => {
- // let result = client.update_file("id_example".to_string(), ???, Some("editgroup_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("UpdateRelease") => {
- // let result = client.update_release("id_example".to_string(), ???, Some("editgroup_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()).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") => {
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs
index 2ca8eb3b..dc669490 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-api-spec/examples/server_lib/server.rs
@@ -23,12 +23,6 @@ use fatcat::{
pub struct Server;
impl Api for Server {
- fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -58,74 +52,56 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_creator({:?}, {:?}) - X-Span-ID: {:?}",
- entity,
+ "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn create_creator_batch(
- &self,
- entity_list: &Vec<models::CreatorEntity>,
- autoaccept: Option<bool>,
- editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
- entity_list,
- autoaccept,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_editgroup({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
+ limit,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "create_file({:?}, {:?}) - X-Span-ID: {:?}",
- entity,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn create_file_batch(
- &self,
- entity_list: &Vec<models::FileEntity>,
- autoaccept: Option<bool>,
- editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
- entity_list,
- autoaccept,
+ "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ entity,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_release({:?}, {:?}) - X-Span-ID: {:?}",
+ "create_creator({:?}, {:?}) - X-Span-ID: {:?}",
entity,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
@@ -133,16 +109,16 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_release_batch(
+ fn create_creator_batch(
&self,
- entity_list: &Vec<models::ReleaseEntity>,
+ entity_list: &Vec<models::CreatorEntity>,
autoaccept: Option<bool>,
editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
entity_list,
autoaccept,
editgroup,
@@ -151,157 +127,143 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_work({:?}, {:?}) - X-Span-ID: {:?}",
- entity,
+ "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn create_work_batch(
- &self,
- entity_list: &Vec<models::WorkEntity>,
- autoaccept: Option<bool>,
- editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
- entity_list,
- autoaccept,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
+ fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}",
id,
- editgroup,
+ limit,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
+ fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
+ entity,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
+ fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- editgroup,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
+ fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_changelog_entry({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_stats({:?}) - X-Span-ID: {:?}", more, 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>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", 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> {
+ fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- limit,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("create_editgroup({:?}) - X-Span-ID: {:?}", editgroup, 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>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, 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> {
+ fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- limit,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("get_changelog_entry({}) - 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, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
+ fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_file({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ fn create_file_batch(
+ &self,
+ entity_list: &Vec<models::FileEntity>,
+ autoaccept: Option<bool>,
+ editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -322,73 +284,95 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
+ fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
- limit,
+ entity,
+ editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_stats({:?}) - X-Span-ID: {:?}", more, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_release({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ 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>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ fn create_release_batch(
+ &self,
+ entity_list: &Vec<models::ReleaseEntity>,
+ autoaccept: Option<bool>,
+ editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ editgroup,
+ 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> {
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}",
- id,
- limit,
+ "create_work({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
+ fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}",
+ id,
+ limit,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -398,10 +382,10 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
entity,
editgroup,
@@ -410,42 +394,58 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ fn create_work_batch(
+ &self,
+ entity_list: &Vec<models::WorkEntity>,
+ autoaccept: Option<bool>,
+ editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
- id,
- entity,
+ "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}",
id,
- entity,
editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, 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!(
- "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}",
id,
- entity,
- editgroup,
+ limit,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, 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 c403515b..aa5feba3 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -166,73 +166,6 @@ impl Client {
}
impl Api for Client {
- fn accept_editgroup(&self, param_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup/{id}/accept", 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::Post, &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<AcceptEditgroupResponse, 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(AcceptEditgroupResponse::MergedSuccessfully(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(AcceptEditgroupResponse::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(AcceptEditgroupResponse::NotFound(body))
- }
- 409 => {
- 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(AcceptEditgroupResponse::EditConflict(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(AcceptEditgroupResponse::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 create_container(&self, param_entity: models::ContainerEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
@@ -381,55 +314,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ fn delete_container(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/creator?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
-
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/container/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR.clone()));
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<CreateCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteContainerResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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(CreateCreatorResponse::CreatedEntity(body))
+ Ok(DeleteContainerResponse::DeletedEntity(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(CreateCreatorResponse::BadRequest(body))
+ Ok(DeleteContainerResponse::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(CreateCreatorResponse::NotFound(body))
+ Ok(DeleteContainerResponse::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(CreateCreatorResponse::GenericError(body))
+ Ok(DeleteContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -449,67 +382,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_creator_batch(
- &self,
- param_entity_list: &Vec<models::CreatorEntity>,
- param_autoaccept: Option<bool>,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ fn get_container(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/creator/batch?{autoaccept}{editgroup}",
+ "{}/v0/container/{id}?{expand}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR_BATCH.clone()));
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<CreateCreatorBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
- Ok(CreateCreatorBatchResponse::CreatedEntities(body))
+ Ok(GetContainerResponse::FoundEntity(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(CreateCreatorBatchResponse::BadRequest(body))
+ Ok(GetContainerResponse::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(CreateCreatorBatchResponse::NotFound(body))
+ Ok(GetContainerResponse::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(CreateCreatorBatchResponse::GenericError(body))
+ Ok(GetContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -529,45 +450,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_editgroup(&self, param_entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup", self.base_path);
+ 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()));
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/container/{id}/history?{limit}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_EDITGROUP.clone()));
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<CreateEditgroupResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerHistoryResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(CreateEditgroupResponse::SuccessfullyCreated(body))
+ Ok(GetContainerHistoryResponse::FoundEntityHistory(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(CreateEditgroupResponse::BadRequest(body))
+ Ok(GetContainerHistoryResponse::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(GetContainerHistoryResponse::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(CreateEditgroupResponse::GenericError(body))
+ Ok(GetContainerHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -587,55 +518,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_file(&self, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ fn lookup_container(&self, param_issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!("{}/v0/file?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+ let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE.clone()));
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<CreateFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupContainerResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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)?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
- Ok(CreateFileResponse::CreatedEntity(body))
+ Ok(LookupContainerResponse::FoundEntity(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(CreateFileResponse::BadRequest(body))
+ Ok(LookupContainerResponse::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(CreateFileResponse::NotFound(body))
+ Ok(LookupContainerResponse::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(CreateFileResponse::GenericError(body))
+ Ok(LookupContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -655,67 +581,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_file_batch(
+ fn update_container(
&self,
- param_entity_list: &Vec<models::FileEntity>,
- param_autoaccept: Option<bool>,
+ param_id: String,
+ param_entity: models::ContainerEntity,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/file/batch?{autoaccept}{editgroup}",
+ "{}/v0/container/{id}?{editgroup}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_BATCH.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_CONTAINER.clone()));
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<CreateFileBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateContainerResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(CreateFileBatchResponse::CreatedEntities(body))
+ Ok(UpdateContainerResponse::UpdatedEntity(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(CreateFileBatchResponse::BadRequest(body))
+ Ok(UpdateContainerResponse::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(CreateFileBatchResponse::NotFound(body))
+ Ok(UpdateContainerResponse::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(CreateFileBatchResponse::GenericError(body))
+ Ok(UpdateContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -735,11 +660,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/release?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+ let url = format!("{}/v0/creator?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -749,41 +674,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR.clone()));
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<CreateReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateCreatorResponse, ApiError> {
match response.status.to_u16() {
201 => {
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(CreateReleaseResponse::CreatedEntity(body))
+ Ok(CreateCreatorResponse::CreatedEntity(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(CreateReleaseResponse::BadRequest(body))
+ Ok(CreateCreatorResponse::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(CreateReleaseResponse::NotFound(body))
+ Ok(CreateCreatorResponse::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(CreateReleaseResponse::GenericError(body))
+ Ok(CreateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -803,19 +728,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_release_batch(
+ fn create_creator_batch(
&self,
- param_entity_list: &Vec<models::ReleaseEntity>,
+ param_entity_list: &Vec<models::CreatorEntity>,
param_autoaccept: Option<bool>,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
// Query parameters
let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/release/batch?{autoaccept}{editgroup}",
+ "{}/v0/creator/batch?{autoaccept}{editgroup}",
self.base_path,
autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
@@ -829,41 +754,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_CREATOR_BATCH.clone()));
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<CreateReleaseBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateCreatorBatchResponse, ApiError> {
match response.status.to_u16() {
201 => {
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<models::EntityEdit>>(&buf)?;
- Ok(CreateReleaseBatchResponse::CreatedEntities(body))
+ Ok(CreateCreatorBatchResponse::CreatedEntities(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(CreateReleaseBatchResponse::BadRequest(body))
+ Ok(CreateCreatorBatchResponse::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(CreateReleaseBatchResponse::NotFound(body))
+ Ok(CreateCreatorBatchResponse::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(CreateReleaseBatchResponse::GenericError(body))
+ Ok(CreateCreatorBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -883,55 +808,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work(&self, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ fn delete_creator(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/work?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
-
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let url = format!(
+ "{}/v0/creator/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK.clone()));
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<CreateWorkResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteCreatorResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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(CreateWorkResponse::CreatedEntity(body))
+ Ok(DeleteCreatorResponse::DeletedEntity(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(CreateWorkResponse::BadRequest(body))
+ Ok(DeleteCreatorResponse::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(CreateWorkResponse::NotFound(body))
+ Ok(DeleteCreatorResponse::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(CreateWorkResponse::GenericError(body))
+ Ok(DeleteCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -951,67 +876,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work_batch(
- &self,
- param_entity_list: &Vec<models::WorkEntity>,
- param_autoaccept: Option<bool>,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ fn get_creator(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
// Query parameters
- let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/work/batch?{autoaccept}{editgroup}",
+ "{}/v0/creator/{id}?{expand}",
self.base_path,
- autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Post, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK_BATCH.clone()));
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<CreateWorkBatchResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorResponse, ApiError> {
match response.status.to_u16() {
- 201 => {
+ 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<models::EntityEdit>>(&buf)?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
- Ok(CreateWorkBatchResponse::CreatedEntities(body))
+ Ok(GetCreatorResponse::FoundEntity(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(CreateWorkBatchResponse::BadRequest(body))
+ Ok(GetCreatorResponse::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(CreateWorkBatchResponse::NotFound(body))
+ Ok(GetCreatorResponse::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(CreateWorkBatchResponse::GenericError(body))
+ Ok(GetCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1031,19 +944,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_container(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
+ 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_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
let url = format!(
- "{}/v0/container/{id}?{editgroup}",
+ "{}/v0/creator/{id}/history?{limit}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ 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())));
@@ -1051,35 +964,35 @@ impl Api for Client {
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<DeleteContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorHistoryResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(DeleteContainerResponse::DeletedEntity(body))
+ Ok(GetCreatorHistoryResponse::FoundEntityHistory(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(DeleteContainerResponse::BadRequest(body))
+ Ok(GetCreatorHistoryResponse::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(DeleteContainerResponse::NotFound(body))
+ Ok(GetCreatorHistoryResponse::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(DeleteContainerResponse::GenericError(body))
+ Ok(GetCreatorHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1099,19 +1012,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_creator(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!(
- "{}/v0/creator/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ fn get_creator_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator/{id}/releases", 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::Delete, &url);
+ 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())));
@@ -1119,35 +1024,35 @@ impl Api for Client {
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<DeleteCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetCreatorReleasesResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(DeleteCreatorResponse::DeletedEntity(body))
+ Ok(GetCreatorReleasesResponse::Found(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(DeleteCreatorResponse::BadRequest(body))
+ Ok(GetCreatorReleasesResponse::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(DeleteCreatorResponse::NotFound(body))
+ Ok(GetCreatorReleasesResponse::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(DeleteCreatorResponse::GenericError(body))
+ Ok(GetCreatorReleasesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1167,19 +1072,14 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_file(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
- let url = format!(
- "{}/v0/file/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ 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())));
@@ -1187,35 +1087,35 @@ impl Api for Client {
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<DeleteFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupCreatorResponse, 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)?;
+ let body = serde_json::from_str::<models::CreatorEntity>(&buf)?;
- Ok(DeleteFileResponse::DeletedEntity(body))
+ Ok(LookupCreatorResponse::FoundEntity(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(DeleteFileResponse::BadRequest(body))
+ Ok(LookupCreatorResponse::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(DeleteFileResponse::NotFound(body))
+ Ok(LookupCreatorResponse::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(DeleteFileResponse::GenericError(body))
+ Ok(LookupCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1235,55 +1135,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_release(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
+ fn update_creator(
+ &self,
+ param_id: String,
+ param_entity: models::CreatorEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/release/{id}?{editgroup}",
+ "{}/v0/creator/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Delete, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_CREATOR.clone()));
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<DeleteReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateCreatorResponse, 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(DeleteReleaseResponse::DeletedEntity(body))
+ Ok(UpdateCreatorResponse::UpdatedEntity(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(DeleteReleaseResponse::BadRequest(body))
+ Ok(UpdateCreatorResponse::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(DeleteReleaseResponse::NotFound(body))
+ Ok(UpdateCreatorResponse::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(DeleteReleaseResponse::GenericError(body))
+ Ok(UpdateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1303,19 +1214,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn delete_work(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
-
- let url = format!(
- "{}/v0/work/{id}?{editgroup}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
- );
+ fn get_editor(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editor/{id}", 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::Delete, &url);
+ 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())));
@@ -1323,35 +1226,35 @@ impl Api for Client {
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<DeleteWorkResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorResponse, 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)?;
+ let body = serde_json::from_str::<models::Editor>(&buf)?;
- Ok(DeleteWorkResponse::DeletedEntity(body))
+ Ok(GetEditorResponse::Found(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(DeleteWorkResponse::BadRequest(body))
+ Ok(GetEditorResponse::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(DeleteWorkResponse::NotFound(body))
+ Ok(GetEditorResponse::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(DeleteWorkResponse::GenericError(body))
+ Ok(GetEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1371,11 +1274,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_changelog(&self, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
-
- let url = format!("{}/v0/changelog?{limit}", self.base_path, limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET));
+ fn get_editor_changelog(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editor/{id}/changelog", 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);
@@ -1386,21 +1286,35 @@ impl Api for Client {
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<GetChangelogResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorChangelogResponse, 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<models::ChangelogEntry>>(&buf)?;
- Ok(GetChangelogResponse::Success(body))
+ Ok(GetEditorChangelogResponse::Found(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(GetEditorChangelogResponse::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(GetEditorChangelogResponse::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(GetChangelogResponse::GenericError(body))
+ Ok(GetEditorChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1420,8 +1334,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_changelog_entry(&self, param_id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/changelog/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_stats(&self, param_more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_more = param_more.map_or_else(String::new, |query| format!("more={more}&", more = query.to_string()));
+
+ let url = format!("{}/v0/stats?{more}", self.base_path, more = utf8_percent_encode(&query_more, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1432,28 +1349,21 @@ impl Api for Client {
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<GetChangelogEntryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetStatsResponse, 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::ChangelogEntry>(&buf)?;
-
- Ok(GetChangelogEntryResponse::FoundChangelogEntry(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)?;
+ let body = serde_json::from_str::<models::StatsResponse>(&buf)?;
- Ok(GetChangelogEntryResponse::NotFound(body))
+ Ok(GetStatsResponse::Success(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(GetChangelogEntryResponse::GenericError(body))
+ Ok(GetStatsResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1473,19 +1383,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_container(&self, param_id: String, param_expand: 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()));
-
- let url = format!(
- "{}/v0/container/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ fn accept_editgroup(&self, param_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup/{id}/accept", 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 request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
@@ -1493,35 +1395,42 @@ impl Api for Client {
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<GetContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<AcceptEditgroupResponse, 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)?;
+ let body = serde_json::from_str::<models::Success>(&buf)?;
- Ok(GetContainerResponse::FoundEntity(body))
+ Ok(AcceptEditgroupResponse::MergedSuccessfully(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(GetContainerResponse::BadRequest(body))
+ Ok(AcceptEditgroupResponse::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(GetContainerResponse::NotFound(body))
+ Ok(AcceptEditgroupResponse::NotFound(body))
+ }
+ 409 => {
+ 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(AcceptEditgroupResponse::EditConflict(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(GetContainerResponse::GenericError(body))
+ Ok(AcceptEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1541,55 +1450,45 @@ impl Api for Client {
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()));
+ fn create_editgroup(&self, param_editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup", self.base_path);
- let url = format!(
- "{}/v0/container/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ let body = serde_json::to_string(&param_editgroup).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_EDITGROUP.clone()));
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<GetContainerHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateEditgroupResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(GetContainerHistoryResponse::FoundEntityHistory(body))
+ Ok(CreateEditgroupResponse::SuccessfullyCreated(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(GetContainerHistoryResponse::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(GetContainerHistoryResponse::NotFound(body))
+ Ok(CreateEditgroupResponse::BadRequest(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(GetContainerHistoryResponse::GenericError(body))
+ Ok(CreateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1609,16 +1508,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_creator(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ fn get_changelog(&self, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, 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_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
- let url = format!(
- "{}/v0/creator/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/changelog?{limit}", self.base_path, limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1629,35 +1523,21 @@ impl Api for Client {
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<GetCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetChangelogResponse, 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(GetCreatorResponse::FoundEntity(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(GetCreatorResponse::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)?;
+ let body = serde_json::from_str::<Vec<models::ChangelogEntry>>(&buf)?;
- Ok(GetCreatorResponse::NotFound(body))
+ Ok(GetChangelogResponse::Success(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(GetCreatorResponse::GenericError(body))
+ Ok(GetChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1677,16 +1557,8 @@ impl Api for Client {
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()));
-
- let url = format!(
- "{}/v0/creator/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ fn get_changelog_entry(&self, param_id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/changelog/{id}", 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);
@@ -1697,35 +1569,28 @@ impl Api for Client {
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<GetCreatorHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetChangelogEntryResponse, 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<models::EntityHistoryEntry>>(&buf)?;
-
- Ok(GetCreatorHistoryResponse::FoundEntityHistory(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)?;
+ let body = serde_json::from_str::<models::ChangelogEntry>(&buf)?;
- Ok(GetCreatorHistoryResponse::BadRequest(body))
+ Ok(GetChangelogEntryResponse::FoundChangelogEntry(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(GetCreatorHistoryResponse::NotFound(body))
+ Ok(GetChangelogEntryResponse::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(GetCreatorHistoryResponse::GenericError(body))
+ Ok(GetChangelogEntryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1745,8 +1610,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_creator_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator/{id}/releases", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_editgroup(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/editgroup/{id}", 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);
@@ -1757,35 +1622,35 @@ impl Api for Client {
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<GetCreatorReleasesResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditgroupResponse, 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<models::ReleaseEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(GetCreatorReleasesResponse::Found(body))
+ Ok(GetEditgroupResponse::Found(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(GetCreatorReleasesResponse::BadRequest(body))
+ Ok(GetEditgroupResponse::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(GetCreatorReleasesResponse::NotFound(body))
+ Ok(GetEditgroupResponse::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(GetCreatorReleasesResponse::GenericError(body))
+ Ok(GetEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1805,47 +1670,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editgroup(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn create_file(&self, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/file?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE.clone()));
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<GetEditgroupResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetEditgroupResponse::Found(body))
+ Ok(CreateFileResponse::CreatedEntity(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(GetEditgroupResponse::BadRequest(body))
+ Ok(CreateFileResponse::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(GetEditgroupResponse::NotFound(body))
+ Ok(CreateFileResponse::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(GetEditgroupResponse::GenericError(body))
+ Ok(CreateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1865,47 +1738,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editor/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn create_file_batch(
+ &self,
+ param_entity_list: &Vec<models::FileEntity>,
+ param_autoaccept: Option<bool>,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/batch?{autoaccept}{editgroup}",
+ self.base_path,
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_FILE_BATCH.clone()));
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<GetEditorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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::Editor>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(GetEditorResponse::Found(body))
+ Ok(CreateFileBatchResponse::CreatedEntities(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(GetEditorResponse::BadRequest(body))
+ Ok(CreateFileBatchResponse::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(GetEditorResponse::NotFound(body))
+ Ok(CreateFileBatchResponse::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(GetEditorResponse::GenericError(body))
+ Ok(CreateFileBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1925,11 +1818,19 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor_changelog(&self, param_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editor/{id}/changelog", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn delete_file(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ 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())));
@@ -1937,35 +1838,35 @@ impl Api for Client {
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<GetEditorChangelogResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteFileResponse, 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<models::ChangelogEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetEditorChangelogResponse::Found(body))
+ Ok(DeleteFileResponse::DeletedEntity(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(GetEditorChangelogResponse::BadRequest(body))
+ Ok(DeleteFileResponse::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(GetEditorChangelogResponse::NotFound(body))
+ Ok(DeleteFileResponse::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(GetEditorChangelogResponse::GenericError(body))
+ Ok(DeleteFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2121,16 +2022,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ fn lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, 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_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
- let url = format!(
- "{}/v0/release/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2141,35 +2037,35 @@ impl Api for Client {
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<GetReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupFileResponse, 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)?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
- Ok(GetReleaseResponse::FoundEntity(body))
+ Ok(LookupFileResponse::FoundEntity(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(GetReleaseResponse::BadRequest(body))
+ Ok(LookupFileResponse::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(GetReleaseResponse::NotFound(body))
+ Ok(LookupFileResponse::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(GetReleaseResponse::GenericError(body))
+ Ok(LookupFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2189,47 +2085,60 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release_files(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release/{id}/files", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_file(&self, param_id: String, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_FILE.clone()));
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<GetReleaseFilesResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateFileResponse, 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<models::FileEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetReleaseFilesResponse::Found(body))
+ Ok(UpdateFileResponse::UpdatedEntity(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(GetReleaseFilesResponse::BadRequest(body))
+ Ok(UpdateFileResponse::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(GetReleaseFilesResponse::NotFound(body))
+ Ok(UpdateFileResponse::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(GetReleaseFilesResponse::GenericError(body))
+ Ok(UpdateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2249,55 +2158,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_release_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
+ fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!(
- "{}/v0/release/{id}/history?{limit}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/release?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.clone()));
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<GetReleaseHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateReleaseResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetReleaseHistoryResponse::FoundEntityHistory(body))
+ Ok(CreateReleaseResponse::CreatedEntity(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(GetReleaseHistoryResponse::BadRequest(body))
+ Ok(CreateReleaseResponse::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(GetReleaseHistoryResponse::NotFound(body))
+ Ok(CreateReleaseResponse::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(GetReleaseHistoryResponse::GenericError(body))
+ Ok(CreateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2317,36 +2226,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_stats(&self, param_more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ fn create_release_batch(
+ &self,
+ param_entity_list: &Vec<models::ReleaseEntity>,
+ param_autoaccept: Option<bool>,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
// Query parameters
- let query_more = param_more.map_or_else(String::new, |query| format!("more={more}&", more = query.to_string()));
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/stats?{more}", self.base_path, more = utf8_percent_encode(&query_more, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/batch?{autoaccept}{editgroup}",
+ self.base_path,
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone()));
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<GetStatsResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateReleaseBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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::StatsResponse>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(GetStatsResponse::Success(body))
+ Ok(CreateReleaseBatchResponse::CreatedEntities(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(CreateReleaseBatchResponse::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(CreateReleaseBatchResponse::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(GetStatsResponse::GenericError(body))
+ Ok(CreateReleaseBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2366,55 +2306,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_work(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ fn create_work(&self, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, 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_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!(
- "{}/v0/work/{id}?{expand}",
- self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
- );
+ let url = format!("{}/v0/work?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK.clone()));
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<GetWorkResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetWorkResponse::FoundEntity(body))
+ Ok(CreateWorkResponse::CreatedEntity(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(GetWorkResponse::BadRequest(body))
+ Ok(CreateWorkResponse::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(GetWorkResponse::NotFound(body))
+ Ok(CreateWorkResponse::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(GetWorkResponse::GenericError(body))
+ Ok(CreateWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2434,19 +2374,19 @@ impl Api for Client {
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> {
+ fn delete_release(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/work/{id}/history?{limit}",
+ "{}/v0/release/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ 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())));
@@ -2454,35 +2394,35 @@ impl Api for Client {
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<GetWorkHistoryResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteReleaseResponse, 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<models::EntityHistoryEntry>>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(GetWorkHistoryResponse::FoundEntityHistory(body))
+ Ok(DeleteReleaseResponse::DeletedEntity(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(GetWorkHistoryResponse::BadRequest(body))
+ Ok(DeleteReleaseResponse::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(GetWorkHistoryResponse::NotFound(body))
+ Ok(DeleteReleaseResponse::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(GetWorkHistoryResponse::GenericError(body))
+ Ok(DeleteReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2502,8 +2442,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_work_releases(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/{id}/releases", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_release(&self, param_id: String, param_expand: 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()));
+
+ let url = format!(
+ "{}/v0/release/{id}?{expand}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2514,35 +2462,35 @@ impl Api for Client {
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<GetWorkReleasesResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseResponse, 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<models::ReleaseEntity>>(&buf)?;
+ let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
- Ok(GetWorkReleasesResponse::Found(body))
+ Ok(GetReleaseResponse::FoundEntity(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(GetWorkReleasesResponse::BadRequest(body))
+ Ok(GetReleaseResponse::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(GetWorkReleasesResponse::NotFound(body))
+ Ok(GetReleaseResponse::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(GetWorkReleasesResponse::GenericError(body))
+ Ok(GetReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2562,11 +2510,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_container(&self, param_issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
-
- let url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, QUERY_ENCODE_SET));
+ fn get_release_files(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release/{id}/files", 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);
@@ -2577,35 +2522,35 @@ impl Api for Client {
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<LookupContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseFilesResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::FileEntity>>(&buf)?;
- Ok(LookupContainerResponse::FoundEntity(body))
+ Ok(GetReleaseFilesResponse::Found(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(LookupContainerResponse::BadRequest(body))
+ Ok(GetReleaseFilesResponse::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(LookupContainerResponse::NotFound(body))
+ Ok(GetReleaseFilesResponse::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(LookupContainerResponse::GenericError(body))
+ Ok(GetReleaseFilesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2625,11 +2570,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_release_history(&self, param_id: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
// Query parameters
- let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
- let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/{id}/history?{limit}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2640,35 +2590,35 @@ impl Api for Client {
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<LookupCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetReleaseHistoryResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?;
- Ok(LookupCreatorResponse::FoundEntity(body))
+ Ok(GetReleaseHistoryResponse::FoundEntityHistory(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(LookupCreatorResponse::BadRequest(body))
+ Ok(GetReleaseHistoryResponse::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(LookupCreatorResponse::NotFound(body))
+ Ok(GetReleaseHistoryResponse::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(LookupCreatorResponse::GenericError(body))
+ Ok(GetReleaseHistoryResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2688,11 +2638,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
+ let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
- let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
+ let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -2703,35 +2653,35 @@ impl Api for Client {
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<LookupFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupReleaseResponse, 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)?;
+ let body = serde_json::from_str::<models::ReleaseEntity>(&buf)?;
- Ok(LookupFileResponse::FoundEntity(body))
+ Ok(LookupReleaseResponse::FoundEntity(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(LookupFileResponse::BadRequest(body))
+ Ok(LookupReleaseResponse::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(LookupFileResponse::NotFound(body))
+ Ok(LookupReleaseResponse::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(LookupFileResponse::GenericError(body))
+ Ok(LookupReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2751,50 +2701,66 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ fn update_release(
+ &self,
+ param_id: String,
+ param_entity: models::ReleaseEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
// Query parameters
- let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
- let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
+ let url = format!(
+ "{}/v0/release/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Get, &url);
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
let mut custom_headers = hyper::header::Headers::new();
+ let request = request.body(&body);
+
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_RELEASE.clone()));
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<LookupReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateReleaseResponse, 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)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(LookupReleaseResponse::FoundEntity(body))
+ Ok(UpdateReleaseResponse::UpdatedEntity(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(LookupReleaseResponse::BadRequest(body))
+ Ok(UpdateReleaseResponse::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(LookupReleaseResponse::NotFound(body))
+ Ok(UpdateReleaseResponse::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(LookupReleaseResponse::GenericError(body))
+ Ok(UpdateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2814,66 +2780,67 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_container(
+ fn create_work_batch(
&self,
- param_id: String,
- param_entity: models::ContainerEntity,
+ param_entity_list: &Vec<models::WorkEntity>,
+ param_autoaccept: Option<bool>,
param_editgroup: Option<String>,
context: &Context,
- ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
// Query parameters
+ let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string()));
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/container/{id}?{editgroup}",
+ "{}/v0/work/batch?{autoaccept}{editgroup}",
self.base_path,
- id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Post, &url);
let mut custom_headers = hyper::header::Headers::new();
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_CONTAINER.clone()));
+ custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK_BATCH.clone()));
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<UpdateContainerResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkBatchResponse, ApiError> {
match response.status.to_u16() {
- 200 => {
+ 201 => {
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)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(UpdateContainerResponse::UpdatedEntity(body))
+ Ok(CreateWorkBatchResponse::CreatedEntities(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(UpdateContainerResponse::BadRequest(body))
+ Ok(CreateWorkBatchResponse::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(UpdateContainerResponse::NotFound(body))
+ Ok(CreateWorkBatchResponse::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(UpdateContainerResponse::GenericError(body))
+ Ok(CreateWorkBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2893,66 +2860,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_creator(
- &self,
- param_id: String,
- param_entity: models::CreatorEntity,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ fn delete_work(&self, param_id: String, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
let url = format!(
- "{}/v0/creator/{id}?{editgroup}",
+ "{}/v0/work/{id}?{editgroup}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Delete, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_CREATOR.clone()));
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<UpdateCreatorResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<DeleteWorkResponse, 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(UpdateCreatorResponse::UpdatedEntity(body))
+ Ok(DeleteWorkResponse::DeletedEntity(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(UpdateCreatorResponse::BadRequest(body))
+ Ok(DeleteWorkResponse::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(UpdateCreatorResponse::NotFound(body))
+ Ok(DeleteWorkResponse::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(UpdateCreatorResponse::GenericError(body))
+ Ok(DeleteWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2972,60 +2928,55 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_file(&self, param_id: String, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ fn get_work(&self, param_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
// Query parameters
- let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
let url = format!(
- "{}/v0/file/{id}?{editgroup}",
+ "{}/v0/work/{id}?{expand}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_FILE.clone()));
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<UpdateFileResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkResponse, 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)?;
+ let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
- Ok(UpdateFileResponse::UpdatedEntity(body))
+ Ok(GetWorkResponse::FoundEntity(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(UpdateFileResponse::BadRequest(body))
+ Ok(GetWorkResponse::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(UpdateFileResponse::NotFound(body))
+ Ok(GetWorkResponse::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(UpdateFileResponse::GenericError(body))
+ Ok(GetWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -3045,66 +2996,115 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_release(
- &self,
- param_id: String,
- param_entity: models::ReleaseEntity,
- param_editgroup: Option<String>,
- context: &Context,
- ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ 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_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
let url = format!(
- "{}/v0/release/{id}?{editgroup}",
+ "{}/v0/work/{id}/history?{limit}",
self.base_path,
id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
- editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET)
);
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
-
let hyper_client = (self.hyper_client)();
- let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
let mut custom_headers = hyper::header::Headers::new();
- let request = request.body(&body);
+ 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<GetWorkHistoryResponse, 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<models::EntityHistoryEntry>>(&buf)?;
+
+ Ok(GetWorkHistoryResponse::FoundEntityHistory(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(GetWorkHistoryResponse::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(GetWorkHistoryResponse::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(GetWorkHistoryResponse::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, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/{id}/releases", 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();
- custom_headers.set(ContentType(mimetypes::requests::UPDATE_RELEASE.clone()));
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<UpdateReleaseResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetWorkReleasesResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::ReleaseEntity>>(&buf)?;
- Ok(UpdateReleaseResponse::UpdatedEntity(body))
+ Ok(GetWorkReleasesResponse::Found(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(UpdateReleaseResponse::BadRequest(body))
+ Ok(GetWorkReleasesResponse::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(UpdateReleaseResponse::NotFound(body))
+ Ok(GetWorkReleasesResponse::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(UpdateReleaseResponse::GenericError(body))
+ Ok(GetWorkReleasesResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs
index a246bb43..baf130a1 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -33,20 +33,6 @@ mod mimetypes;
pub use swagger::{ApiError, Context, ContextWrapper};
#[derive(Debug, PartialEq)]
-pub enum AcceptEditgroupResponse {
- /// Merged Successfully
- MergedSuccessfully(models::Success),
- /// Bad Request
- BadRequest(models::ErrorResponse),
- /// Not Found
- NotFound(models::ErrorResponse),
- /// Edit Conflict
- EditConflict(models::ErrorResponse),
- /// Generic Error
- GenericError(models::ErrorResponse),
-}
-
-#[derive(Debug, PartialEq)]
pub enum CreateContainerResponse {
/// Created Entity
CreatedEntity(models::EntityEdit),
@@ -71,9 +57,9 @@ pub enum CreateContainerBatchResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateCreatorResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum DeleteContainerResponse {
+ /// Deleted Entity
+ DeletedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -83,9 +69,9 @@ pub enum CreateCreatorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateCreatorBatchResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -95,19 +81,21 @@ pub enum CreateCreatorBatchResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateEditgroupResponse {
- /// Successfully Created
- SuccessfullyCreated(models::Editgroup),
+pub enum GetContainerHistoryResponse {
+ /// Found Entity History
+ FoundEntityHistory(Vec<models::EntityHistoryEntry>),
/// Bad Request
BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum CreateFileResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum LookupContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -117,9 +105,9 @@ pub enum CreateFileResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateFileBatchResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum UpdateContainerResponse {
+ /// Updated Entity
+ UpdatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -129,7 +117,7 @@ pub enum CreateFileBatchResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateReleaseResponse {
+pub enum CreateCreatorResponse {
/// Created Entity
CreatedEntity(models::EntityEdit),
/// Bad Request
@@ -141,7 +129,7 @@ pub enum CreateReleaseResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateReleaseBatchResponse {
+pub enum CreateCreatorBatchResponse {
/// Created Entities
CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
@@ -153,9 +141,9 @@ pub enum CreateReleaseBatchResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateWorkResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum DeleteCreatorResponse {
+ /// Deleted Entity
+ DeletedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -165,9 +153,9 @@ pub enum CreateWorkResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreateWorkBatchResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -177,9 +165,9 @@ pub enum CreateWorkBatchResponse {
}
#[derive(Debug, PartialEq)]
-pub enum DeleteContainerResponse {
- /// Deleted Entity
- DeletedEntity(models::EntityEdit),
+pub enum GetCreatorHistoryResponse {
+ /// Found Entity History
+ FoundEntityHistory(Vec<models::EntityHistoryEntry>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -189,9 +177,9 @@ pub enum DeleteContainerResponse {
}
#[derive(Debug, PartialEq)]
-pub enum DeleteCreatorResponse {
- /// Deleted Entity
- DeletedEntity(models::EntityEdit),
+pub enum GetCreatorReleasesResponse {
+ /// Found
+ Found(Vec<models::ReleaseEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -201,9 +189,9 @@ pub enum DeleteCreatorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum DeleteFileResponse {
- /// Deleted Entity
- DeletedEntity(models::EntityEdit),
+pub enum LookupCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -213,9 +201,9 @@ pub enum DeleteFileResponse {
}
#[derive(Debug, PartialEq)]
-pub enum DeleteReleaseResponse {
- /// Deleted Entity
- DeletedEntity(models::EntityEdit),
+pub enum UpdateCreatorResponse {
+ /// Updated Entity
+ UpdatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -225,9 +213,9 @@ pub enum DeleteReleaseResponse {
}
#[derive(Debug, PartialEq)]
-pub enum DeleteWorkResponse {
- /// Deleted Entity
- DeletedEntity(models::EntityEdit),
+pub enum GetEditorResponse {
+ /// Found
+ Found(models::Editor),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -237,65 +225,61 @@ pub enum DeleteWorkResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetChangelogResponse {
- /// Success
- Success(Vec<models::ChangelogEntry>),
+pub enum GetEditorChangelogResponse {
+ /// Found
+ Found(Vec<models::ChangelogEntry>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum GetChangelogEntryResponse {
- /// Found Changelog Entry
- FoundChangelogEntry(models::ChangelogEntry),
- /// Not Found
- NotFound(models::ErrorResponse),
+pub enum GetStatsResponse {
+ /// Success
+ Success(models::StatsResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum GetContainerResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum AcceptEditgroupResponse {
+ /// Merged Successfully
+ MergedSuccessfully(models::Success),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
+ /// Edit Conflict
+ EditConflict(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum GetContainerHistoryResponse {
- /// Found Entity History
- FoundEntityHistory(Vec<models::EntityHistoryEntry>),
+pub enum CreateEditgroupResponse {
+ /// Successfully Created
+ SuccessfullyCreated(models::Editgroup),
/// 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),
- /// Bad Request
- BadRequest(models::ErrorResponse),
- /// Not Found
- NotFound(models::ErrorResponse),
+pub enum GetChangelogResponse {
+ /// Success
+ Success(Vec<models::ChangelogEntry>),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum GetCreatorHistoryResponse {
- /// Found Entity History
- FoundEntityHistory(Vec<models::EntityHistoryEntry>),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum GetChangelogEntryResponse {
+ /// Found Changelog Entry
+ FoundChangelogEntry(models::ChangelogEntry),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -303,9 +287,9 @@ pub enum GetCreatorHistoryResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetCreatorReleasesResponse {
+pub enum GetEditgroupResponse {
/// Found
- Found(Vec<models::ReleaseEntity>),
+ Found(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -315,9 +299,9 @@ pub enum GetCreatorReleasesResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetEditgroupResponse {
- /// Found
- Found(models::Editgroup),
+pub enum CreateFileResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -327,9 +311,9 @@ pub enum GetEditgroupResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetEditorResponse {
- /// Found
- Found(models::Editor),
+pub enum CreateFileBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -339,9 +323,9 @@ pub enum GetEditorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetEditorChangelogResponse {
- /// Found
- Found(Vec<models::ChangelogEntry>),
+pub enum DeleteFileResponse {
+ /// Deleted Entity
+ DeletedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -375,9 +359,9 @@ pub enum GetFileHistoryResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetReleaseResponse {
+pub enum LookupFileResponse {
/// Found Entity
- FoundEntity(models::ReleaseEntity),
+ FoundEntity(models::FileEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -387,9 +371,9 @@ pub enum GetReleaseResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetReleaseFilesResponse {
- /// Found
- Found(Vec<models::FileEntity>),
+pub enum UpdateFileResponse {
+ /// Updated Entity
+ UpdatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -399,9 +383,9 @@ pub enum GetReleaseFilesResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetReleaseHistoryResponse {
- /// Found Entity History
- FoundEntityHistory(Vec<models::EntityHistoryEntry>),
+pub enum CreateReleaseResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -411,17 +395,21 @@ pub enum GetReleaseHistoryResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetStatsResponse {
- /// Success
- Success(models::StatsResponse),
+pub enum CreateReleaseBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
+ /// 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),
+pub enum CreateWorkResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -431,9 +419,9 @@ pub enum GetWorkResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetWorkHistoryResponse {
- /// Found Entity History
- FoundEntityHistory(Vec<models::EntityHistoryEntry>),
+pub enum DeleteReleaseResponse {
+ /// Deleted Entity
+ DeletedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -443,9 +431,21 @@ pub enum GetWorkHistoryResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetWorkReleasesResponse {
+pub enum GetReleaseResponse {
+ /// Found Entity
+ FoundEntity(models::ReleaseEntity),
+ /// 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::ReleaseEntity>),
+ Found(Vec<models::FileEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -455,9 +455,9 @@ pub enum GetWorkReleasesResponse {
}
#[derive(Debug, PartialEq)]
-pub enum LookupContainerResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum GetReleaseHistoryResponse {
+ /// Found Entity History
+ FoundEntityHistory(Vec<models::EntityHistoryEntry>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -467,9 +467,9 @@ pub enum LookupContainerResponse {
}
#[derive(Debug, PartialEq)]
-pub enum LookupCreatorResponse {
+pub enum LookupReleaseResponse {
/// Found Entity
- FoundEntity(models::CreatorEntity),
+ FoundEntity(models::ReleaseEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -479,9 +479,9 @@ pub enum LookupCreatorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum LookupFileResponse {
- /// Found Entity
- FoundEntity(models::FileEntity),
+pub enum UpdateReleaseResponse {
+ /// Updated Entity
+ UpdatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -491,9 +491,9 @@ pub enum LookupFileResponse {
}
#[derive(Debug, PartialEq)]
-pub enum LookupReleaseResponse {
- /// Found Entity
- FoundEntity(models::ReleaseEntity),
+pub enum CreateWorkBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -503,9 +503,9 @@ pub enum LookupReleaseResponse {
}
#[derive(Debug, PartialEq)]
-pub enum UpdateContainerResponse {
- /// Updated Entity
- UpdatedEntity(models::EntityEdit),
+pub enum DeleteWorkResponse {
+ /// Deleted Entity
+ DeletedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -515,9 +515,9 @@ pub enum UpdateContainerResponse {
}
#[derive(Debug, PartialEq)]
-pub enum UpdateCreatorResponse {
- /// Updated Entity
- UpdatedEntity(models::EntityEdit),
+pub enum GetWorkResponse {
+ /// Found Entity
+ FoundEntity(models::WorkEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -527,9 +527,9 @@ pub enum UpdateCreatorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum UpdateFileResponse {
- /// Updated Entity
- UpdatedEntity(models::EntityEdit),
+pub enum GetWorkHistoryResponse {
+ /// Found Entity History
+ FoundEntityHistory(Vec<models::EntityHistoryEntry>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -539,9 +539,9 @@ pub enum UpdateFileResponse {
}
#[derive(Debug, PartialEq)]
-pub enum UpdateReleaseResponse {
- /// Updated Entity
- UpdatedEntity(models::EntityEdit),
+pub enum GetWorkReleasesResponse {
+ /// Found
+ Found(Vec<models::ReleaseEntity>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -564,8 +564,6 @@ pub enum UpdateWorkResponse {
/// API
pub trait Api {
- fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
-
fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
fn create_container_batch(
@@ -576,6 +574,16 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
+ fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
+
+ fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, 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, 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>;
+
fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
fn create_creator_batch(
@@ -586,7 +594,33 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
+ fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
+
+ fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, 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_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
+
+ fn lookup_creator(&self, orcid: 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>;
+
+ fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
+
+ fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
+
+ fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send>;
+
+ fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
+
+ fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
+
+ fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send>;
+
+ fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>;
+
+ fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
@@ -598,6 +632,16 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
+ fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
+
+ fn get_file(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, 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, 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>;
+
fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
fn create_release_batch(
@@ -610,6 +654,18 @@ pub trait Api {
fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
+ fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
+
+ fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
+
+ fn get_release_files(&self, id: 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, 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>;
+
fn create_work_batch(
&self,
entity_list: &Vec<models::WorkEntity>,
@@ -618,77 +674,19 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
-
- fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
-
- fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
-
- fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
-
fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>;
- fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send>;
-
- fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>;
-
- fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
-
- fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>;
-
- fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, 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_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
-
- fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
-
- fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
-
- fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
-
- fn get_file(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
-
- fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>;
-
- fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
-
- fn get_release_files(&self, id: 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 get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send>;
-
fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, 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_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>;
- fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
-
- fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
-
- fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
-
- fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
-
- fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
-
- fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
-
- fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
-
- fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
-
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
pub trait ApiNoContext {
- fn accept_editgroup(&self, id: String) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
-
fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
fn create_container_batch(
@@ -698,6 +696,16 @@ pub trait ApiNoContext {
editgroup: Option<String>,
) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
+ fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
+
+ fn get_container(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetContainerResponse, 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) -> 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>;
+
fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
fn create_creator_batch(
@@ -707,88 +715,80 @@ pub trait ApiNoContext {
editgroup: Option<String>,
) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
-
- fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
+ fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
- fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
+ fn get_creator(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
- fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
+ fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>;
- fn create_release_batch(
- &self,
- entity_list: &Vec<models::ReleaseEntity>,
- autoaccept: Option<bool>,
- editgroup: Option<String>,
- ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
+ fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
- fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
- fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
- fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send>;
+ fn get_editor(&self, id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>;
+ fn get_editor_changelog(&self, id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
- fn delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
+ fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send>;
- fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
+ fn accept_editgroup(&self, id: String) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>;
+ fn create_editgroup(&self, editgroup: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
fn get_changelog(&self, limit: Option<i64>) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send>;
fn get_changelog_entry(&self, id: i64) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>;
- fn get_container(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
-
- fn get_container_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>;
-
- fn get_creator(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
-
- fn get_creator_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>;
-
- fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>;
-
fn get_editgroup(&self, id: String) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
- fn get_editor(&self, id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
- fn get_editor_changelog(&self, id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
+
+ fn delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send>;
fn get_file(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
fn get_file_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>;
- fn get_release(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
-
- fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
+ fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
- fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>;
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
- fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
- fn get_work(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
+ fn create_release_batch(
+ &self,
+ entity_list: &Vec<models::ReleaseEntity>,
+ autoaccept: Option<bool>,
+ editgroup: Option<String>,
+ ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
- fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>;
+ fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>;
- fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
+ fn get_release(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
- fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
+ fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
- fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, 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) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
- fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
- fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
+ fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send>;
- fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
+ fn get_work(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
+
+ fn get_work_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>;
+
+ fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>;
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
@@ -809,10 +809,6 @@ impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T {
}
impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
- fn accept_editgroup(&self, id: String) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
- self.api().accept_editgroup(id, &self.context())
- }
-
fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
self.api().create_container(entity, editgroup, &self.context())
}
@@ -826,110 +822,105 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().create_container_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
- self.api().create_creator(entity, editgroup, &self.context())
+ fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
+ self.api().delete_container(id, editgroup, &self.context())
}
- fn create_creator_batch(
- &self,
- entity_list: &Vec<models::CreatorEntity>,
- autoaccept: Option<bool>,
- editgroup: Option<String>,
- ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
- self.api().create_creator_batch(entity_list, autoaccept, editgroup, &self.context())
+ fn get_container(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ self.api().get_container(id, expand, &self.context())
}
- fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
- self.api().create_editgroup(entity, &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 create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
- self.api().create_file(entity, editgroup, &self.context())
+ fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ self.api().lookup_container(issnl, &self.context())
}
- fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
- self.api().create_file_batch(entity_list, autoaccept, editgroup, &self.context())
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ self.api().update_container(id, entity, editgroup, &self.context())
}
- fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
- self.api().create_release(entity, editgroup, &self.context())
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ self.api().create_creator(entity, editgroup, &self.context())
}
- fn create_release_batch(
+ fn create_creator_batch(
&self,
- entity_list: &Vec<models::ReleaseEntity>,
+ entity_list: &Vec<models::CreatorEntity>,
autoaccept: Option<bool>,
editgroup: Option<String>,
- ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
- self.api().create_release_batch(entity_list, autoaccept, editgroup, &self.context())
- }
-
- fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
- self.api().create_work(entity, editgroup, &self.context())
+ ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ self.api().create_creator_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
- self.api().create_work_batch(entity_list, autoaccept, editgroup, &self.context())
+ fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
+ self.api().delete_creator(id, editgroup, &self.context())
}
- fn delete_container(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> {
- self.api().delete_container(id, editgroup, &self.context())
+ fn get_creator(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ self.api().get_creator(id, expand, &self.context())
}
- fn delete_creator(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> {
- self.api().delete_creator(id, editgroup, &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 delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
- self.api().delete_file(id, editgroup, &self.context())
+ fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
+ self.api().get_creator_releases(id, &self.context())
}
- fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
- self.api().delete_release(id, editgroup, &self.context())
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ self.api().lookup_creator(orcid, &self.context())
}
- fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
- self.api().delete_work(id, editgroup, &self.context())
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ self.api().update_creator(id, entity, editgroup, &self.context())
}
- fn get_changelog(&self, limit: Option<i64>) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
- self.api().get_changelog(limit, &self.context())
+ fn get_editor(&self, id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ self.api().get_editor(id, &self.context())
}
- fn get_changelog_entry(&self, id: i64) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
- self.api().get_changelog_entry(id, &self.context())
+ fn get_editor_changelog(&self, id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ self.api().get_editor_changelog(id, &self.context())
}
- fn get_container(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
- self.api().get_container(id, expand, &self.context())
+ fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ self.api().get_stats(more, &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 accept_editgroup(&self, id: String) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ self.api().accept_editgroup(id, &self.context())
}
- fn get_creator(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
- self.api().get_creator(id, expand, &self.context())
+ fn create_editgroup(&self, editgroup: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ self.api().create_editgroup(editgroup, &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_changelog(&self, limit: Option<i64>) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
+ self.api().get_changelog(limit, &self.context())
}
- fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
- self.api().get_creator_releases(id, &self.context())
+ fn get_changelog_entry(&self, id: i64) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ self.api().get_changelog_entry(id, &self.context())
}
fn get_editgroup(&self, id: String) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
self.api().get_editgroup(id, &self.context())
}
- fn get_editor(&self, id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
- self.api().get_editor(id, &self.context())
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ self.api().create_file(entity, editgroup, &self.context())
}
- fn get_editor_changelog(&self, id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
- self.api().get_editor_changelog(id, &self.context())
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ self.api().create_file_batch(entity_list, autoaccept, editgroup, &self.context())
+ }
+
+ fn delete_file(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> {
+ self.api().delete_file(id, editgroup, &self.context())
}
fn get_file(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
@@ -940,64 +931,73 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().get_file_history(id, limit, &self.context())
}
- fn get_release(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
- self.api().get_release(id, expand, &self.context())
- }
-
- fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
- self.api().get_release_files(id, &self.context())
+ fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ self.api().lookup_file(sha1, &self.context())
}
- fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
- self.api().get_release_history(id, limit, &self.context())
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ self.api().update_file(id, entity, editgroup, &self.context())
}
- fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
- self.api().get_stats(more, &self.context())
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ self.api().create_release(entity, editgroup, &self.context())
}
- fn get_work(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
- self.api().get_work(id, expand, &self.context())
+ fn create_release_batch(
+ &self,
+ entity_list: &Vec<models::ReleaseEntity>,
+ autoaccept: Option<bool>,
+ editgroup: Option<String>,
+ ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ self.api().create_release_batch(entity_list, autoaccept, editgroup, &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 create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ self.api().create_work(entity, editgroup, &self.context())
}
- fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
- self.api().get_work_releases(id, &self.context())
+ fn delete_release(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
+ self.api().delete_release(id, editgroup, &self.context())
}
- fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
- self.api().lookup_container(issnl, &self.context())
+ fn get_release(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ self.api().get_release(id, expand, &self.context())
}
- fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
- self.api().lookup_creator(orcid, &self.context())
+ fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
+ self.api().get_release_files(id, &self.context())
}
- fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
- self.api().lookup_file(sha1, &self.context())
+ fn get_release_history(&self, id: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> {
+ self.api().get_release_history(id, limit, &self.context())
}
fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
self.api().lookup_release(doi, &self.context())
}
- fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
- self.api().update_container(id, entity, editgroup, &self.context())
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ self.api().update_release(id, entity, editgroup, &self.context())
}
- fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
- self.api().update_creator(id, entity, editgroup, &self.context())
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ self.api().create_work_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
- self.api().update_file(id, entity, editgroup, &self.context())
+ fn delete_work(&self, id: String, editgroup: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> {
+ self.api().delete_work(id, editgroup, &self.context())
}
- fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
- self.api().update_release(id, entity, editgroup, &self.context())
+ fn get_work(&self, id: String, expand: Option<String>) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ self.api().get_work(id, expand, &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_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
+ self.api().get_work_releases(id, &self.context())
}
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs
index ff2c12ce..dcf13f7a 100644
--- a/rust/fatcat-api-spec/src/mimetypes.rs
+++ b/rust/fatcat-api-spec/src/mimetypes.rs
@@ -4,26 +4,6 @@ pub mod responses {
use hyper::mime::*;
// The macro is called per-operation to beat the recursion limit
- /// Create Mime objects for the response content types for AcceptEditgroup
- lazy_static! {
- pub static ref ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for AcceptEditgroup
- lazy_static! {
- pub static ref ACCEPT_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for AcceptEditgroup
- lazy_static! {
- pub static ref ACCEPT_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for AcceptEditgroup
- lazy_static! {
- pub static ref ACCEPT_EDITGROUP_EDIT_CONFLICT: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for AcceptEditgroup
- lazy_static! {
- pub static ref ACCEPT_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
- }
/// Create Mime objects for the response content types for CreateContainer
lazy_static! {
pub static ref CREATE_CONTAINER_CREATED_ENTITY: Mime = mime!(Application / Json);
@@ -56,325 +36,305 @@ pub mod responses {
lazy_static! {
pub static ref CREATE_CONTAINER_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateCreator
- lazy_static! {
- pub static ref CREATE_CREATOR_CREATED_ENTITY: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for CreateCreator
- lazy_static! {
- pub static ref CREATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for CreateCreator
- lazy_static! {
- pub static ref CREATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for CreateCreator
- lazy_static! {
- pub static ref CREATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for CreateCreatorBatch
- lazy_static! {
- pub static ref CREATE_CREATOR_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for CreateCreatorBatch
+ /// Create Mime objects for the response content types for DeleteContainer
lazy_static! {
- pub static ref CREATE_CREATOR_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref DELETE_CONTAINER_DELETED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateCreatorBatch
+ /// Create Mime objects for the response content types for DeleteContainer
lazy_static! {
- pub static ref CREATE_CREATOR_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref DELETE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateCreatorBatch
+ /// Create Mime objects for the response content types for DeleteContainer
lazy_static! {
- pub static ref CREATE_CREATOR_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref DELETE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateEditgroup
+ /// Create Mime objects for the response content types for DeleteContainer
lazy_static! {
- pub static ref CREATE_EDITGROUP_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
+ pub static ref DELETE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateEditgroup
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref CREATE_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateEditgroup
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFile
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref CREATE_FILE_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFile
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref CREATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFile
+ /// Create Mime objects for the response content types for GetContainerHistory
lazy_static! {
- pub static ref CREATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFile
+ /// Create Mime objects for the response content types for GetContainerHistory
lazy_static! {
- pub static ref CREATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFileBatch
+ /// Create Mime objects for the response content types for GetContainerHistory
lazy_static! {
- pub static ref CREATE_FILE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFileBatch
+ /// Create Mime objects for the response content types for GetContainerHistory
lazy_static! {
- pub static ref CREATE_FILE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFileBatch
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref CREATE_FILE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateFileBatch
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref CREATE_FILE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateRelease
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref CREATE_RELEASE_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateRelease
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref CREATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateRelease
+ /// Create Mime objects for the response content types for UpdateContainer
lazy_static! {
- pub static ref CREATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CONTAINER_UPDATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateRelease
+ /// Create Mime objects for the response content types for UpdateContainer
lazy_static! {
- pub static ref CREATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateReleaseBatch
+ /// Create Mime objects for the response content types for UpdateContainer
lazy_static! {
- pub static ref CREATE_RELEASE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateReleaseBatch
+ /// Create Mime objects for the response content types for UpdateContainer
lazy_static! {
- pub static ref CREATE_RELEASE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateReleaseBatch
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CREATE_RELEASE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateReleaseBatch
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CREATE_RELEASE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWork
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CREATE_WORK_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWork
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CREATE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWork
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWork
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWorkBatch
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATE_WORK_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWorkBatch
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATE_WORK_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWorkBatch
+ /// Create Mime objects for the response content types for DeleteCreator
lazy_static! {
- pub static ref CREATE_WORK_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref DELETE_CREATOR_DELETED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreateWorkBatch
+ /// Create Mime objects for the response content types for DeleteCreator
lazy_static! {
- pub static ref CREATE_WORK_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref DELETE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteContainer
+ /// Create Mime objects for the response content types for DeleteCreator
lazy_static! {
- pub static ref DELETE_CONTAINER_DELETED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref DELETE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteContainer
+ /// Create Mime objects for the response content types for DeleteCreator
lazy_static! {
- pub static ref DELETE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref DELETE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteContainer
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref DELETE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteContainer
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref DELETE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteCreator
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref DELETE_CREATOR_DELETED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteCreator
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref DELETE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteCreator
+ /// Create Mime objects for the response content types for GetCreatorHistory
lazy_static! {
- pub static ref DELETE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteCreator
+ /// Create Mime objects for the response content types for GetCreatorHistory
lazy_static! {
- pub static ref DELETE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteFile
+ /// Create Mime objects for the response content types for GetCreatorHistory
lazy_static! {
- pub static ref DELETE_FILE_DELETED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteFile
+ /// Create Mime objects for the response content types for GetCreatorHistory
lazy_static! {
- pub static ref DELETE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteFile
+ /// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
- pub static ref DELETE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_RELEASES_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteFile
+ /// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
- pub static ref DELETE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteRelease
+ /// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
- pub static ref DELETE_RELEASE_DELETED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_RELEASES_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteRelease
+ /// Create Mime objects for the response content types for GetCreatorReleases
lazy_static! {
- pub static ref DELETE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CREATOR_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteRelease
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref DELETE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteRelease
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref DELETE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteWork
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref DELETE_WORK_DELETED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteWork
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref DELETE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteWork
+ /// Create Mime objects for the response content types for UpdateCreator
lazy_static! {
- pub static ref DELETE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CREATOR_UPDATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for DeleteWork
+ /// Create Mime objects for the response content types for UpdateCreator
lazy_static! {
- pub static ref DELETE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetChangelog
+ /// Create Mime objects for the response content types for UpdateCreator
lazy_static! {
- pub static ref GET_CHANGELOG_SUCCESS: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetChangelog
+ /// Create Mime objects for the response content types for UpdateCreator
lazy_static! {
- pub static ref GET_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetChangelogEntry
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref GET_CHANGELOG_ENTRY_FOUND_CHANGELOG_ENTRY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetChangelogEntry
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref GET_CHANGELOG_ENTRY_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetChangelogEntry
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref GET_CHANGELOG_ENTRY_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainer
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref GET_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainer
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref GET_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainer
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref GET_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainer
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref GET_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainerHistory
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref GET_CONTAINER_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainerHistory
+ /// Create Mime objects for the response content types for GetStats
lazy_static! {
- pub static ref GET_CONTAINER_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_STATS_SUCCESS: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainerHistory
+ /// Create Mime objects for the response content types for GetStats
lazy_static! {
- pub static ref GET_CONTAINER_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_STATS_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetContainerHistory
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref GET_CONTAINER_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreator
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref GET_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreator
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref GET_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreator
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref GET_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_EDIT_CONFLICT: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreator
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref GET_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorHistory
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref GET_CREATOR_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorHistory
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref GET_CREATOR_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorHistory
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref GET_CREATOR_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorHistory
+ /// Create Mime objects for the response content types for GetChangelog
lazy_static! {
- pub static ref GET_CREATOR_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CHANGELOG_SUCCESS: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorReleases
+ /// Create Mime objects for the response content types for GetChangelog
lazy_static! {
- pub static ref GET_CREATOR_RELEASES_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorReleases
+ /// Create Mime objects for the response content types for GetChangelogEntry
lazy_static! {
- pub static ref GET_CREATOR_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_CHANGELOG_ENTRY_FOUND_CHANGELOG_ENTRY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorReleases
+ /// Create Mime objects for the response content types for GetChangelogEntry
lazy_static! {
- pub static ref GET_CREATOR_RELEASES_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CHANGELOG_ENTRY_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetCreatorReleases
+ /// Create Mime objects for the response content types for GetChangelogEntry
lazy_static! {
- pub static ref GET_CREATOR_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_CHANGELOG_ENTRY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
@@ -392,37 +352,53 @@ pub mod responses {
lazy_static! {
pub static ref GET_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditor
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref GET_EDITOR_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditor
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref GET_EDITOR_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditor
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref GET_EDITOR_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditor
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref GET_EDITOR_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFile
+ lazy_static! {
+ pub static ref DELETE_FILE_DELETED_ENTITY: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFile
+ lazy_static! {
+ pub static ref DELETE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFile
+ lazy_static! {
+ pub static ref DELETE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for DeleteFile
+ lazy_static! {
+ pub static ref DELETE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for GetFile
lazy_static! {
@@ -456,157 +432,149 @@ 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 GetRelease
- lazy_static! {
- pub static ref GET_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for GetRelease
- lazy_static! {
- pub static ref GET_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the response content types for GetRelease
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref GET_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetRelease
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref GET_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseFiles
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref GET_RELEASE_FILES_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseFiles
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref GET_RELEASE_FILES_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseFiles
+ /// Create Mime objects for the response content types for UpdateFile
lazy_static! {
- pub static ref GET_RELEASE_FILES_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_FILE_UPDATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseFiles
+ /// Create Mime objects for the response content types for UpdateFile
lazy_static! {
- pub static ref GET_RELEASE_FILES_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseHistory
+ /// Create Mime objects for the response content types for UpdateFile
lazy_static! {
- pub static ref GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
+ pub static ref UPDATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseHistory
+ /// Create Mime objects for the response content types for UpdateFile
lazy_static! {
- pub static ref GET_RELEASE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref UPDATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseHistory
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref GET_RELEASE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetReleaseHistory
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref GET_RELEASE_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetStats
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref GET_STATS_SUCCESS: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetStats
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref GET_STATS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWork
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref GET_WORK_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWork
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref GET_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWork
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref GET_WORK_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWork
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref GET_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkHistory
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref GET_WORK_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkHistory
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref GET_WORK_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkHistory
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref GET_WORK_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkHistory
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref GET_WORK_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkReleases
+ /// Create Mime objects for the response content types for DeleteRelease
lazy_static! {
- pub static ref GET_WORK_RELEASES_FOUND: Mime = mime!(Application / Json);
+ pub static ref DELETE_RELEASE_DELETED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkReleases
+ /// Create Mime objects for the response content types for DeleteRelease
lazy_static! {
- pub static ref GET_WORK_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref DELETE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkReleases
+ /// Create Mime objects for the response content types for DeleteRelease
lazy_static! {
- pub static ref GET_WORK_RELEASES_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref DELETE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetWorkReleases
+ /// Create Mime objects for the response content types for DeleteRelease
lazy_static! {
- pub static ref GET_WORK_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref DELETE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupContainer
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref LOOKUP_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupContainer
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref LOOKUP_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupContainer
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref LOOKUP_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupContainer
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref LOOKUP_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupCreator
+ /// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
- pub static ref LOOKUP_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FILES_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupCreator
+ /// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
- pub static ref LOOKUP_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FILES_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupCreator
+ /// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
- pub static ref LOOKUP_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FILES_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupCreator
+ /// Create Mime objects for the response content types for GetReleaseFiles
lazy_static! {
- pub static ref LOOKUP_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_FILES_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupFile
+ /// Create Mime objects for the response content types for GetReleaseHistory
lazy_static! {
- pub static ref LOOKUP_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupFile
+ /// Create Mime objects for the response content types for GetReleaseHistory
lazy_static! {
- pub static ref LOOKUP_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupFile
+ /// Create Mime objects for the response content types for GetReleaseHistory
lazy_static! {
- pub static ref LOOKUP_FILE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for LookupFile
+ /// Create Mime objects for the response content types for GetReleaseHistory
lazy_static! {
- pub static ref LOOKUP_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_RELEASE_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for LookupRelease
lazy_static! {
@@ -624,69 +592,101 @@ pub mod responses {
lazy_static! {
pub static ref LOOKUP_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateContainer
+ /// Create Mime objects for the response content types for UpdateRelease
lazy_static! {
- pub static ref UPDATE_CONTAINER_UPDATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref UPDATE_RELEASE_UPDATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateContainer
+ /// Create Mime objects for the response content types for UpdateRelease
lazy_static! {
- pub static ref UPDATE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref UPDATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateContainer
+ /// Create Mime objects for the response content types for UpdateRelease
lazy_static! {
- pub static ref UPDATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateContainer
+ /// Create Mime objects for the response content types for UpdateRelease
lazy_static! {
- pub static ref UPDATE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateCreator
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref UPDATE_CREATOR_UPDATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateCreator
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref UPDATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateCreator
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref UPDATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateCreator
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref UPDATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateFile
+ /// Create Mime objects for the response content types for DeleteWork
lazy_static! {
- pub static ref UPDATE_FILE_UPDATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref DELETE_WORK_DELETED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateFile
+ /// Create Mime objects for the response content types for DeleteWork
lazy_static! {
- pub static ref UPDATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref DELETE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateFile
+ /// Create Mime objects for the response content types for DeleteWork
lazy_static! {
- pub static ref UPDATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref DELETE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateFile
+ /// Create Mime objects for the response content types for DeleteWork
lazy_static! {
- pub static ref UPDATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref DELETE_WORK_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateRelease
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref UPDATE_RELEASE_UPDATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateRelease
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref UPDATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateRelease
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref UPDATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for UpdateRelease
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref UPDATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_WORK_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);
+ }
+ /// Create Mime objects for the response content types for GetWorkHistory
+ lazy_static! {
+ pub static ref GET_WORK_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkHistory
+ lazy_static! {
+ pub static ref GET_WORK_HISTORY_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkHistory
+ lazy_static! {
+ pub static ref GET_WORK_HISTORY_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);
+ }
+ /// Create Mime objects for the response content types for GetWorkReleases
+ lazy_static! {
+ pub static ref GET_WORK_RELEASES_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkReleases
+ lazy_static! {
+ pub static ref GET_WORK_RELEASES_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetWorkReleases
+ lazy_static! {
+ pub static ref GET_WORK_RELEASES_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for UpdateWork
lazy_static! {
@@ -717,6 +717,10 @@ pub mod requests {
lazy_static! {
pub static ref CREATE_CONTAINER_BATCH: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for UpdateContainer
+ lazy_static! {
+ pub static ref UPDATE_CONTAINER: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for CreateCreator
lazy_static! {
pub static ref CREATE_CREATOR: Mime = mime!(Application / Json);
@@ -725,6 +729,10 @@ pub mod requests {
lazy_static! {
pub static ref CREATE_CREATOR_BATCH: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for UpdateCreator
+ lazy_static! {
+ pub static ref UPDATE_CREATOR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for CreateEditgroup
lazy_static! {
pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json);
@@ -737,6 +745,10 @@ pub mod requests {
lazy_static! {
pub static ref CREATE_FILE_BATCH: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for UpdateFile
+ lazy_static! {
+ pub static ref UPDATE_FILE: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for CreateRelease
lazy_static! {
pub static ref CREATE_RELEASE: Mime = mime!(Application / Json);
@@ -749,26 +761,14 @@ pub mod requests {
lazy_static! {
pub static ref CREATE_WORK: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for CreateWorkBatch
- lazy_static! {
- pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the request content types for UpdateContainer
- lazy_static! {
- pub static ref UPDATE_CONTAINER: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the request content types for UpdateCreator
- lazy_static! {
- pub static ref UPDATE_CREATOR: Mime = mime!(Application / Json);
- }
- /// Create Mime objects for the request content types for UpdateFile
- lazy_static! {
- pub static ref UPDATE_FILE: Mime = mime!(Application / Json);
- }
/// Create Mime objects for the request content types for UpdateRelease
lazy_static! {
pub static ref UPDATE_RELEASE: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for CreateWorkBatch
+ lazy_static! {
+ pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for UpdateWork
lazy_static! {
pub static ref UPDATE_WORK: Mime = mime!(Application / Json);
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index 980d3059..ed37b58a 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -683,9 +683,9 @@ pub struct ReleaseRef {
#[serde(skip_serializing_if = "Option::is_none")]
pub year: Option<i64>,
- #[serde(rename = "container_title")]
+ #[serde(rename = "container_name")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub container_title: Option<String>,
+ pub container_name: Option<String>,
#[serde(rename = "title")]
#[serde(skip_serializing_if = "Option::is_none")]
@@ -704,7 +704,7 @@ impl ReleaseRef {
extra: None,
key: None,
year: None,
- container_title: None,
+ container_name: None,
title: None,
locator: None,
}
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs
index 8c699065..db8dcd7c 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -92,105 +92,6 @@ where
{
let api_clone = api.clone();
router.post(
- "/v0/editgroup/:id/accept",
- 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.accept_editgroup(param_id, context).wait() {
- Ok(rsp) => match rsp {
- AcceptEditgroupResponse::MergedSuccessfully(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::ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- AcceptEditgroupResponse::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::ACCEPT_EDITGROUP_BAD_REQUEST.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- AcceptEditgroupResponse::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::ACCEPT_EDITGROUP_NOT_FOUND.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- AcceptEditgroupResponse::EditConflict(body) => {
- let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
-
- let mut response = Response::with((status::Status::from_u16(409), body_string));
- response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_EDIT_CONFLICT.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- AcceptEditgroupResponse::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::ACCEPT_EDITGROUP_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)
- })
- },
- "AcceptEditgroup",
- );
-
- let api_clone = api.clone();
- router.post(
"/v0/container",
move |req: &mut Request| {
let mut context = Context::default();
@@ -221,11 +122,10 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity: Option<models::ContainerEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::ContainerEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
param_entity
} else {
@@ -333,11 +233,10 @@ where
let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
- let param_entity_list: Option<Vec<models::ContainerEntity>> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
+ let param_entity_list: Option<Vec<models::ContainerEntity>> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
param_entity_list
} else {
@@ -413,8 +312,8 @@ where
);
let api_clone = api.clone();
- router.post(
- "/v0/creator",
+ router.delete(
+ "/v0/container/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -427,83 +326,65 @@ where
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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- let param_entity: Option<models::CreatorEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
-
- param_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
-
- match api.create_creator(param_entity, param_editgroup, context).wait() {
+ match api.delete_container(param_id, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- CreateCreatorResponse::CreatedEntity(body) => {
+ DeleteContainerResponse::DeletedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_DELETED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorResponse::BadRequest(body) => {
+ DeleteContainerResponse::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::CREATE_CREATOR_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorResponse::NotFound(body) => {
+ DeleteContainerResponse::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::CREATE_CREATOR_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorResponse::GenericError(body) => {
+ DeleteContainerResponse::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::CREATE_CREATOR_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -520,12 +401,12 @@ where
Ok(response)
})
},
- "CreateCreator",
+ "DeleteContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/creator/batch",
+ router.get(
+ "/v0/container/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -538,84 +419,65 @@ where
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_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
- let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity_list = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<models::CreatorEntity>> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
- };
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.create_creator_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
+ match api.get_container(param_id, param_expand, context).wait() {
Ok(rsp) => match rsp {
- CreateCreatorBatchResponse::CreatedEntities(body) => {
+ GetContainerResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorBatchResponse::BadRequest(body) => {
+ GetContainerResponse::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::CREATE_CREATOR_BATCH_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorBatchResponse::NotFound(body) => {
+ GetContainerResponse::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::CREATE_CREATOR_BATCH_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateCreatorBatchResponse::GenericError(body) => {
+ GetContainerResponse::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::CREATE_CREATOR_BATCH_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -632,12 +494,12 @@ where
Ok(response)
})
},
- "CreateCreatorBatch",
+ "GetContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/editgroup",
+ router.get(
+ "/v0/container/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -650,66 +512,65 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+ // 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))))?
+ };
- let mut unused_elements = Vec::new();
+ // 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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+ match api.get_container_history(param_id, param_limit, context).wait() {
+ Ok(rsp) => match rsp {
+ GetContainerHistoryResponse::FoundEntityHistory(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let param_entity: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_FOUND_ENTITY_HISTORY.clone()));
- param_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- match api.create_editgroup(param_entity, context).wait() {
- Ok(rsp) => match rsp {
- CreateEditgroupResponse::SuccessfullyCreated(body) => {
+ Ok(response)
+ }
+ GetContainerHistoryResponse::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(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_SUCCESSFULLY_CREATED.clone()));
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateEditgroupResponse::BadRequest(body) => {
+ GetContainerHistoryResponse::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(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_BAD_REQUEST.clone()));
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateEditgroupResponse::GenericError(body) => {
+ GetContainerHistoryResponse::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::CREATE_EDITGROUP_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -726,12 +587,12 @@ where
Ok(response)
})
},
- "CreateEditgroup",
+ "GetContainerHistory",
);
let api_clone = api.clone();
- router.post(
- "/v0/file",
+ router.get(
+ "/v0/container/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -746,81 +607,54 @@ 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- let param_entity: Option<models::FileEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
-
- param_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ 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))))?;
- match api.create_file(param_entity, param_editgroup, context).wait() {
+ match api.lookup_container(param_issnl, context).wait() {
Ok(rsp) => match rsp {
- CreateFileResponse::CreatedEntity(body) => {
+ LookupContainerResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateFileResponse::BadRequest(body) => {
+ LookupContainerResponse::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::CREATE_FILE_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateFileResponse::NotFound(body) => {
+ LookupContainerResponse::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::CREATE_FILE_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateFileResponse::GenericError(body) => {
+ LookupContainerResponse::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::CREATE_FILE_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -837,12 +671,12 @@ where
Ok(response)
})
},
- "CreateFile",
+ "LookupContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/file/batch",
+ router.put(
+ "/v0/container/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -855,43 +689,56 @@ where
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_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_entity_list = req
+ let param_entity = req
.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity_list: Option<Vec<models::FileEntity>> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::ContainerEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_entity_list
+ param_entity
} else {
None
};
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_file_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
+ match api.update_container(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- CreateFileBatchResponse::CreatedEntities(body) => {
+ UpdateContainerResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CONTAINER_UPDATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -899,11 +746,11 @@ where
}
Ok(response)
}
- CreateFileBatchResponse::BadRequest(body) => {
+ UpdateContainerResponse::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::CREATE_FILE_BATCH_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CONTAINER_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -911,11 +758,11 @@ where
}
Ok(response)
}
- CreateFileBatchResponse::NotFound(body) => {
+ UpdateContainerResponse::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::CREATE_FILE_BATCH_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CONTAINER_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -923,11 +770,11 @@ where
}
Ok(response)
}
- CreateFileBatchResponse::GenericError(body) => {
+ UpdateContainerResponse::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::CREATE_FILE_BATCH_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CONTAINER_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -949,12 +796,12 @@ where
Ok(response)
})
},
- "CreateFileBatch",
+ "UpdateContainer",
);
let api_clone = api.clone();
router.post(
- "/v0/release",
+ "/v0/creator",
move |req: &mut Request| {
let mut context = Context::default();
@@ -984,11 +831,10 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity: Option<models::ReleaseEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
param_entity
} else {
@@ -996,13 +842,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_release(param_entity, param_editgroup, context).wait() {
+ match api.create_creator(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- CreateReleaseResponse::CreatedEntity(body) => {
+ CreateCreatorResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_CREATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1010,11 +856,11 @@ where
}
Ok(response)
}
- CreateReleaseResponse::BadRequest(body) => {
+ CreateCreatorResponse::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::CREATE_RELEASE_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1022,11 +868,11 @@ where
}
Ok(response)
}
- CreateReleaseResponse::NotFound(body) => {
+ CreateCreatorResponse::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::CREATE_RELEASE_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1034,11 +880,11 @@ where
}
Ok(response)
}
- CreateReleaseResponse::GenericError(body) => {
+ CreateCreatorResponse::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::CREATE_RELEASE_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1060,12 +906,12 @@ where
Ok(response)
})
},
- "CreateRelease",
+ "CreateCreator",
);
let api_clone = api.clone();
router.post(
- "/v0/release/batch",
+ "/v0/creator/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1096,11 +942,10 @@ where
let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
- let param_entity_list: Option<Vec<models::ReleaseEntity>> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
+ let param_entity_list: Option<Vec<models::CreatorEntity>> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
param_entity_list
} else {
@@ -1108,13 +953,13 @@ where
};
let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.create_release_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
+ match api.create_creator_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- CreateReleaseBatchResponse::CreatedEntities(body) => {
+ CreateCreatorBatchResponse::CreatedEntities(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1122,11 +967,11 @@ where
}
Ok(response)
}
- CreateReleaseBatchResponse::BadRequest(body) => {
+ CreateCreatorBatchResponse::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::CREATE_RELEASE_BATCH_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1134,11 +979,11 @@ where
}
Ok(response)
}
- CreateReleaseBatchResponse::NotFound(body) => {
+ CreateCreatorBatchResponse::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::CREATE_RELEASE_BATCH_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1146,11 +991,11 @@ where
}
Ok(response)
}
- CreateReleaseBatchResponse::GenericError(body) => {
+ CreateCreatorBatchResponse::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::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CREATOR_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -1172,12 +1017,12 @@ where
Ok(response)
})
},
- "CreateReleaseBatch",
+ "CreateCreatorBatch",
);
let api_clone = api.clone();
- router.post(
- "/v0/work",
+ router.delete(
+ "/v0/creator/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1190,83 +1035,65 @@ where
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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
-
- let param_entity: Option<models::WorkEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
-
- param_entity
- } else {
- None
- };
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
-
- match api.create_work(param_entity, param_editgroup, context).wait() {
+ match api.delete_creator(param_id, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- CreateWorkResponse::CreatedEntity(body) => {
+ DeleteCreatorResponse::DeletedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_DELETED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkResponse::BadRequest(body) => {
+ DeleteCreatorResponse::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::CREATE_WORK_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkResponse::NotFound(body) => {
+ DeleteCreatorResponse::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::CREATE_WORK_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkResponse::GenericError(body) => {
+ DeleteCreatorResponse::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::CREATE_WORK_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1283,12 +1110,12 @@ where
Ok(response)
})
},
- "CreateWork",
+ "DeleteCreator",
);
let api_clone = api.clone();
- router.post(
- "/v0/work/batch",
+ router.get(
+ "/v0/creator/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1301,84 +1128,65 @@ where
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_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
- let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
-
- let param_entity_list = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
-
- let mut unused_elements = Vec::new();
-
- let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
-
- let param_entity_list: Option<Vec<models::WorkEntity>> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
-
- param_entity_list
- } else {
- None
- };
- let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.create_work_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
+ match api.get_creator(param_id, param_expand, context).wait() {
Ok(rsp) => match rsp {
- CreateWorkBatchResponse::CreatedEntities(body) => {
+ GetCreatorResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let mut response = Response::with((status::Status::from_u16(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkBatchResponse::BadRequest(body) => {
+ GetCreatorResponse::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::CREATE_WORK_BATCH_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkBatchResponse::NotFound(body) => {
+ GetCreatorResponse::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::CREATE_WORK_BATCH_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- CreateWorkBatchResponse::GenericError(body) => {
+ GetCreatorResponse::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::CREATE_WORK_BATCH_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1395,12 +1203,12 @@ where
Ok(response)
})
},
- "CreateWorkBatch",
+ "GetCreator",
);
let api_clone = api.clone();
- router.delete(
- "/v0/container/:id",
+ router.get(
+ "/v0/creator/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1430,45 +1238,45 @@ 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
- match api.delete_container(param_id, param_editgroup, context).wait() {
+ match api.get_creator_history(param_id, param_limit, context).wait() {
Ok(rsp) => match rsp {
- DeleteContainerResponse::DeletedEntity(body) => {
+ GetCreatorHistoryResponse::FoundEntityHistory(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_DELETED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_HISTORY_FOUND_ENTITY_HISTORY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteContainerResponse::BadRequest(body) => {
+ GetCreatorHistoryResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_HISTORY_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteContainerResponse::NotFound(body) => {
+ GetCreatorHistoryResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_HISTORY_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteContainerResponse::GenericError(body) => {
+ GetCreatorHistoryResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_HISTORY_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1488,12 +1296,12 @@ where
Ok(response)
})
},
- "DeleteContainer",
+ "GetCreatorHistory",
);
let api_clone = api.clone();
- router.delete(
- "/v0/creator/:id",
+ router.get(
+ "/v0/creator/:id/releases",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1521,47 +1329,43 @@ where
.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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- match api.delete_creator(param_id, param_editgroup, context).wait() {
+ match api.get_creator_releases(param_id, context).wait() {
Ok(rsp) => match rsp {
- DeleteCreatorResponse::DeletedEntity(body) => {
+ GetCreatorReleasesResponse::Found(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_DELETED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteCreatorResponse::BadRequest(body) => {
+ GetCreatorReleasesResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteCreatorResponse::NotFound(body) => {
+ GetCreatorReleasesResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteCreatorResponse::GenericError(body) => {
+ GetCreatorReleasesResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CREATOR_RELEASES_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1581,12 +1385,12 @@ where
Ok(response)
})
},
- "DeleteCreator",
+ "GetCreatorReleases",
);
let api_clone = api.clone();
- router.delete(
- "/v0/file/:id",
+ router.get(
+ "/v0/creator/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1599,62 +1403,53 @@ where
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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ 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))))?;
- match api.delete_file(param_id, param_editgroup, context).wait() {
+ match api.lookup_creator(param_orcid, context).wait() {
Ok(rsp) => match rsp {
- DeleteFileResponse::DeletedEntity(body) => {
+ LookupCreatorResponse::FoundEntity(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_DELETED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteFileResponse::BadRequest(body) => {
+ LookupCreatorResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteFileResponse::NotFound(body) => {
+ LookupCreatorResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteFileResponse::GenericError(body) => {
+ LookupCreatorResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1674,12 +1469,12 @@ where
Ok(response)
})
},
- "DeleteFile",
+ "LookupCreator",
);
let api_clone = api.clone();
- router.delete(
- "/v0/release/:id",
+ router.put(
+ "/v0/creator/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1711,46 +1506,78 @@ where
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.delete_release(param_id, param_editgroup, context).wait() {
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ let param_entity: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+
+ match api.update_creator(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- DeleteReleaseResponse::DeletedEntity(body) => {
+ UpdateCreatorResponse::UpdatedEntity(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_DELETED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CREATOR_UPDATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- DeleteReleaseResponse::BadRequest(body) => {
+ UpdateCreatorResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CREATOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- DeleteReleaseResponse::NotFound(body) => {
+ UpdateCreatorResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CREATOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- DeleteReleaseResponse::GenericError(body) => {
+ UpdateCreatorResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_CREATOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -1767,12 +1594,12 @@ where
Ok(response)
})
},
- "DeleteRelease",
+ "UpdateCreator",
);
let api_clone = api.clone();
- router.delete(
- "/v0/work/:id",
+ router.get(
+ "/v0/editor/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1800,47 +1627,43 @@ where
.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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- match api.delete_work(param_id, param_editgroup, context).wait() {
+ match api.get_editor(param_id, context).wait() {
Ok(rsp) => match rsp {
- DeleteWorkResponse::DeletedEntity(body) => {
+ GetEditorResponse::Found(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_DELETED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteWorkResponse::BadRequest(body) => {
+ GetEditorResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteWorkResponse::NotFound(body) => {
+ GetEditorResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- DeleteWorkResponse::GenericError(body) => {
+ GetEditorResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1860,12 +1683,12 @@ where
Ok(response)
})
},
- "DeleteWork",
+ "GetEditor",
);
let api_clone = api.clone();
router.get(
- "/v0/changelog",
+ "/v0/editor/:id/changelog",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1878,27 +1701,58 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ // 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_changelog(param_limit, context).wait() {
+ match api.get_editor_changelog(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetChangelogResponse::Success(body) => {
+ GetEditorChangelogResponse::Found(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_CHANGELOG_SUCCESS.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetChangelogResponse::GenericError(body) => {
+ GetEditorChangelogResponse::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_EDITOR_CHANGELOG_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorChangelogResponse::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_EDITOR_CHANGELOG_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorChangelogResponse::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_CHANGELOG_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1918,12 +1772,12 @@ where
Ok(response)
})
},
- "GetChangelog",
+ "GetEditorChangelog",
);
let api_clone = api.clone();
router.get(
- "/v0/changelog/:id",
+ "/v0/stats",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1936,48 +1790,27 @@ where
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_more = query_params.get("more").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.get_changelog_entry(param_id, context).wait() {
+ match api.get_stats(param_more, context).wait() {
Ok(rsp) => match rsp {
- GetChangelogEntryResponse::FoundChangelogEntry(body) => {
+ GetStatsResponse::Success(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_CHANGELOG_ENTRY_FOUND_CHANGELOG_ENTRY.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- GetChangelogEntryResponse::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_CHANGELOG_ENTRY_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_STATS_SUCCESS.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetChangelogEntryResponse::GenericError(body) => {
+ GetStatsResponse::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_CHANGELOG_ENTRY_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_STATS_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -1997,12 +1830,12 @@ where
Ok(response)
})
},
- "GetChangelogEntry",
+ "GetStats",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/:id",
+ router.post(
+ "/v0/editgroup/:id/accept",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2030,47 +1863,53 @@ where
.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());
-
- match api.get_container(param_id, param_expand, context).wait() {
+ match api.accept_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetContainerResponse::FoundEntity(body) => {
+ AcceptEditgroupResponse::MergedSuccessfully(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_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetContainerResponse::BadRequest(body) => {
+ AcceptEditgroupResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetContainerResponse::NotFound(body) => {
+ AcceptEditgroupResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetContainerResponse::GenericError(body) => {
+ AcceptEditgroupResponse::EditConflict(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(409), body_string));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_EDIT_CONFLICT.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ AcceptEditgroupResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2090,12 +1929,12 @@ where
Ok(response)
})
},
- "GetContainer",
+ "AcceptEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/:id/history",
+ router.post(
+ "/v0/editgroup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2108,65 +1947,66 @@ where
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))))?
- };
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
- // 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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_editgroup = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - not valid UTF-8: {}", e))))?;
- match api.get_container_history(param_id, param_limit, context).wait() {
- Ok(rsp) => match rsp {
- GetContainerHistoryResponse::FoundEntityHistory(body) => {
- let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+ let mut unused_elements = Vec::new();
- let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_FOUND_ENTITY_HISTORY.clone()));
+ let param_editgroup = if let Some(param_editgroup_raw) = param_editgroup {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_editgroup_raw);
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ let param_editgroup: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - doesn't match schema: {}", e))))?;
- Ok(response)
- }
- GetContainerHistoryResponse::BadRequest(body) => {
+ param_editgroup
+ } else {
+ None
+ };
+ let param_editgroup = param_editgroup.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter editgroup".to_string())))?;
+
+ match api.create_editgroup(param_editgroup, context).wait() {
+ Ok(rsp) => match rsp {
+ CreateEditgroupResponse::SuccessfullyCreated(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_HISTORY_BAD_REQUEST.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_SUCCESSFULLY_CREATED.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetContainerHistoryResponse::NotFound(body) => {
+ CreateEditgroupResponse::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(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::GET_CONTAINER_HISTORY_NOT_FOUND.clone()));
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetContainerHistoryResponse::GenericError(body) => {
+ CreateEditgroupResponse::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_HISTORY_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -2183,12 +2023,12 @@ where
Ok(response)
})
},
- "GetContainerHistory",
+ "CreateEditgroup",
);
let api_clone = api.clone();
router.get(
- "/v0/creator/:id",
+ "/v0/changelog",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2201,62 +2041,27 @@ where
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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
- match api.get_creator(param_id, param_expand, context).wait() {
+ match api.get_changelog(param_limit, context).wait() {
Ok(rsp) => match rsp {
- GetCreatorResponse::FoundEntity(body) => {
+ GetChangelogResponse::Success(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_FOUND_ENTITY.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- GetCreatorResponse::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_BAD_REQUEST.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- GetCreatorResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CHANGELOG_SUCCESS.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorResponse::GenericError(body) => {
+ GetChangelogResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CHANGELOG_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2276,12 +2081,12 @@ where
Ok(response)
})
},
- "GetCreator",
+ "GetChangelog",
);
let api_clone = api.clone();
router.get(
- "/v0/creator/:id/history",
+ "/v0/changelog/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2309,47 +2114,33 @@ where
.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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
-
- match api.get_creator_history(param_id, param_limit, context).wait() {
+ match api.get_changelog_entry(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetCreatorHistoryResponse::FoundEntityHistory(body) => {
+ GetChangelogEntryResponse::FoundChangelogEntry(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_HISTORY_FOUND_ENTITY_HISTORY.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- GetCreatorHistoryResponse::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_HISTORY_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CHANGELOG_ENTRY_FOUND_CHANGELOG_ENTRY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorHistoryResponse::NotFound(body) => {
+ GetChangelogEntryResponse::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_HISTORY_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CHANGELOG_ENTRY_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorHistoryResponse::GenericError(body) => {
+ GetChangelogEntryResponse::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_HISTORY_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_CHANGELOG_ENTRY_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2369,12 +2160,12 @@ where
Ok(response)
})
},
- "GetCreatorHistory",
+ "GetChangelogEntry",
);
let api_clone = api.clone();
router.get(
- "/v0/creator/:id/releases",
+ "/v0/editgroup/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2402,43 +2193,43 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.get_creator_releases(param_id, context).wait() {
+ match api.get_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- GetCreatorReleasesResponse::Found(body) => {
+ GetEditgroupResponse::Found(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_RELEASES_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorReleasesResponse::BadRequest(body) => {
+ GetEditgroupResponse::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_RELEASES_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorReleasesResponse::NotFound(body) => {
+ GetEditgroupResponse::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_RELEASES_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetCreatorReleasesResponse::GenericError(body) => {
+ GetEditgroupResponse::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_RELEASES_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2458,12 +2249,12 @@ where
Ok(response)
})
},
- "GetCreatorReleases",
+ "GetEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/editgroup/:id",
+ router.post(
+ "/v0/file",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2476,61 +2267,82 @@ where
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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ let param_entity: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
};
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.get_editgroup(param_id, context).wait() {
+ match api.create_file(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetEditgroupResponse::Found(body) => {
+ CreateFileResponse::CreatedEntity(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_EDITGROUP_FOUND.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditgroupResponse::BadRequest(body) => {
+ CreateFileResponse::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_EDITGROUP_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditgroupResponse::NotFound(body) => {
+ CreateFileResponse::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_EDITGROUP_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditgroupResponse::GenericError(body) => {
+ CreateFileResponse::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_EDITGROUP_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -2547,12 +2359,12 @@ where
Ok(response)
})
},
- "GetEditgroup",
+ "CreateFile",
);
let api_clone = api.clone();
- router.get(
- "/v0/editor/:id",
+ router.post(
+ "/v0/file/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2565,61 +2377,83 @@ where
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_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity_list = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
+
+ let param_entity_list: Option<Vec<models::FileEntity>> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
+
+ param_entity_list
+ } else {
+ None
};
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.get_editor(param_id, context).wait() {
+ match api.create_file_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetEditorResponse::Found(body) => {
+ CreateFileBatchResponse::CreatedEntities(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_EDITOR_FOUND.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditorResponse::BadRequest(body) => {
+ CreateFileBatchResponse::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_EDITOR_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditorResponse::NotFound(body) => {
+ CreateFileBatchResponse::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_EDITOR_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetEditorResponse::GenericError(body) => {
+ CreateFileBatchResponse::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_EDITOR_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_FILE_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -2636,12 +2470,12 @@ where
Ok(response)
})
},
- "GetEditor",
+ "CreateFileBatch",
);
let api_clone = api.clone();
- router.get(
- "/v0/editor/:id/changelog",
+ router.delete(
+ "/v0/file/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2669,43 +2503,47 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.get_editor_changelog(param_id, context).wait() {
+ // 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.delete_file(param_id, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetEditorChangelogResponse::Found(body) => {
+ DeleteFileResponse::DeletedEntity(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_EDITOR_CHANGELOG_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_DELETED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::BadRequest(body) => {
+ DeleteFileResponse::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_EDITOR_CHANGELOG_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::NotFound(body) => {
+ DeleteFileResponse::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_EDITOR_CHANGELOG_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::GenericError(body) => {
+ DeleteFileResponse::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_EDITOR_CHANGELOG_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -2725,7 +2563,7 @@ where
Ok(response)
})
},
- "GetEditorChangelog",
+ "DeleteFile",
);
let api_clone = api.clone();
@@ -2916,7 +2754,7 @@ where
let api_clone = api.clone();
router.get(
- "/v0/release/:id",
+ "/v0/file/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2929,62 +2767,53 @@ where
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_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))))?;
- match api.get_release(param_id, param_expand, context).wait() {
+ match api.lookup_file(param_sha1, context).wait() {
Ok(rsp) => match rsp {
- GetReleaseResponse::FoundEntity(body) => {
+ LookupFileResponse::FoundEntity(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_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetReleaseResponse::BadRequest(body) => {
+ LookupFileResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetReleaseResponse::NotFound(body) => {
+ LookupFileResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetReleaseResponse::GenericError(body) => {
+ LookupFileResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3004,12 +2833,12 @@ where
Ok(response)
})
},
- "GetRelease",
+ "LookupFile",
);
let api_clone = api.clone();
- router.get(
- "/v0/release/:id/files",
+ router.put(
+ "/v0/file/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3037,46 +2866,82 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.get_release_files(param_id, context).wait() {
+ // 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ let param_entity: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+
+ match api.update_file(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetReleaseFilesResponse::Found(body) => {
+ UpdateFileResponse::UpdatedEntity(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_FILES_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_FILE_UPDATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseFilesResponse::BadRequest(body) => {
+ UpdateFileResponse::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_FILES_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_FILE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseFilesResponse::NotFound(body) => {
+ UpdateFileResponse::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_FILES_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_FILE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseFilesResponse::GenericError(body) => {
+ UpdateFileResponse::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_FILES_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_FILE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -3093,12 +2958,12 @@ where
Ok(response)
})
},
- "GetReleaseFiles",
+ "UpdateFile",
);
let api_clone = api.clone();
- router.get(
- "/v0/release/:id/history",
+ router.post(
+ "/v0/release",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3111,65 +2976,82 @@ where
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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.get_release_history(param_id, param_limit, context).wait() {
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ let param_entity: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+
+ match api.create_release(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetReleaseHistoryResponse::FoundEntityHistory(body) => {
+ CreateReleaseResponse::CreatedEntity(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_HISTORY_FOUND_ENTITY_HISTORY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseHistoryResponse::BadRequest(body) => {
+ CreateReleaseResponse::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_HISTORY_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseHistoryResponse::NotFound(body) => {
+ CreateReleaseResponse::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_HISTORY_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetReleaseHistoryResponse::GenericError(body) => {
+ CreateReleaseResponse::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_HISTORY_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -3186,12 +3068,12 @@ where
Ok(response)
})
},
- "GetReleaseHistory",
+ "CreateRelease",
);
let api_clone = api.clone();
- router.get(
- "/v0/stats",
+ router.post(
+ "/v0/release/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3206,121 +3088,81 @@ 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_more = query_params.get("more").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
-
- match api.get_stats(param_more, context).wait() {
- Ok(rsp) => match rsp {
- GetStatsResponse::Success(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_STATS_SUCCESS.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- GetStatsResponse::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_STATS_GENERIC_ERROR.clone()));
+ let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
- 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())))
- }
- }
- }
+ let param_entity_list = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
- 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)
- })
- },
- "GetStats",
- );
+ let mut unused_elements = Vec::new();
- let api_clone = api.clone();
- router.get(
- "/v0/work/:id",
- move |req: &mut Request| {
- let mut context = Context::default();
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
- // 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>();
+ let param_entity_list: Option<Vec<models::ReleaseEntity>> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
- // 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))))?
+ param_entity_list
+ } else {
+ None
};
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- // 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());
-
- match api.get_work(param_id, param_expand, context).wait() {
+ match api.create_release_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetWorkResponse::FoundEntity(body) => {
+ CreateReleaseBatchResponse::CreatedEntities(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_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkResponse::BadRequest(body) => {
+ CreateReleaseBatchResponse::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_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkResponse::NotFound(body) => {
+ CreateReleaseBatchResponse::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_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkResponse::GenericError(body) => {
+ CreateReleaseBatchResponse::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_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -3337,12 +3179,12 @@ where
Ok(response)
})
},
- "GetWork",
+ "CreateReleaseBatch",
);
let api_clone = api.clone();
- router.get(
- "/v0/work/:id/history",
+ router.post(
+ "/v0/work",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3355,65 +3197,82 @@ where
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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.get_work_history(param_id, param_limit, context).wait() {
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_entity = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+
+ let param_entity: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+
+ param_entity
+ } else {
+ None
+ };
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+
+ match api.create_work(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetWorkHistoryResponse::FoundEntityHistory(body) => {
+ CreateWorkResponse::CreatedEntity(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_HISTORY_FOUND_ENTITY_HISTORY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_CREATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkHistoryResponse::BadRequest(body) => {
+ CreateWorkResponse::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_HISTORY_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkHistoryResponse::NotFound(body) => {
+ CreateWorkResponse::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_HISTORY_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- GetWorkHistoryResponse::GenericError(body) => {
+ CreateWorkResponse::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_HISTORY_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -3430,12 +3289,12 @@ where
Ok(response)
})
},
- "GetWorkHistory",
+ "CreateWork",
);
let api_clone = api.clone();
- router.get(
- "/v0/work/:id/releases",
+ router.delete(
+ "/v0/release/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3463,43 +3322,47 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.get_work_releases(param_id, context).wait() {
+ // 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.delete_release(param_id, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- GetWorkReleasesResponse::Found(body) => {
+ DeleteReleaseResponse::DeletedEntity(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_RELEASES_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_DELETED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetWorkReleasesResponse::BadRequest(body) => {
+ DeleteReleaseResponse::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_RELEASES_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetWorkReleasesResponse::NotFound(body) => {
+ DeleteReleaseResponse::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_RELEASES_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetWorkReleasesResponse::GenericError(body) => {
+ DeleteReleaseResponse::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_RELEASES_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3519,12 +3382,12 @@ where
Ok(response)
})
},
- "GetWorkReleases",
+ "DeleteRelease",
);
let api_clone = api.clone();
router.get(
- "/v0/container/lookup",
+ "/v0/release/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3537,53 +3400,62 @@ where
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_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_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- match api.lookup_container(param_issnl, context).wait() {
+ match api.get_release(param_id, param_expand, context).wait() {
Ok(rsp) => match rsp {
- LookupContainerResponse::FoundEntity(body) => {
+ GetReleaseResponse::FoundEntity(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::LOOKUP_CONTAINER_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupContainerResponse::BadRequest(body) => {
+ GetReleaseResponse::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::LOOKUP_CONTAINER_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupContainerResponse::NotFound(body) => {
+ GetReleaseResponse::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::LOOKUP_CONTAINER_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupContainerResponse::GenericError(body) => {
+ GetReleaseResponse::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::LOOKUP_CONTAINER_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3603,12 +3475,12 @@ where
Ok(response)
})
},
- "LookupContainer",
+ "GetRelease",
);
let api_clone = api.clone();
router.get(
- "/v0/creator/lookup",
+ "/v0/release/:id/files",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3621,53 +3493,58 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // 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))))?;
+ // 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.lookup_creator(param_orcid, context).wait() {
+ match api.get_release_files(param_id, context).wait() {
Ok(rsp) => match rsp {
- LookupCreatorResponse::FoundEntity(body) => {
+ GetReleaseFilesResponse::Found(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::LOOKUP_CREATOR_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupCreatorResponse::BadRequest(body) => {
+ GetReleaseFilesResponse::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::LOOKUP_CREATOR_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupCreatorResponse::NotFound(body) => {
+ GetReleaseFilesResponse::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::LOOKUP_CREATOR_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupCreatorResponse::GenericError(body) => {
+ GetReleaseFilesResponse::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::LOOKUP_CREATOR_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3687,12 +3564,12 @@ where
Ok(response)
})
},
- "LookupCreator",
+ "GetReleaseFiles",
);
let api_clone = api.clone();
router.get(
- "/v0/file/lookup",
+ "/v0/release/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3705,53 +3582,62 @@ where
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_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_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
- match api.lookup_file(param_sha1, context).wait() {
+ match api.get_release_history(param_id, param_limit, context).wait() {
Ok(rsp) => match rsp {
- LookupFileResponse::FoundEntity(body) => {
+ GetReleaseHistoryResponse::FoundEntityHistory(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::LOOKUP_FILE_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupFileResponse::BadRequest(body) => {
+ GetReleaseHistoryResponse::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::LOOKUP_FILE_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupFileResponse::NotFound(body) => {
+ GetReleaseHistoryResponse::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::LOOKUP_FILE_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- LookupFileResponse::GenericError(body) => {
+ GetReleaseHistoryResponse::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::LOOKUP_FILE_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
@@ -3771,7 +3657,7 @@ where
Ok(response)
})
},
- "LookupFile",
+ "GetReleaseHistory",
);
let api_clone = api.clone();
@@ -3860,7 +3746,7 @@ where
let api_clone = api.clone();
router.put(
- "/v0/container/:id",
+ "/v0/release/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3905,11 +3791,10 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity: Option<models::ContainerEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
param_entity
} else {
@@ -3917,13 +3802,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_container(param_id, param_entity, param_editgroup, context).wait() {
+ match api.update_release(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- UpdateContainerResponse::UpdatedEntity(body) => {
+ UpdateReleaseResponse::UpdatedEntity(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::UPDATE_CONTAINER_UPDATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_UPDATED_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -3931,11 +3816,11 @@ where
}
Ok(response)
}
- UpdateContainerResponse::BadRequest(body) => {
+ UpdateReleaseResponse::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::UPDATE_CONTAINER_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -3943,11 +3828,11 @@ where
}
Ok(response)
}
- UpdateContainerResponse::NotFound(body) => {
+ UpdateReleaseResponse::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::UPDATE_CONTAINER_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -3955,11 +3840,11 @@ where
}
Ok(response)
}
- UpdateContainerResponse::GenericError(body) => {
+ UpdateReleaseResponse::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::UPDATE_CONTAINER_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -3981,12 +3866,12 @@ where
Ok(response)
})
},
- "UpdateContainer",
+ "UpdateRelease",
);
let api_clone = api.clone();
- router.put(
- "/v0/creator/:id",
+ router.post(
+ "/v0/work/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3999,57 +3884,42 @@ where
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_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok());
let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_entity = req
+ let param_entity_list = req
.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+ let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_list_raw);
- let param_entity: Option<models::CreatorEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let param_entity_list: Option<Vec<models::WorkEntity>> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?;
- param_entity
+ param_entity_list
} else {
None
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
+ let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.update_creator(param_id, param_entity, param_editgroup, context).wait() {
+ match api.create_work_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
- UpdateCreatorResponse::UpdatedEntity(body) => {
+ CreateWorkBatchResponse::CreatedEntities(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::UPDATE_CREATOR_UPDATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_CREATED_ENTITIES.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -4057,11 +3927,11 @@ where
}
Ok(response)
}
- UpdateCreatorResponse::BadRequest(body) => {
+ CreateWorkBatchResponse::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::UPDATE_CREATOR_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -4069,11 +3939,11 @@ where
}
Ok(response)
}
- UpdateCreatorResponse::NotFound(body) => {
+ CreateWorkBatchResponse::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::UPDATE_CREATOR_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -4081,11 +3951,11 @@ where
}
Ok(response)
}
- UpdateCreatorResponse::GenericError(body) => {
+ CreateWorkBatchResponse::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::UPDATE_CREATOR_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BATCH_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
if !unused_elements.is_empty() {
@@ -4107,12 +3977,12 @@ where
Ok(response)
})
},
- "UpdateCreator",
+ "CreateWorkBatch",
);
let api_clone = api.clone();
- router.put(
- "/v0/file/:id",
+ router.delete(
+ "/v0/work/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -4144,79 +4014,139 @@ where
let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
+ match api.delete_work(param_id, param_editgroup, context).wait() {
+ Ok(rsp) => match rsp {
+ DeleteWorkResponse::DeletedEntity(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_DELETED_ENTITY.clone()));
- let mut unused_elements = Vec::new();
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+ Ok(response)
+ }
+ DeleteWorkResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let param_entity: Option<models::FileEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::DELETE_WORK_BAD_REQUEST.clone()));
- param_entity
- } else {
- None
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteWorkResponse::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_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ DeleteWorkResponse::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_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)
+ })
+ },
+ "DeleteWork",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/work/: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))))?
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_file(param_id, param_entity, param_editgroup, context).wait() {
+ // 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());
+
+ match api.get_work(param_id, param_expand, context).wait() {
Ok(rsp) => match rsp {
- UpdateFileResponse::UpdatedEntity(body) => {
+ GetWorkResponse::FoundEntity(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::UPDATE_FILE_UPDATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateFileResponse::BadRequest(body) => {
+ GetWorkResponse::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::UPDATE_FILE_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateFileResponse::NotFound(body) => {
+ GetWorkResponse::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::UPDATE_FILE_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateFileResponse::GenericError(body) => {
+ GetWorkResponse::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::UPDATE_FILE_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -4233,12 +4163,12 @@ where
Ok(response)
})
},
- "UpdateFile",
+ "GetWork",
);
let api_clone = api.clone();
- router.put(
- "/v0/release/:id",
+ router.get(
+ "/v0/work/:id/history",
move |req: &mut Request| {
let mut context = Context::default();
@@ -4268,81 +4198,137 @@ 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_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
- // Body parameters (note that non-required body parameters will ignore garbage
- // values, rather than causing a 400 response). Produce warning header and logs for
- // any unused fields.
+ match api.get_work_history(param_id, param_limit, context).wait() {
+ Ok(rsp) => match rsp {
+ GetWorkHistoryResponse::FoundEntityHistory(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let param_entity = req
- .get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_HISTORY_FOUND_ENTITY_HISTORY.clone()));
- let mut unused_elements = Vec::new();
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- let param_entity = if let Some(param_entity_raw) = param_entity {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
+ Ok(response)
+ }
+ GetWorkHistoryResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
- let param_entity: Option<models::ReleaseEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_HISTORY_BAD_REQUEST.clone()));
- param_entity
- } else {
- None
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkHistoryResponse::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_HISTORY_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetWorkHistoryResponse::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_HISTORY_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)
+ })
+ },
+ "GetWorkHistory",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/work/:id/releases",
+ 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))))?
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_release(param_id, param_entity, param_editgroup, context).wait() {
+ match api.get_work_releases(param_id, context).wait() {
Ok(rsp) => match rsp {
- UpdateReleaseResponse::UpdatedEntity(body) => {
+ GetWorkReleasesResponse::Found(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::UPDATE_RELEASE_UPDATED_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateReleaseResponse::BadRequest(body) => {
+ GetWorkReleasesResponse::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::UPDATE_RELEASE_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateReleaseResponse::NotFound(body) => {
+ GetWorkReleasesResponse::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::UPDATE_RELEASE_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- UpdateReleaseResponse::GenericError(body) => {
+ GetWorkReleasesResponse::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::UPDATE_RELEASE_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_WORK_RELEASES_GENERIC_ERROR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -4359,7 +4345,7 @@ where
Ok(response)
})
},
- "UpdateRelease",
+ "GetWorkReleases",
);
let api_clone = api.clone();
@@ -4409,11 +4395,10 @@ where
let param_entity = if let Some(param_entity_raw) = param_entity {
let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_entity: Option<models::WorkEntity> =
- serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
param_entity
} else {