aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api')
-rw-r--r--rust/fatcat-api/README.md50
-rw-r--r--rust/fatcat-api/api.yaml24
-rw-r--r--rust/fatcat-api/api/swagger.yaml328
-rw-r--r--rust/fatcat-api/examples/client.rs169
-rw-r--r--rust/fatcat-api/examples/server_lib/server.rs112
-rw-r--r--rust/fatcat-api/src/client.rs573
-rw-r--r--rust/fatcat-api/src/lib.rs338
-rw-r--r--rust/fatcat-api/src/mimetypes.rs416
-rw-r--r--rust/fatcat-api/src/server.rs1399
9 files changed, 1728 insertions, 1681 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md
index 32e6390b..856d54b5 100644
--- a/rust/fatcat-api/README.md
+++ b/rust/fatcat-api/README.md
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 0.1.0
-- Build date: 2018-05-27T21:52:37.437Z
+- Build date: 2018-05-28T21:40:16.318Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
@@ -56,30 +56,30 @@ cargo run --example server
To run a client, follow one of the following simple steps:
```
-cargo run --example client ContainerBatchPost
-cargo run --example client ContainerIdGet
-cargo run --example client ContainerLookupGet
-cargo run --example client ContainerPost
-cargo run --example client CreatorBatchPost
-cargo run --example client CreatorIdGet
-cargo run --example client CreatorLookupGet
-cargo run --example client CreatorPost
-cargo run --example client EditgroupIdAcceptPost
-cargo run --example client EditgroupIdGet
-cargo run --example client EditgroupPost
-cargo run --example client EditorUsernameChangelogGet
-cargo run --example client EditorUsernameGet
-cargo run --example client FileBatchPost
-cargo run --example client FileIdGet
-cargo run --example client FileLookupGet
-cargo run --example client FilePost
-cargo run --example client ReleaseBatchPost
-cargo run --example client ReleaseIdGet
-cargo run --example client ReleaseLookupGet
-cargo run --example client ReleasePost
-cargo run --example client WorkBatchPost
-cargo run --example client WorkIdGet
-cargo run --example client WorkPost
+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 GetContainer
+cargo run --example client GetCreator
+cargo run --example client GetEditgroup
+cargo run --example client GetEditor
+cargo run --example client GetEditorChangelog
+cargo run --example client GetFile
+cargo run --example client GetRelease
+cargo run --example client GetWork
+cargo run --example client LookupContainer
+cargo run --example client LookupCreator
+cargo run --example client LookupFile
+cargo run --example client LookupRelease
```
### HTTPS
diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml
index 8fcbf488..8ced937d 100644
--- a/rust/fatcat-api/api.yaml
+++ b/rust/fatcat-api/api.yaml
@@ -302,6 +302,7 @@ x-entity-responses: &ENTITYRESPONSES
paths:
/container:
post:
+ operationId: "create_container"
parameters:
- name: entity
in: body
@@ -316,6 +317,7 @@ paths:
<<: *ENTITYRESPONSES
/container/batch:
post:
+ operationId: "create_container_batch"
parameters:
- name: entity_list
in: body
@@ -339,6 +341,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_container"
responses:
200:
description: Found Entity
@@ -347,6 +350,7 @@ paths:
<<: *ENTITYRESPONSES
/container/lookup:
get:
+ operationId: "lookup_container"
parameters:
- name: issnl
in: query
@@ -360,6 +364,7 @@ paths:
<<: *ENTITYRESPONSES
/creator:
post:
+ operationId: "create_creator"
parameters:
- name: entity
in: body
@@ -374,6 +379,7 @@ paths:
<<: *ENTITYRESPONSES
/creator/batch:
post:
+ operationId: "create_creator_batch"
parameters:
- name: entity_list
in: body
@@ -397,6 +403,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_creator"
responses:
200:
description: Found Entity
@@ -405,6 +412,7 @@ paths:
<<: *ENTITYRESPONSES
/creator/lookup:
get:
+ operationId: "lookup_creator"
parameters:
- name: orcid
in: query
@@ -418,6 +426,7 @@ paths:
<<: *ENTITYRESPONSES
/file:
post:
+ operationId: "create_file"
parameters:
- name: entity
in: body
@@ -432,6 +441,7 @@ paths:
<<: *ENTITYRESPONSES
/file/batch:
post:
+ operationId: "create_file_batch"
parameters:
- name: entity_list
in: body
@@ -455,6 +465,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_file"
responses:
200:
description: Found Entity
@@ -463,6 +474,7 @@ paths:
<<: *ENTITYRESPONSES
/file/lookup:
get:
+ operationId: "lookup_file"
parameters:
- name: sha1
in: query
@@ -476,6 +488,7 @@ paths:
<<: *ENTITYRESPONSES
/release:
post:
+ operationId: "create_release"
parameters:
- name: entity
in: body
@@ -490,6 +503,7 @@ paths:
<<: *ENTITYRESPONSES
/release/batch:
post:
+ operationId: "create_release_batch"
parameters:
- name: entity_list
in: body
@@ -513,6 +527,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_release"
responses:
200:
description: Found Entity
@@ -521,6 +536,7 @@ paths:
<<: *ENTITYRESPONSES
/release/lookup:
get:
+ operationId: "lookup_release"
parameters:
- name: doi
in: query
@@ -534,6 +550,7 @@ paths:
<<: *ENTITYRESPONSES
/work:
post:
+ operationId: "create_work"
parameters:
- name: entity
in: body
@@ -548,6 +565,7 @@ paths:
<<: *ENTITYRESPONSES
/work/batch:
post:
+ operationId: "create_work_batch"
parameters:
- name: entity_list
in: body
@@ -571,6 +589,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_work"
responses:
200:
description: Found Entity
@@ -584,6 +603,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_editor"
responses:
200:
description: Found Editor
@@ -604,6 +624,7 @@ paths:
type: string
required: true
get:
+ operationId: "get_editor_changelog"
responses:
200:
description: Found Merged Changes
@@ -619,6 +640,7 @@ paths:
$ref: "#/definitions/error_response"
/editgroup:
post:
+ operationId: "create_editgroup"
parameters:
- name: entity
in: body
@@ -646,6 +668,7 @@ paths:
format: int64
required: true
get:
+ operationId: "get_editgroup"
responses:
200:
description: Found Entity
@@ -671,6 +694,7 @@ paths:
format: int64
required: true
post:
+ operationId: "accept_editgroup"
responses:
200:
description: Merged Successfully
diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml
index 8f491528..0bb29bc6 100644
--- a/rust/fatcat-api/api/swagger.yaml
+++ b/rust/fatcat-api/api/swagger.yaml
@@ -15,6 +15,7 @@ produces:
paths:
/container:
post:
+ operationId: "create_container"
parameters:
- in: "body"
name: "entity"
@@ -26,7 +27,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "CONTAINER_POST"
+ uppercase_operation_id: "CREATE_CONTAINER"
consumesJson: true
responses:
201:
@@ -35,7 +36,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntity"
x-uppercaseResponseId: "CREATED_ENTITY"
- uppercase_operation_id: "CONTAINER_POST"
+ uppercase_operation_id: "CREATE_CONTAINER"
uppercase_data_type: "ENTITYEDIT"
producesJson: true
400:
@@ -44,7 +45,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CONTAINER_POST"
+ uppercase_operation_id: "CREATE_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -53,7 +54,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CONTAINER_POST"
+ uppercase_operation_id: "CREATE_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -62,17 +63,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CONTAINER_POST"
+ uppercase_operation_id: "CREATE_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "container_post"
- uppercase_operation_id: "CONTAINER_POST"
+ operation_id: "create_container"
+ uppercase_operation_id: "CREATE_CONTAINER"
path: "/container"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/container/batch:
post:
+ operationId: "create_container_batch"
parameters:
- in: "body"
name: "entity_list"
@@ -84,7 +86,7 @@ paths:
formatString: "{:?}"
example: "&Vec::new()"
model_key: "changelogentries_inner"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
consumesJson: true
responses:
201:
@@ -95,7 +97,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntities"
x-uppercaseResponseId: "CREATED_ENTITIES"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
uppercase_data_type: "VEC<ENTITYEDIT>"
producesJson: true
400:
@@ -104,7 +106,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -113,7 +115,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -122,16 +124,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "container_batch_post"
- uppercase_operation_id: "CONTAINER_BATCH_POST"
+ operation_id: "create_container_batch"
+ uppercase_operation_id: "CREATE_CONTAINER_BATCH"
path: "/container/batch"
HttpMethod: "Post"
httpmethod: "post"
/container/{id}:
get:
+ operationId: "get_container"
parameters:
- name: "id"
in: "path"
@@ -146,7 +149,7 @@ paths:
$ref: "#/definitions/container_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "CONTAINER_ID_GET"
+ uppercase_operation_id: "GET_CONTAINER"
uppercase_data_type: "CONTAINERENTITY"
producesJson: true
400:
@@ -155,7 +158,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CONTAINER_ID_GET"
+ uppercase_operation_id: "GET_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -164,7 +167,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CONTAINER_ID_GET"
+ uppercase_operation_id: "GET_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -173,16 +176,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CONTAINER_ID_GET"
+ uppercase_operation_id: "GET_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "container_id_get"
- uppercase_operation_id: "CONTAINER_ID_GET"
+ operation_id: "get_container"
+ uppercase_operation_id: "GET_CONTAINER"
path: "/container/:id"
HttpMethod: "Get"
httpmethod: "get"
/container/lookup:
get:
+ operationId: "lookup_container"
parameters:
- name: "issnl"
in: "query"
@@ -197,7 +201,7 @@ paths:
$ref: "#/definitions/container_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "CONTAINER_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CONTAINER"
uppercase_data_type: "CONTAINERENTITY"
producesJson: true
400:
@@ -206,7 +210,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CONTAINER_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -215,7 +219,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CONTAINER_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -224,16 +228,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CONTAINER_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CONTAINER"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "container_lookup_get"
- uppercase_operation_id: "CONTAINER_LOOKUP_GET"
+ operation_id: "lookup_container"
+ uppercase_operation_id: "LOOKUP_CONTAINER"
path: "/container/lookup"
HttpMethod: "Get"
httpmethod: "get"
/creator:
post:
+ operationId: "create_creator"
parameters:
- in: "body"
name: "entity"
@@ -245,7 +250,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "CREATOR_POST"
+ uppercase_operation_id: "CREATE_CREATOR"
consumesJson: true
responses:
201:
@@ -254,7 +259,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntity"
x-uppercaseResponseId: "CREATED_ENTITY"
- uppercase_operation_id: "CREATOR_POST"
+ uppercase_operation_id: "CREATE_CREATOR"
uppercase_data_type: "ENTITYEDIT"
producesJson: true
400:
@@ -263,7 +268,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CREATOR_POST"
+ uppercase_operation_id: "CREATE_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -272,7 +277,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CREATOR_POST"
+ uppercase_operation_id: "CREATE_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -281,17 +286,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CREATOR_POST"
+ uppercase_operation_id: "CREATE_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "creator_post"
- uppercase_operation_id: "CREATOR_POST"
+ operation_id: "create_creator"
+ uppercase_operation_id: "CREATE_CREATOR"
path: "/creator"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/creator/batch:
post:
+ operationId: "create_creator_batch"
parameters:
- in: "body"
name: "entity_list"
@@ -303,7 +309,7 @@ paths:
formatString: "{:?}"
example: "&Vec::new()"
model_key: "changelogentries_inner"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
consumesJson: true
responses:
201:
@@ -314,7 +320,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntities"
x-uppercaseResponseId: "CREATED_ENTITIES"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
uppercase_data_type: "VEC<ENTITYEDIT>"
producesJson: true
400:
@@ -323,7 +329,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -332,7 +338,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -341,16 +347,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "creator_batch_post"
- uppercase_operation_id: "CREATOR_BATCH_POST"
+ operation_id: "create_creator_batch"
+ uppercase_operation_id: "CREATE_CREATOR_BATCH"
path: "/creator/batch"
HttpMethod: "Post"
httpmethod: "post"
/creator/{id}:
get:
+ operationId: "get_creator"
parameters:
- name: "id"
in: "path"
@@ -365,7 +372,7 @@ paths:
$ref: "#/definitions/creator_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "CREATOR_ID_GET"
+ uppercase_operation_id: "GET_CREATOR"
uppercase_data_type: "CREATORENTITY"
producesJson: true
400:
@@ -374,7 +381,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CREATOR_ID_GET"
+ uppercase_operation_id: "GET_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -383,7 +390,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CREATOR_ID_GET"
+ uppercase_operation_id: "GET_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -392,16 +399,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CREATOR_ID_GET"
+ uppercase_operation_id: "GET_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "creator_id_get"
- uppercase_operation_id: "CREATOR_ID_GET"
+ operation_id: "get_creator"
+ uppercase_operation_id: "GET_CREATOR"
path: "/creator/:id"
HttpMethod: "Get"
httpmethod: "get"
/creator/lookup:
get:
+ operationId: "lookup_creator"
parameters:
- name: "orcid"
in: "query"
@@ -416,7 +424,7 @@ paths:
$ref: "#/definitions/creator_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "CREATOR_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CREATOR"
uppercase_data_type: "CREATORENTITY"
producesJson: true
400:
@@ -425,7 +433,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "CREATOR_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -434,7 +442,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "CREATOR_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -443,16 +451,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "CREATOR_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_CREATOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "creator_lookup_get"
- uppercase_operation_id: "CREATOR_LOOKUP_GET"
+ operation_id: "lookup_creator"
+ uppercase_operation_id: "LOOKUP_CREATOR"
path: "/creator/lookup"
HttpMethod: "Get"
httpmethod: "get"
/file:
post:
+ operationId: "create_file"
parameters:
- in: "body"
name: "entity"
@@ -464,7 +473,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "FILE_POST"
+ uppercase_operation_id: "CREATE_FILE"
consumesJson: true
responses:
201:
@@ -473,7 +482,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntity"
x-uppercaseResponseId: "CREATED_ENTITY"
- uppercase_operation_id: "FILE_POST"
+ uppercase_operation_id: "CREATE_FILE"
uppercase_data_type: "ENTITYEDIT"
producesJson: true
400:
@@ -482,7 +491,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "FILE_POST"
+ uppercase_operation_id: "CREATE_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -491,7 +500,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "FILE_POST"
+ uppercase_operation_id: "CREATE_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -500,17 +509,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "FILE_POST"
+ uppercase_operation_id: "CREATE_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "file_post"
- uppercase_operation_id: "FILE_POST"
+ operation_id: "create_file"
+ uppercase_operation_id: "CREATE_FILE"
path: "/file"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/file/batch:
post:
+ operationId: "create_file_batch"
parameters:
- in: "body"
name: "entity_list"
@@ -522,7 +532,7 @@ paths:
formatString: "{:?}"
example: "&Vec::new()"
model_key: "changelogentries_inner"
- uppercase_operation_id: "FILE_BATCH_POST"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
consumesJson: true
responses:
201:
@@ -533,7 +543,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntities"
x-uppercaseResponseId: "CREATED_ENTITIES"
- uppercase_operation_id: "FILE_BATCH_POST"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
uppercase_data_type: "VEC<ENTITYEDIT>"
producesJson: true
400:
@@ -542,7 +552,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "FILE_BATCH_POST"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -551,7 +561,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "FILE_BATCH_POST"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -560,16 +570,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "FILE_BATCH_POST"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "file_batch_post"
- uppercase_operation_id: "FILE_BATCH_POST"
+ operation_id: "create_file_batch"
+ uppercase_operation_id: "CREATE_FILE_BATCH"
path: "/file/batch"
HttpMethod: "Post"
httpmethod: "post"
/file/{id}:
get:
+ operationId: "get_file"
parameters:
- name: "id"
in: "path"
@@ -584,7 +595,7 @@ paths:
$ref: "#/definitions/file_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "FILE_ID_GET"
+ uppercase_operation_id: "GET_FILE"
uppercase_data_type: "FILEENTITY"
producesJson: true
400:
@@ -593,7 +604,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "FILE_ID_GET"
+ uppercase_operation_id: "GET_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -602,7 +613,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "FILE_ID_GET"
+ uppercase_operation_id: "GET_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -611,16 +622,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "FILE_ID_GET"
+ uppercase_operation_id: "GET_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "file_id_get"
- uppercase_operation_id: "FILE_ID_GET"
+ operation_id: "get_file"
+ uppercase_operation_id: "GET_FILE"
path: "/file/:id"
HttpMethod: "Get"
httpmethod: "get"
/file/lookup:
get:
+ operationId: "lookup_file"
parameters:
- name: "sha1"
in: "query"
@@ -635,7 +647,7 @@ paths:
$ref: "#/definitions/file_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "FILE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_FILE"
uppercase_data_type: "FILEENTITY"
producesJson: true
400:
@@ -644,7 +656,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "FILE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -653,7 +665,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "FILE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -662,16 +674,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "FILE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_FILE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "file_lookup_get"
- uppercase_operation_id: "FILE_LOOKUP_GET"
+ operation_id: "lookup_file"
+ uppercase_operation_id: "LOOKUP_FILE"
path: "/file/lookup"
HttpMethod: "Get"
httpmethod: "get"
/release:
post:
+ operationId: "create_release"
parameters:
- in: "body"
name: "entity"
@@ -683,7 +696,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "RELEASE_POST"
+ uppercase_operation_id: "CREATE_RELEASE"
consumesJson: true
responses:
201:
@@ -692,7 +705,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntity"
x-uppercaseResponseId: "CREATED_ENTITY"
- uppercase_operation_id: "RELEASE_POST"
+ uppercase_operation_id: "CREATE_RELEASE"
uppercase_data_type: "ENTITYEDIT"
producesJson: true
400:
@@ -701,7 +714,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "RELEASE_POST"
+ uppercase_operation_id: "CREATE_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -710,7 +723,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "RELEASE_POST"
+ uppercase_operation_id: "CREATE_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -719,17 +732,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "RELEASE_POST"
+ uppercase_operation_id: "CREATE_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "release_post"
- uppercase_operation_id: "RELEASE_POST"
+ operation_id: "create_release"
+ uppercase_operation_id: "CREATE_RELEASE"
path: "/release"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/release/batch:
post:
+ operationId: "create_release_batch"
parameters:
- in: "body"
name: "entity_list"
@@ -741,7 +755,7 @@ paths:
formatString: "{:?}"
example: "&Vec::new()"
model_key: "changelogentries_inner"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
consumesJson: true
responses:
201:
@@ -752,7 +766,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntities"
x-uppercaseResponseId: "CREATED_ENTITIES"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
uppercase_data_type: "VEC<ENTITYEDIT>"
producesJson: true
400:
@@ -761,7 +775,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -770,7 +784,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -779,16 +793,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "release_batch_post"
- uppercase_operation_id: "RELEASE_BATCH_POST"
+ operation_id: "create_release_batch"
+ uppercase_operation_id: "CREATE_RELEASE_BATCH"
path: "/release/batch"
HttpMethod: "Post"
httpmethod: "post"
/release/{id}:
get:
+ operationId: "get_release"
parameters:
- name: "id"
in: "path"
@@ -803,7 +818,7 @@ paths:
$ref: "#/definitions/release_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "RELEASE_ID_GET"
+ uppercase_operation_id: "GET_RELEASE"
uppercase_data_type: "RELEASEENTITY"
producesJson: true
400:
@@ -812,7 +827,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "RELEASE_ID_GET"
+ uppercase_operation_id: "GET_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -821,7 +836,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "RELEASE_ID_GET"
+ uppercase_operation_id: "GET_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -830,16 +845,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "RELEASE_ID_GET"
+ uppercase_operation_id: "GET_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "release_id_get"
- uppercase_operation_id: "RELEASE_ID_GET"
+ operation_id: "get_release"
+ uppercase_operation_id: "GET_RELEASE"
path: "/release/:id"
HttpMethod: "Get"
httpmethod: "get"
/release/lookup:
get:
+ operationId: "lookup_release"
parameters:
- name: "doi"
in: "query"
@@ -854,7 +870,7 @@ paths:
$ref: "#/definitions/release_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "RELEASE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_RELEASE"
uppercase_data_type: "RELEASEENTITY"
producesJson: true
400:
@@ -863,7 +879,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "RELEASE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -872,7 +888,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "RELEASE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -881,16 +897,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "RELEASE_LOOKUP_GET"
+ uppercase_operation_id: "LOOKUP_RELEASE"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "release_lookup_get"
- uppercase_operation_id: "RELEASE_LOOKUP_GET"
+ operation_id: "lookup_release"
+ uppercase_operation_id: "LOOKUP_RELEASE"
path: "/release/lookup"
HttpMethod: "Get"
httpmethod: "get"
/work:
post:
+ operationId: "create_work"
parameters:
- in: "body"
name: "entity"
@@ -902,7 +919,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "WORK_POST"
+ uppercase_operation_id: "CREATE_WORK"
consumesJson: true
responses:
201:
@@ -911,7 +928,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntity"
x-uppercaseResponseId: "CREATED_ENTITY"
- uppercase_operation_id: "WORK_POST"
+ uppercase_operation_id: "CREATE_WORK"
uppercase_data_type: "ENTITYEDIT"
producesJson: true
400:
@@ -920,7 +937,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "WORK_POST"
+ uppercase_operation_id: "CREATE_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -929,7 +946,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "WORK_POST"
+ uppercase_operation_id: "CREATE_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -938,17 +955,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "WORK_POST"
+ uppercase_operation_id: "CREATE_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "work_post"
- uppercase_operation_id: "WORK_POST"
+ operation_id: "create_work"
+ uppercase_operation_id: "CREATE_WORK"
path: "/work"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/work/batch:
post:
+ operationId: "create_work_batch"
parameters:
- in: "body"
name: "entity_list"
@@ -960,7 +978,7 @@ paths:
formatString: "{:?}"
example: "&Vec::new()"
model_key: "changelogentries_inner"
- uppercase_operation_id: "WORK_BATCH_POST"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
consumesJson: true
responses:
201:
@@ -971,7 +989,7 @@ paths:
$ref: "#/definitions/entity_edit"
x-responseId: "CreatedEntities"
x-uppercaseResponseId: "CREATED_ENTITIES"
- uppercase_operation_id: "WORK_BATCH_POST"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
uppercase_data_type: "VEC<ENTITYEDIT>"
producesJson: true
400:
@@ -980,7 +998,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "WORK_BATCH_POST"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -989,7 +1007,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "WORK_BATCH_POST"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -998,16 +1016,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "WORK_BATCH_POST"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "work_batch_post"
- uppercase_operation_id: "WORK_BATCH_POST"
+ operation_id: "create_work_batch"
+ uppercase_operation_id: "CREATE_WORK_BATCH"
path: "/work/batch"
HttpMethod: "Post"
httpmethod: "post"
/work/{id}:
get:
+ operationId: "get_work"
parameters:
- name: "id"
in: "path"
@@ -1022,7 +1041,7 @@ paths:
$ref: "#/definitions/work_entity"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "WORK_ID_GET"
+ uppercase_operation_id: "GET_WORK"
uppercase_data_type: "WORKENTITY"
producesJson: true
400:
@@ -1031,7 +1050,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "WORK_ID_GET"
+ uppercase_operation_id: "GET_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -1040,7 +1059,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "WORK_ID_GET"
+ uppercase_operation_id: "GET_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1049,16 +1068,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "WORK_ID_GET"
+ uppercase_operation_id: "GET_WORK"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "work_id_get"
- uppercase_operation_id: "WORK_ID_GET"
+ operation_id: "get_work"
+ uppercase_operation_id: "GET_WORK"
path: "/work/:id"
HttpMethod: "Get"
httpmethod: "get"
/editor/{username}:
get:
+ operationId: "get_editor"
parameters:
- name: "username"
in: "path"
@@ -1073,7 +1093,7 @@ paths:
$ref: "#/definitions/editor"
x-responseId: "FoundEditor"
x-uppercaseResponseId: "FOUND_EDITOR"
- uppercase_operation_id: "EDITOR_USERNAME_GET"
+ uppercase_operation_id: "GET_EDITOR"
uppercase_data_type: "EDITOR"
producesJson: true
404:
@@ -1082,7 +1102,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "EDITOR_USERNAME_GET"
+ uppercase_operation_id: "GET_EDITOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1091,16 +1111,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "EDITOR_USERNAME_GET"
+ uppercase_operation_id: "GET_EDITOR"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "editor_username_get"
- uppercase_operation_id: "EDITOR_USERNAME_GET"
+ operation_id: "get_editor"
+ uppercase_operation_id: "GET_EDITOR"
path: "/editor/:username"
HttpMethod: "Get"
httpmethod: "get"
/editor/{username}/changelog:
get:
+ operationId: "get_editor_changelog"
parameters:
- name: "username"
in: "path"
@@ -1115,7 +1136,7 @@ paths:
$ref: "#/definitions/changelogentries"
x-responseId: "FoundMergedChanges"
x-uppercaseResponseId: "FOUND_MERGED_CHANGES"
- uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET"
+ uppercase_operation_id: "GET_EDITOR_CHANGELOG"
uppercase_data_type: "CHANGELOGENTRIES"
producesJson: true
404:
@@ -1124,7 +1145,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET"
+ uppercase_operation_id: "GET_EDITOR_CHANGELOG"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1133,16 +1154,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET"
+ uppercase_operation_id: "GET_EDITOR_CHANGELOG"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "editor_username_changelog_get"
- uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET"
+ operation_id: "get_editor_changelog"
+ uppercase_operation_id: "GET_EDITOR_CHANGELOG"
path: "/editor/:username/changelog"
HttpMethod: "Get"
httpmethod: "get"
/editgroup:
post:
+ operationId: "create_editgroup"
parameters:
- in: "body"
name: "entity"
@@ -1154,7 +1176,7 @@ paths:
formatString: "{:?}"
example: "???"
model_key: "changelogentries_inner"
- uppercase_operation_id: "EDITGROUP_POST"
+ uppercase_operation_id: "CREATE_EDITGROUP"
consumesJson: true
responses:
201:
@@ -1163,7 +1185,7 @@ paths:
$ref: "#/definitions/editgroup"
x-responseId: "SuccessfullyCreated"
x-uppercaseResponseId: "SUCCESSFULLY_CREATED"
- uppercase_operation_id: "EDITGROUP_POST"
+ uppercase_operation_id: "CREATE_EDITGROUP"
uppercase_data_type: "EDITGROUP"
producesJson: true
400:
@@ -1172,7 +1194,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "EDITGROUP_POST"
+ uppercase_operation_id: "CREATE_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1181,17 +1203,18 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "EDITGROUP_POST"
+ uppercase_operation_id: "CREATE_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "editgroup_post"
- uppercase_operation_id: "EDITGROUP_POST"
+ operation_id: "create_editgroup"
+ uppercase_operation_id: "CREATE_EDITGROUP"
path: "/editgroup"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/editgroup/{id}:
get:
+ operationId: "get_editgroup"
parameters:
- name: "id"
in: "path"
@@ -1207,7 +1230,7 @@ paths:
$ref: "#/definitions/editgroup"
x-responseId: "FoundEntity"
x-uppercaseResponseId: "FOUND_ENTITY"
- uppercase_operation_id: "EDITGROUP_ID_GET"
+ uppercase_operation_id: "GET_EDITGROUP"
uppercase_data_type: "EDITGROUP"
producesJson: true
400:
@@ -1216,7 +1239,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "EDITGROUP_ID_GET"
+ uppercase_operation_id: "GET_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -1225,7 +1248,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "EDITGROUP_ID_GET"
+ uppercase_operation_id: "GET_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1234,16 +1257,17 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "EDITGROUP_ID_GET"
+ uppercase_operation_id: "GET_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "editgroup_id_get"
- uppercase_operation_id: "EDITGROUP_ID_GET"
+ operation_id: "get_editgroup"
+ uppercase_operation_id: "GET_EDITGROUP"
path: "/editgroup/:id"
HttpMethod: "Get"
httpmethod: "get"
/editgroup/{id}/accept:
post:
+ operationId: "accept_editgroup"
parameters:
- name: "id"
in: "path"
@@ -1259,7 +1283,7 @@ paths:
$ref: "#/definitions/success"
x-responseId: "MergedSuccessfully"
x-uppercaseResponseId: "MERGED_SUCCESSFULLY"
- uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST"
+ uppercase_operation_id: "ACCEPT_EDITGROUP"
uppercase_data_type: "SUCCESS"
producesJson: true
400:
@@ -1268,7 +1292,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "Unmergable"
x-uppercaseResponseId: "UNMERGABLE"
- uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST"
+ uppercase_operation_id: "ACCEPT_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -1277,7 +1301,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST"
+ uppercase_operation_id: "ACCEPT_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
default:
@@ -1286,11 +1310,11 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST"
+ uppercase_operation_id: "ACCEPT_EDITGROUP"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "editgroup_id_accept_post"
- uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST"
+ operation_id: "accept_editgroup"
+ uppercase_operation_id: "ACCEPT_EDITGROUP"
path: "/editgroup/:id/accept"
HttpMethod: "Post"
httpmethod: "post"
diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs
index b08a70bb..ebbff568 100644
--- a/rust/fatcat-api/examples/client.rs
+++ b/rust/fatcat-api/examples/client.rs
@@ -11,10 +11,10 @@ extern crate uuid;
use clap::{App, Arg};
#[allow(unused_imports)]
-use fatcat::{ApiError, ApiNoContext, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, ContextWrapperExt, CreatorBatchPostResponse,
- CreatorIdGetResponse, CreatorLookupGetResponse, CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse,
- EditorUsernameGetResponse, FileBatchPostResponse, FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse,
- ReleasePostResponse, WorkBatchPostResponse, WorkIdGetResponse, WorkPostResponse};
+use fatcat::{AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse,
+ CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse,
+ GetContainerResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse,
+ LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse};
#[allow(unused_imports)]
use futures::{future, stream, Future, Stream};
@@ -24,24 +24,24 @@ fn main() {
Arg::with_name("operation")
.help("Sets the operation to run")
.possible_values(&[
- "ContainerBatchPost",
- "ContainerIdGet",
- "ContainerLookupGet",
- "CreatorBatchPost",
- "CreatorIdGet",
- "CreatorLookupGet",
- "EditgroupIdAcceptPost",
- "EditgroupIdGet",
- "EditorUsernameChangelogGet",
- "EditorUsernameGet",
- "FileBatchPost",
- "FileIdGet",
- "FileLookupGet",
- "ReleaseBatchPost",
- "ReleaseIdGet",
- "ReleaseLookupGet",
- "WorkBatchPost",
- "WorkIdGet",
+ "AcceptEditgroup",
+ "CreateContainerBatch",
+ "CreateCreatorBatch",
+ "CreateFileBatch",
+ "CreateReleaseBatch",
+ "CreateWorkBatch",
+ "GetContainer",
+ "GetCreator",
+ "GetEditgroup",
+ "GetEditor",
+ "GetEditorChangelog",
+ "GetFile",
+ "GetRelease",
+ "GetWork",
+ "LookupContainer",
+ "LookupCreator",
+ "LookupFile",
+ "LookupRelease",
])
.required(true)
.index(1),
@@ -70,126 +70,127 @@ 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("ContainerBatchPost") => {
- let result = client.container_batch_post(&Vec::new()).wait();
+ Some("AcceptEditgroup") => {
+ let result = client.accept_editgroup(789).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("ContainerIdGet") => {
- let result = client.container_id_get("id_example".to_string()).wait();
+ // Disabled because there's no example.
+ // Some("CreateContainer") => {
+ // let result = client.create_container(???).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+ Some("CreateContainerBatch") => {
+ let result = client.create_container_batch(&Vec::new()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("ContainerLookupGet") => {
- let result = client.container_lookup_get("issnl_example".to_string()).wait();
+ // Disabled because there's no example.
+ // Some("CreateCreator") => {
+ // let result = client.create_creator(???).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()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
// Disabled because there's no example.
- // Some("ContainerPost") => {
- // let result = client.container_post(???).wait();
+ // 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("CreatorBatchPost") => {
- let result = client.creator_batch_post(&Vec::new()).wait();
- println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- }
- Some("CreatorIdGet") => {
- let result = client.creator_id_get("id_example".to_string()).wait();
+ // Disabled because there's no example.
+ // Some("CreateFile") => {
+ // let result = client.create_file(???).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()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("CreatorLookupGet") => {
- let result = client.creator_lookup_get("orcid_example".to_string()).wait();
+ // Disabled because there's no example.
+ // Some("CreateRelease") => {
+ // let result = client.create_release(???).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()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
// Disabled because there's no example.
- // Some("CreatorPost") => {
- // let result = client.creator_post(???).wait();
+ // Some("CreateWork") => {
+ // let result = client.create_work(???).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
- Some("EditgroupIdAcceptPost") => {
- let result = client.editgroup_id_accept_post(789).wait();
+ Some("CreateWorkBatch") => {
+ let result = client.create_work_batch(&Vec::new()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("EditgroupIdGet") => {
- let result = client.editgroup_id_get(789).wait();
+ Some("GetContainer") => {
+ let result = client.get_container("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("EditgroupPost") => {
- // let result = client.editgroup_post(???).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("EditorUsernameChangelogGet") => {
- let result = client.editor_username_changelog_get("username_example".to_string()).wait();
+ Some("GetCreator") => {
+ let result = client.get_creator("id_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("EditorUsernameGet") => {
- let result = client.editor_username_get("username_example".to_string()).wait();
+ Some("GetEditgroup") => {
+ let result = client.get_editgroup(789).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("FileBatchPost") => {
- let result = client.file_batch_post(&Vec::new()).wait();
+ Some("GetEditor") => {
+ let result = client.get_editor("username_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("FileIdGet") => {
- let result = client.file_id_get("id_example".to_string()).wait();
+ Some("GetEditorChangelog") => {
+ let result = client.get_editor_changelog("username_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("FileLookupGet") => {
- let result = client.file_lookup_get("sha1_example".to_string()).wait();
+ Some("GetFile") => {
+ let result = client.get_file("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("FilePost") => {
- // let result = client.file_post(???).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("ReleaseBatchPost") => {
- let result = client.release_batch_post(&Vec::new()).wait();
+ Some("GetRelease") => {
+ let result = client.get_release("id_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("ReleaseIdGet") => {
- let result = client.release_id_get("id_example".to_string()).wait();
+ Some("GetWork") => {
+ let result = client.get_work("id_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("ReleaseLookupGet") => {
- let result = client.release_lookup_get("doi_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("ReleasePost") => {
- // let result = client.release_post(???).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
- Some("WorkBatchPost") => {
- let result = client.work_batch_post(&Vec::new()).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("WorkIdGet") => {
- let result = client.work_id_get("id_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("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>")));
}
- // Disabled because there's no example.
- // Some("WorkPost") => {
- // let result = client.work_post(???).wait();
- // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
- // },
_ => panic!("Invalid operation provided"),
}
}
diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs
index 7c27b09a..81dff430 100644
--- a/rust/fatcat-api/examples/server_lib/server.rs
+++ b/rust/fatcat-api/examples/server_lib/server.rs
@@ -10,160 +10,160 @@ use std::collections::HashMap;
use swagger;
use fatcat::models;
-use fatcat::{Api, ApiError, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, Context, CreatorBatchPostResponse, CreatorIdGetResponse,
- CreatorLookupGetResponse, CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse,
- EditorUsernameGetResponse, FileBatchPostResponse, FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse,
- ReleasePostResponse, WorkBatchPostResponse, WorkIdGetResponse, WorkPostResponse};
+use fatcat::{AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse,
+ CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerResponse, GetCreatorResponse,
+ GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse,
+ LookupFileResponse, LookupReleaseResponse};
#[derive(Copy, Clone)]
pub struct Server;
impl Api for Server {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send> {
+ fn accept_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_batch_post({:?}) - X-Span-ID: {:?}", entity_list, 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 container_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
+ fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_container({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn container_lookup_get(&self, issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_lookup_get(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_container_batch({:?}) - X-Span-ID: {:?}",
+ entity_list,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_creator({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send> {
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_creator_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_id_get(&self, id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
+ fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_editgroup({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_lookup_get(&self, orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
+ fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_lookup_get(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_file({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_file_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
+ fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editgroup_id_accept_post({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_release({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editgroup_id_get({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_release_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editgroup_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_work({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn editor_username_changelog_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!(
- "editor_username_changelog_get(\"{}\") - X-Span-ID: {:?}",
- username,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
+ println!("create_work_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn editor_username_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
+ fn get_container(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editor_username_get(\"{}\") - X-Span-ID: {:?}", username, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_container(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send> {
+ fn get_creator(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_creator(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn file_id_get(&self, id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
+ fn get_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_id_get(\"{}\") - 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 file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
+ fn get_editor(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_lookup_get(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editor(\"{}\") - X-Span-ID: {:?}", username, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn get_editor_changelog(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", username, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send> {
+ fn get_file(&self, id: String, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_file(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn release_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
+ fn get_release(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_release(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn release_lookup_get(&self, doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
+ fn get_work(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_lookup_get(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_work(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_post({:?}) - X-Span-ID: {:?}", entity, 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 work_batch_post(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send> {
+ fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("work_batch_post({:?}) - X-Span-ID: {:?}", entity_list, 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 work_id_get(&self, id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
+ fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("work_id_get(\"{}\") - 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 work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("work_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
}
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index e9f8bf0e..978ce597 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -34,10 +34,9 @@ use swagger;
use swagger::{ApiError, Context, XSpanId};
use models;
-use {Api, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, CreatorBatchPostResponse, CreatorIdGetResponse, CreatorLookupGetResponse,
- CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, EditorUsernameGetResponse, FileBatchPostResponse,
- FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, ReleasePostResponse, WorkBatchPostResponse,
- WorkIdGetResponse, WorkPostResponse};
+use {AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerResponse, GetCreatorResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse};
/// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes.
fn into_base_path<T: IntoUrl>(input: T, correct_scheme: Option<&'static str>) -> Result<String, ClientInitError> {
@@ -162,52 +161,47 @@ impl Client {
}
impl Api for Client {
- fn container_batch_post(&self, param_entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn accept_editgroup(&self, param_id: i64, 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();
- let request = request.body(&body);
-
- custom_headers.set(ContentType(mimetypes::requests::CONTAINER_BATCH_POST.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<ContainerBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<AcceptEditgroupResponse, 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::Success>(&buf)?;
- Ok(ContainerBatchPostResponse::CreatedEntities(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(ContainerBatchPostResponse::BadRequest(body))
+ Ok(AcceptEditgroupResponse::Unmergable(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(ContainerBatchPostResponse::NotFound(body))
+ Ok(AcceptEditgroupResponse::NotFound(body))
}
0 => {
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(ContainerBatchPostResponse::GenericError(body))
+ Ok(AcceptEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -227,47 +221,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn create_container(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container", self.base_path);
+
+ 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_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<ContainerIdGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateContainerResponse, 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::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(ContainerIdGetResponse::FoundEntity(body))
+ Ok(CreateContainerResponse::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(ContainerIdGetResponse::BadRequest(body))
+ Ok(CreateContainerResponse::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(ContainerIdGetResponse::NotFound(body))
+ Ok(CreateContainerResponse::NotFound(body))
}
0 => {
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(ContainerIdGetResponse::GenericError(body))
+ Ok(CreateContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -287,50 +286,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_lookup_get(&self, param_issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_issnl = format!("issnl={issnl}&", issnl = param_issnl.to_string());
+ fn create_container_batch(&self, param_entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container/batch", self.base_path);
- let url = format!("{}/v0/container/lookup?{issnl}", self.base_path, issnl = utf8_percent_encode(&query_issnl, 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_CONTAINER_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<ContainerLookupGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateContainerBatchResponse, 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::ContainerEntity>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(ContainerLookupGetResponse::FoundEntity(body))
+ Ok(CreateContainerBatchResponse::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(ContainerLookupGetResponse::BadRequest(body))
+ Ok(CreateContainerBatchResponse::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(ContainerLookupGetResponse::NotFound(body))
+ Ok(CreateContainerBatchResponse::NotFound(body))
}
0 => {
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(ContainerLookupGetResponse::GenericError(body))
+ Ok(CreateContainerBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -350,8 +351,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_post(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container", self.base_path);
+ fn create_creator(&self, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator", self.base_path);
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -361,41 +362,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CONTAINER_POST.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<ContainerPostResponse, 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(ContainerPostResponse::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(ContainerPostResponse::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(ContainerPostResponse::NotFound(body))
+ Ok(CreateCreatorResponse::NotFound(body))
}
0 => {
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(ContainerPostResponse::GenericError(body))
+ Ok(CreateCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -415,7 +416,7 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_batch_post(&self, param_entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send> {
+ fn create_creator_batch(&self, param_entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/creator/batch", self.base_path);
let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
@@ -426,41 +427,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATOR_BATCH_POST.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<CreatorBatchPostResponse, 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(CreatorBatchPostResponse::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(CreatorBatchPostResponse::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(CreatorBatchPostResponse::NotFound(body))
+ Ok(CreateCreatorBatchResponse::NotFound(body))
}
0 => {
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(CreatorBatchPostResponse::GenericError(body))
+ Ok(CreateCreatorBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -480,47 +481,45 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ 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);
+
+ 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_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<CreatorIdGetResponse, 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::<models::CreatorEntity>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(CreatorIdGetResponse::FoundEntity(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(CreatorIdGetResponse::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(CreatorIdGetResponse::NotFound(body))
+ Ok(CreateEditgroupResponse::BadRequest(body))
}
0 => {
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(CreatorIdGetResponse::GenericError(body))
+ Ok(CreateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -540,50 +539,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_lookup_get(&self, param_orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
+ fn create_file(&self, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file", self.base_path);
- let url = format!("{}/v0/creator/lookup?{orcid}", self.base_path, orcid = utf8_percent_encode(&query_orcid, 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<CreatorLookupGetResponse, 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::CreatorEntity>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(CreatorLookupGetResponse::FoundEntity(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(CreatorLookupGetResponse::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(CreatorLookupGetResponse::NotFound(body))
+ Ok(CreateFileResponse::NotFound(body))
}
0 => {
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(CreatorLookupGetResponse::GenericError(body))
+ Ok(CreateFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -603,10 +604,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_post(&self, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator", self.base_path);
+ fn create_file_batch(&self, param_entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file/batch", self.base_path);
- 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::Post, &url);
@@ -614,41 +615,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::CREATOR_POST.clone()));
+ 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<CreatorPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateFileBatchResponse, 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)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(CreatorPostResponse::CreatedEntity(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(CreatorPostResponse::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(CreatorPostResponse::NotFound(body))
+ Ok(CreateFileBatchResponse::NotFound(body))
}
0 => {
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(CreatorPostResponse::GenericError(body))
+ Ok(CreateFileBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -668,47 +669,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_id_accept_post(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, 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));
+ fn create_release(&self, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release", self.base_path);
+
+ 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 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<EditgroupIdAcceptPostResponse, 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::<models::Success>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(EditgroupIdAcceptPostResponse::MergedSuccessfully(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(EditgroupIdAcceptPostResponse::Unmergable(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(EditgroupIdAcceptPostResponse::NotFound(body))
+ Ok(CreateReleaseResponse::NotFound(body))
}
0 => {
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(EditgroupIdAcceptPostResponse::GenericError(body))
+ Ok(CreateReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -728,47 +734,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_id_get(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, 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_release_batch(&self, param_entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/release/batch", self.base_path);
+
+ 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<EditgroupIdGetResponse, 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
- Ok(EditgroupIdGetResponse::FoundEntity(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(EditgroupIdGetResponse::BadRequest(body))
+ 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(EditgroupIdGetResponse::NotFound(body))
+ Ok(CreateReleaseBatchResponse::NotFound(body))
}
0 => {
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(EditgroupIdGetResponse::GenericError(body))
+ Ok(CreateReleaseBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -788,8 +799,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_post(&self, param_entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/editgroup", self.base_path);
+ fn create_work(&self, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work", self.base_path);
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -799,34 +810,41 @@ impl Api for Client {
let request = request.body(&body);
- custom_headers.set(ContentType(mimetypes::requests::EDITGROUP_POST.clone()));
+ 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<EditgroupPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<CreateWorkResponse, 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::Editgroup>(&buf)?;
+ let body = serde_json::from_str::<models::EntityEdit>(&buf)?;
- Ok(EditgroupPostResponse::SuccessfullyCreated(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(EditgroupPostResponse::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(CreateWorkResponse::NotFound(body))
}
0 => {
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(EditgroupPostResponse::GenericError(body))
+ Ok(CreateWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -846,44 +864,52 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editor_username_changelog_get(&self, param_username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editor/{username}/changelog",
- self.base_path,
- username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
- );
+ fn create_work_batch(&self, param_entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/batch", self.base_path);
+
+ 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_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<EditorUsernameChangelogGetResponse, 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::Changelogentries>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?;
+
+ 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(EditorUsernameChangelogGetResponse::FoundMergedChanges(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(EditorUsernameChangelogGetResponse::NotFound(body))
+ Ok(CreateWorkBatchResponse::NotFound(body))
}
0 => {
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(EditorUsernameChangelogGetResponse::GenericError(body))
+ Ok(CreateWorkBatchResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -903,12 +929,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editor_username_get(&self, param_username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
- let url = format!(
- "{}/v0/editor/{username}",
- self.base_path,
- username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
- );
+ fn get_container(&self, param_id: String, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/container/{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);
@@ -919,28 +941,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<EditorUsernameGetResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetContainerResponse, 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::Editor>(&buf)?;
+ let body = serde_json::from_str::<models::ContainerEntity>(&buf)?;
- Ok(EditorUsernameGetResponse::FoundEditor(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(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(EditorUsernameGetResponse::NotFound(body))
+ Ok(GetContainerResponse::NotFound(body))
}
0 => {
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(EditorUsernameGetResponse::GenericError(body))
+ Ok(GetContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -960,52 +989,47 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_batch_post(&self, param_entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn get_creator(&self, param_id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/creator/{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::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::FILE_BATCH_POST.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<FileBatchPostResponse, 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(FileBatchPostResponse::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(FileBatchPostResponse::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(FileBatchPostResponse::NotFound(body))
+ Ok(GetCreatorResponse::NotFound(body))
}
0 => {
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(FileBatchPostResponse::GenericError(body))
+ Ok(GetCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1025,8 +1049,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn get_editgroup(&self, param_id: i64, 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);
@@ -1037,35 +1061,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<FileIdGetResponse, 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::<models::FileEntity>(&buf)?;
+ let body = serde_json::from_str::<models::Editgroup>(&buf)?;
- Ok(FileIdGetResponse::FoundEntity(body))
+ Ok(GetEditgroupResponse::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(FileIdGetResponse::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(FileIdGetResponse::NotFound(body))
+ Ok(GetEditgroupResponse::NotFound(body))
}
0 => {
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(FileIdGetResponse::GenericError(body))
+ Ok(GetEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1085,11 +1109,12 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_lookup_get(&self, param_sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
-
- let url = format!("{}/v0/file/lookup?{sha1}", self.base_path, sha1 = utf8_percent_encode(&query_sha1, QUERY_ENCODE_SET));
+ fn get_editor(&self, param_username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editor/{username}",
+ self.base_path,
+ username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Get, &url);
@@ -1100,35 +1125,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<FileLookupGetResponse, 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::FileEntity>(&buf)?;
-
- Ok(FileLookupGetResponse::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)?;
+ let body = serde_json::from_str::<models::Editor>(&buf)?;
- Ok(FileLookupGetResponse::BadRequest(body))
+ Ok(GetEditorResponse::FoundEditor(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(FileLookupGetResponse::NotFound(body))
+ Ok(GetEditorResponse::NotFound(body))
}
0 => {
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(FileLookupGetResponse::GenericError(body))
+ Ok(GetEditorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1148,52 +1166,44 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_post(&self, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file", self.base_path);
-
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ fn get_editor_changelog(&self, param_username: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editor/{username}/changelog",
+ self.base_path,
+ username = utf8_percent_encode(&param_username.to_string(), PATH_SEGMENT_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::FILE_POST.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<FilePostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorChangelogResponse, 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(FilePostResponse::CreatedEntity(body))
- }
- 400 => {
+ 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::ErrorResponse>(&buf)?;
+ let body = serde_json::from_str::<models::Changelogentries>(&buf)?;
- Ok(FilePostResponse::BadRequest(body))
+ Ok(GetEditorChangelogResponse::FoundMergedChanges(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(FilePostResponse::NotFound(body))
+ Ok(GetEditorChangelogResponse::NotFound(body))
}
0 => {
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(FilePostResponse::GenericError(body))
+ Ok(GetEditorChangelogResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1213,52 +1223,47 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_batch_post(&self, param_entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release/batch", self.base_path);
-
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ fn get_file(&self, param_id: String, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/file/{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::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::RELEASE_BATCH_POST.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<ReleaseBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetFileResponse, 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::FileEntity>(&buf)?;
- Ok(ReleaseBatchPostResponse::CreatedEntities(body))
+ Ok(GetFileResponse::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(ReleaseBatchPostResponse::BadRequest(body))
+ Ok(GetFileResponse::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(ReleaseBatchPostResponse::NotFound(body))
+ Ok(GetFileResponse::NotFound(body))
}
0 => {
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(ReleaseBatchPostResponse::GenericError(body))
+ Ok(GetFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1278,7 +1283,7 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
+ fn get_release(&self, param_id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/release/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
let hyper_client = (self.hyper_client)();
@@ -1290,35 +1295,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<ReleaseIdGetResponse, 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::<models::ReleaseEntity>(&buf)?;
- Ok(ReleaseIdGetResponse::FoundEntity(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(ReleaseIdGetResponse::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(ReleaseIdGetResponse::NotFound(body))
+ Ok(GetReleaseResponse::NotFound(body))
}
0 => {
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(ReleaseIdGetResponse::GenericError(body))
+ Ok(GetReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1338,11 +1343,8 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_lookup_get(&self, param_doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
- // Query parameters
- let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
-
- let url = format!("{}/v0/release/lookup?{doi}", self.base_path, doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET));
+ fn get_work(&self, param_id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ let url = format!("{}/v0/work/{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);
@@ -1353,35 +1355,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<ReleaseLookupGetResponse, 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::ReleaseEntity>(&buf)?;
+ let body = serde_json::from_str::<models::WorkEntity>(&buf)?;
- Ok(ReleaseLookupGetResponse::FoundEntity(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(ReleaseLookupGetResponse::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(ReleaseLookupGetResponse::NotFound(body))
+ Ok(GetWorkResponse::NotFound(body))
}
0 => {
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(ReleaseLookupGetResponse::GenericError(body))
+ Ok(GetWorkResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1401,52 +1403,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_post(&self, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release", self.base_path);
+ 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 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::RELEASE_POST.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<ReleasePostResponse, 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(ReleasePostResponse::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(ReleasePostResponse::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(ReleasePostResponse::NotFound(body))
+ Ok(LookupContainerResponse::NotFound(body))
}
0 => {
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(ReleasePostResponse::GenericError(body))
+ Ok(LookupContainerResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1466,52 +1466,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_batch_post(&self, param_entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/batch", self.base_path);
+ fn lookup_creator(&self, param_orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_orcid = format!("orcid={orcid}&", orcid = param_orcid.to_string());
- let body = serde_json::to_string(&param_entity_list).expect("impossible to fail to serialize");
+ 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::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::WORK_BATCH_POST.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<WorkBatchPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupCreatorResponse, 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(WorkBatchPostResponse::CreatedEntities(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(WorkBatchPostResponse::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(WorkBatchPostResponse::NotFound(body))
+ Ok(LookupCreatorResponse::NotFound(body))
}
0 => {
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(WorkBatchPostResponse::GenericError(body))
+ Ok(LookupCreatorResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1531,8 +1529,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_id_get(&self, param_id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn lookup_file(&self, param_sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_sha1 = format!("sha1={sha1}&", sha1 = param_sha1.to_string());
+
+ 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);
@@ -1543,35 +1544,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<WorkIdGetResponse, 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::WorkEntity>(&buf)?;
+ let body = serde_json::from_str::<models::FileEntity>(&buf)?;
- Ok(WorkIdGetResponse::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(WorkIdGetResponse::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(WorkIdGetResponse::NotFound(body))
+ Ok(LookupFileResponse::NotFound(body))
}
0 => {
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(WorkIdGetResponse::GenericError(body))
+ Ok(LookupFileResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -1591,52 +1592,50 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_post(&self, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work", self.base_path);
+ fn lookup_release(&self, param_doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_doi = format!("doi={doi}&", doi = param_doi.to_string());
- let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
+ 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::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::WORK_POST.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<WorkPostResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<LookupReleaseResponse, 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::ReleaseEntity>(&buf)?;
- Ok(WorkPostResponse::CreatedEntity(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(WorkPostResponse::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(WorkPostResponse::NotFound(body))
+ Ok(LookupReleaseResponse::NotFound(body))
}
0 => {
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(WorkPostResponse::GenericError(body))
+ Ok(LookupReleaseResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index 1a46fbeb..d16644ab 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -33,11 +33,11 @@ mod mimetypes;
pub use swagger::{ApiError, Context, ContextWrapper};
#[derive(Debug, PartialEq)]
-pub enum ContainerBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum AcceptEditgroupResponse {
+ /// Merged Successfully
+ MergedSuccessfully(models::Success),
+ /// Unmergable
+ Unmergable(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -45,9 +45,9 @@ pub enum ContainerBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerIdGetResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum CreateContainerResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -57,9 +57,9 @@ pub enum ContainerIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerLookupGetResponse {
- /// Found Entity
- FoundEntity(models::ContainerEntity),
+pub enum CreateContainerBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -69,7 +69,7 @@ pub enum ContainerLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ContainerPostResponse {
+pub enum CreateCreatorResponse {
/// Created Entity
CreatedEntity(models::EntityEdit),
/// Bad Request
@@ -81,7 +81,7 @@ pub enum ContainerPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorBatchPostResponse {
+pub enum CreateCreatorBatchResponse {
/// Created Entities
CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
@@ -93,21 +93,19 @@ pub enum CreatorBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorIdGetResponse {
- /// Found Entity
- FoundEntity(models::CreatorEntity),
+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 CreatorLookupGetResponse {
- /// Found Entity
- FoundEntity(models::CreatorEntity),
+pub enum CreateFileResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -117,9 +115,9 @@ pub enum CreatorLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum CreatorPostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum CreateFileBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -129,11 +127,11 @@ pub enum CreatorPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupIdAcceptPostResponse {
- /// Merged Successfully
- MergedSuccessfully(models::Success),
- /// Unmergable
- Unmergable(models::ErrorResponse),
+pub enum CreateReleaseResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -141,9 +139,9 @@ pub enum EditgroupIdAcceptPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupIdGetResponse {
- /// Found Entity
- FoundEntity(models::Editgroup),
+pub enum CreateReleaseBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -153,19 +151,23 @@ pub enum EditgroupIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditgroupPostResponse {
- /// Successfully Created
- SuccessfullyCreated(models::Editgroup),
+pub enum CreateWorkResponse {
+ /// Created Entity
+ CreatedEntity(models::EntityEdit),
/// Bad Request
BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
/// Generic Error
GenericError(models::ErrorResponse),
}
#[derive(Debug, PartialEq)]
-pub enum EditorUsernameChangelogGetResponse {
- /// Found Merged Changes
- FoundMergedChanges(models::Changelogentries),
+pub enum CreateWorkBatchResponse {
+ /// Created Entities
+ CreatedEntities(Vec<models::EntityEdit>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -173,9 +175,11 @@ pub enum EditorUsernameChangelogGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum EditorUsernameGetResponse {
- /// Found Editor
- FoundEditor(models::Editor),
+pub enum GetContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -183,9 +187,9 @@ pub enum EditorUsernameGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -195,9 +199,9 @@ pub enum FileBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileIdGetResponse {
+pub enum GetEditgroupResponse {
/// Found Entity
- FoundEntity(models::FileEntity),
+ FoundEntity(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -207,11 +211,9 @@ pub enum FileIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FileLookupGetResponse {
- /// Found Entity
- FoundEntity(models::FileEntity),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum GetEditorResponse {
+ /// Found Editor
+ FoundEditor(models::Editor),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -219,11 +221,9 @@ pub enum FileLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum FilePostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
- /// Bad Request
- BadRequest(models::ErrorResponse),
+pub enum GetEditorChangelogResponse {
+ /// Found Merged Changes
+ FoundMergedChanges(models::Changelogentries),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -231,9 +231,9 @@ pub enum FilePostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum GetFileResponse {
+ /// Found Entity
+ FoundEntity(models::FileEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -243,7 +243,7 @@ pub enum ReleaseBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseIdGetResponse {
+pub enum GetReleaseResponse {
/// Found Entity
FoundEntity(models::ReleaseEntity),
/// Bad Request
@@ -255,9 +255,9 @@ pub enum ReleaseIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleaseLookupGetResponse {
+pub enum GetWorkResponse {
/// Found Entity
- FoundEntity(models::ReleaseEntity),
+ FoundEntity(models::WorkEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -267,9 +267,9 @@ pub enum ReleaseLookupGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum ReleasePostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum LookupContainerResponse {
+ /// Found Entity
+ FoundEntity(models::ContainerEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -279,9 +279,9 @@ pub enum ReleasePostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkBatchPostResponse {
- /// Created Entities
- CreatedEntities(Vec<models::EntityEdit>),
+pub enum LookupCreatorResponse {
+ /// Found Entity
+ FoundEntity(models::CreatorEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -291,9 +291,9 @@ pub enum WorkBatchPostResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkIdGetResponse {
+pub enum LookupFileResponse {
/// Found Entity
- FoundEntity(models::WorkEntity),
+ FoundEntity(models::FileEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -303,9 +303,9 @@ pub enum WorkIdGetResponse {
}
#[derive(Debug, PartialEq)]
-pub enum WorkPostResponse {
- /// Created Entity
- CreatedEntity(models::EntityEdit),
+pub enum LookupReleaseResponse {
+ /// Found Entity
+ FoundEntity(models::ReleaseEntity),
/// Bad Request
BadRequest(models::ErrorResponse),
/// Not Found
@@ -316,104 +316,104 @@ pub enum WorkPostResponse {
/// API
pub trait Api {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send>;
+ fn accept_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn container_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
- fn container_lookup_get(&self, issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send>;
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn creator_id_get(&self, id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+ fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn creator_lookup_get(&self, orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
- fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
- fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
- fn editor_username_changelog_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn editor_username_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+ fn get_container(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send>;
+ fn get_creator(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
- fn file_id_get(&self, id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+ fn get_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
- fn file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+ fn get_editor(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn get_editor_changelog(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send>;
+ fn get_file(&self, id: String, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
- fn release_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+ fn get_release(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
- fn release_lookup_get(&self, doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+ fn get_work(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
- fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send>;
+ fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
- fn work_id_get(&self, id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+ fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
- fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
pub trait ApiNoContext {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send>;
+ fn accept_editgroup(&self, id: i64) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
- fn container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send>;
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send>;
- fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+ fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
- fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
- fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
- fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
- fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+ fn get_container(&self, id: String) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send>;
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send>;
+ fn get_creator(&self, id: String) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>;
- fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+ fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
- fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+ fn get_editor(&self, username: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn get_editor_changelog(&self, username: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send>;
+ fn get_file(&self, id: String) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send>;
- fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+ fn get_release(&self, id: String) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>;
- fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+ fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>;
- fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>;
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send>;
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>;
- fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+ fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send>;
- fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -432,100 +432,100 @@ impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T {
}
impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
- fn container_batch_post(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = ContainerBatchPostResponse, Error = ApiError> + Send> {
- self.api().container_batch_post(entity_list, &self.context())
+ fn accept_editgroup(&self, id: i64) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
+ self.api().accept_editgroup(id, &self.context())
}
- fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
- self.api().container_id_get(id, &self.context())
+ fn create_container(&self, entity: models::ContainerEntity) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ self.api().create_container(entity, &self.context())
}
- fn container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
- self.api().container_lookup_get(issnl, &self.context())
+ fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
+ self.api().create_container_batch(entity_list, &self.context())
}
- fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
- self.api().container_post(entity, &self.context())
+ fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ self.api().create_creator(entity, &self.context())
}
- fn creator_batch_post(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreatorBatchPostResponse, Error = ApiError> + Send> {
- self.api().creator_batch_post(entity_list, &self.context())
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ self.api().create_creator_batch(entity_list, &self.context())
}
- fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
- self.api().creator_id_get(id, &self.context())
+ fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ self.api().create_editgroup(entity, &self.context())
}
- fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
- self.api().creator_lookup_get(orcid, &self.context())
+ fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ self.api().create_file(entity, &self.context())
}
- fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
- self.api().creator_post(entity, &self.context())
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ self.api().create_file_batch(entity_list, &self.context())
}
- fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_id_accept_post(id, &self.context())
+ fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ self.api().create_release(entity, &self.context())
}
- fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
- self.api().editgroup_id_get(id, &self.context())
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ self.api().create_release_batch(entity_list, &self.context())
}
- fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_post(entity, &self.context())
+ fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ self.api().create_work(entity, &self.context())
}
- fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
- self.api().editor_username_changelog_get(username, &self.context())
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ self.api().create_work_batch(entity_list, &self.context())
}
- fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
- self.api().editor_username_get(username, &self.context())
+ fn get_container(&self, id: String) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
+ self.api().get_container(id, &self.context())
}
- fn file_batch_post(&self, entity_list: &Vec<models::FileEntity>) -> Box<Future<Item = FileBatchPostResponse, Error = ApiError> + Send> {
- self.api().file_batch_post(entity_list, &self.context())
+ fn get_creator(&self, id: String) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
+ self.api().get_creator(id, &self.context())
}
- fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
- self.api().file_id_get(id, &self.context())
+ fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
+ self.api().get_editgroup(id, &self.context())
}
- fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
- self.api().file_lookup_get(sha1, &self.context())
+ fn get_editor(&self, username: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ self.api().get_editor(username, &self.context())
}
- fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
- self.api().file_post(entity, &self.context())
+ fn get_editor_changelog(&self, username: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ self.api().get_editor_changelog(username, &self.context())
}
- fn release_batch_post(&self, entity_list: &Vec<models::ReleaseEntity>) -> Box<Future<Item = ReleaseBatchPostResponse, Error = ApiError> + Send> {
- self.api().release_batch_post(entity_list, &self.context())
+ fn get_file(&self, id: String) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
+ self.api().get_file(id, &self.context())
}
- fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
- self.api().release_id_get(id, &self.context())
+ fn get_release(&self, id: String) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
+ self.api().get_release(id, &self.context())
}
- fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
- self.api().release_lookup_get(doi, &self.context())
+ fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
+ self.api().get_work(id, &self.context())
}
- fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
- self.api().release_post(entity, &self.context())
+ fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ self.api().lookup_container(issnl, &self.context())
}
- fn work_batch_post(&self, entity_list: &Vec<models::WorkEntity>) -> Box<Future<Item = WorkBatchPostResponse, Error = ApiError> + Send> {
- self.api().work_batch_post(entity_list, &self.context())
+ fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ self.api().lookup_creator(orcid, &self.context())
}
- fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
- self.api().work_id_get(id, &self.context())
+ fn lookup_file(&self, sha1: String) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ self.api().lookup_file(sha1, &self.context())
}
- fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
- self.api().work_post(entity, &self.context())
+ fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ self.api().lookup_release(doi, &self.context())
}
}
diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs
index 7b85cac5..323f28f0 100644
--- a/rust/fatcat-api/src/mimetypes.rs
+++ b/rust/fatcat-api/src/mimetypes.rs
@@ -4,426 +4,426 @@ 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 ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_UNMERGABLE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref ACCEPT_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerBatchPost
+ /// Create Mime objects for the response content types for AcceptEditgroup
lazy_static! {
- pub static ref CONTAINER_BATCH_POST_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 ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerIdGet
+ /// Create Mime objects for the response content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerLookupGet
+ /// Create Mime objects for the response content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ContainerPost
+ /// Create Mime objects for the response content types for CreateCreator
lazy_static! {
- pub static ref CONTAINER_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_CREATED_ENTITIES: 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 CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_BAD_REQUEST: 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 CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_NOT_FOUND: 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 CreatorBatchPost
+ /// Create Mime objects for the response content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_BATCH_POST_GENERIC_ERROR: 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 CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_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 CreatorIdGet
+ /// Create Mime objects for the response content types for CreateEditgroup
lazy_static! {
- pub static ref CREATOR_ID_GET_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 CreatorIdGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFile
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for CreatorLookupGet
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR: 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 CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_CREATED_ENTITY: 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 CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_BAD_REQUEST: 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 CreatorPost
+ /// Create Mime objects for the response content types for CreateFileBatch
lazy_static! {
- pub static ref CREATOR_POST_NOT_FOUND: 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 CreatorPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref CREATOR_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_UNMERGABLE: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateRelease
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupIdAcceptPost
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR: 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 EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_FOUND_ENTITY: 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 EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_BAD_REQUEST: 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 EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateReleaseBatch
lazy_static! {
- pub static ref EDITGROUP_ID_GET_NOT_FOUND: 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 EditgroupIdGet
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_CREATED_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_SUCCESSFULLY_CREATED: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditgroupPost
+ /// Create Mime objects for the response content types for CreateWork
lazy_static! {
- pub static ref EDITGROUP_POST_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 EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES: 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 EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND: 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 EditorUsernameChangelogGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR: 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 EditorUsernameGet
+ /// Create Mime objects for the response content types for CreateWorkBatch
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_FOUND_EDITOR: 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 EditorUsernameGet
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for EditorUsernameGet
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref EDITOR_USERNAME_GET_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 FileBatchPost
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref FILE_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref GET_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileBatchPost
+ /// Create Mime objects for the response content types for GetContainer
lazy_static! {
- pub static ref FILE_BATCH_POST_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 FileBatchPost
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_BATCH_POST_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 FileBatchPost
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_BATCH_POST_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 FileIdGet
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_ID_GET_FOUND_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 FileIdGet
+ /// Create Mime objects for the response content types for GetCreator
lazy_static! {
- pub static ref FILE_ID_GET_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 FileIdGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileIdGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditgroup
lazy_static! {
- pub static ref FILE_LOOKUP_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_FOUND_EDITOR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FileLookupGet
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_LOOKUP_GET_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 FilePost
+ /// Create Mime objects for the response content types for GetEditor
lazy_static! {
- pub static ref FILE_POST_CREATED_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 FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_NOT_FOUND: 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 FilePost
+ /// Create Mime objects for the response content types for GetEditorChangelog
lazy_static! {
- pub static ref FILE_POST_GENERIC_ERROR: 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 ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseBatchPost
+ /// Create Mime objects for the response content types for GetFile
lazy_static! {
- pub static ref RELEASE_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref GET_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_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 ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_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 ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_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 ReleaseIdGet
+ /// Create Mime objects for the response content types for GetRelease
lazy_static! {
- pub static ref RELEASE_ID_GET_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 ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_FOUND_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 ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_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 ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_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 ReleaseLookupGet
+ /// Create Mime objects for the response content types for GetWork
lazy_static! {
- pub static ref RELEASE_LOOKUP_GET_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 ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for ReleasePost
+ /// Create Mime objects for the response content types for LookupContainer
lazy_static! {
- pub static ref RELEASE_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CONTAINER_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_CREATED_ENTITIES: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkBatchPost
+ /// Create Mime objects for the response content types for LookupCreator
lazy_static! {
- pub static ref WORK_BATCH_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_CREATOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_NOT_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 WorkIdGet
+ /// Create Mime objects for the response content types for LookupFile
lazy_static! {
- pub static ref WORK_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_FILE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_CREATED_ENTITY: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_BAD_REQUEST: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for WorkPost
+ /// Create Mime objects for the response content types for LookupRelease
lazy_static! {
- pub static ref WORK_POST_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref LOOKUP_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json);
}
}
pub mod requests {
use hyper::mime::*;
- /// Create Mime objects for the request content types for ContainerBatchPost
+ /// Create Mime objects for the request content types for CreateContainer
lazy_static! {
- pub static ref CONTAINER_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ContainerPost
+ /// Create Mime objects for the request content types for CreateContainerBatch
lazy_static! {
- pub static ref CONTAINER_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CONTAINER_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for CreatorBatchPost
+ /// Create Mime objects for the request content types for CreateCreator
lazy_static! {
- pub static ref CREATOR_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for CreatorPost
+ /// Create Mime objects for the request content types for CreateCreatorBatch
lazy_static! {
- pub static ref CREATOR_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_CREATOR_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for EditgroupPost
+ /// Create Mime objects for the request content types for CreateEditgroup
lazy_static! {
- pub static ref EDITGROUP_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for FileBatchPost
+ /// Create Mime objects for the request content types for CreateFile
lazy_static! {
- pub static ref FILE_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for FilePost
+ /// Create Mime objects for the request content types for CreateFileBatch
lazy_static! {
- pub static ref FILE_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_FILE_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ReleaseBatchPost
+ /// Create Mime objects for the request content types for CreateRelease
lazy_static! {
- pub static ref RELEASE_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for ReleasePost
+ /// Create Mime objects for the request content types for CreateReleaseBatch
lazy_static! {
- pub static ref RELEASE_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_RELEASE_BATCH: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for WorkBatchPost
+ /// Create Mime objects for the request content types for CreateWork
lazy_static! {
- pub static ref WORK_BATCH_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the request content types for WorkPost
+ /// Create Mime objects for the request content types for CreateWorkBatch
lazy_static! {
- pub static ref WORK_POST: Mime = mime!(Application / Json);
+ pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json);
}
}
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index 0db2c445..3e003783 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -36,10 +36,9 @@ use swagger::{ApiError, Context, XSpanId};
#[allow(unused_imports)]
use models;
-use {Api, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, CreatorBatchPostResponse, CreatorIdGetResponse, CreatorLookupGetResponse,
- CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, EditorUsernameGetResponse, FileBatchPostResponse,
- FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, ReleasePostResponse, WorkBatchPostResponse,
- WorkIdGetResponse, WorkPostResponse};
+use {AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse,
+ CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerResponse, GetCreatorResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse};
header! { (Warning, "Warning") => [String] }
@@ -88,7 +87,7 @@ where
{
let api_clone = api.clone();
router.post(
- "/v0/container/batch",
+ "/v0/editgroup/:id/accept",
move |req: &mut Request| {
let mut context = Context::default();
@@ -101,78 +100,60 @@ 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_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::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 {
- None
+ // 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_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.container_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.accept_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- ContainerBatchPostResponse::CreatedEntities(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(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_CREATED_ENTITIES.clone()));
+ 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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ContainerBatchPostResponse::BadRequest(body) => {
+ AcceptEditgroupResponse::Unmergable(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::CONTAINER_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::ACCEPT_EDITGROUP_UNMERGABLE.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)
}
- ContainerBatchPostResponse::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::CONTAINER_BATCH_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- ContainerBatchPostResponse::GenericError(body) => {
+ 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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_BATCH_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -189,12 +170,12 @@ where
Ok(response)
})
},
- "ContainerBatchPost",
+ "AcceptEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/:id",
+ router.post(
+ "/v0/container",
move |req: &mut Request| {
let mut context = Context::default();
@@ -207,60 +188,78 @@ 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.
+
+ 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::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 {
+ None
};
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_id_get(param_id, context).wait() {
+ match api.create_container(param_entity, context).wait() {
Ok(rsp) => match rsp {
- ContainerIdGetResponse::FoundEntity(body) => {
+ CreateContainerResponse::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::CONTAINER_ID_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_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)
}
- ContainerIdGetResponse::BadRequest(body) => {
+ CreateContainerResponse::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::CONTAINER_ID_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_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)
}
- ContainerIdGetResponse::NotFound(body) => {
+ CreateContainerResponse::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::CONTAINER_ID_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_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)
}
- ContainerIdGetResponse::GenericError(body) => {
+ CreateContainerResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_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)
}
},
@@ -277,12 +276,12 @@ where
Ok(response)
})
},
- "ContainerIdGet",
+ "CreateContainer",
);
let api_clone = api.clone();
- router.get(
- "/v0/container/lookup",
+ router.post(
+ "/v0/container/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -295,56 +294,78 @@ 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_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))))?;
+ // 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::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 {
+ 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.container_lookup_get(param_issnl, context).wait() {
+ match api.create_container_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- ContainerLookupGetResponse::FoundEntity(body) => {
+ CreateContainerBatchResponse::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::CONTAINER_LOOKUP_GET_FOUND_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_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)
}
- ContainerLookupGetResponse::BadRequest(body) => {
+ CreateContainerBatchResponse::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::CONTAINER_LOOKUP_GET_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_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)
}
- ContainerLookupGetResponse::NotFound(body) => {
+ CreateContainerBatchResponse::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::CONTAINER_LOOKUP_GET_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_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)
}
- ContainerLookupGetResponse::GenericError(body) => {
+ CreateContainerBatchResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_CONTAINER_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)
}
},
@@ -361,12 +382,12 @@ where
Ok(response)
})
},
- "ContainerLookupGet",
+ "CreateContainerBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/container",
+ "/v0/creator",
move |req: &mut Request| {
let mut context = Context::default();
@@ -391,7 +412,7 @@ 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> =
+ let param_entity: Option<models::CreatorEntity> =
serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
@@ -403,13 +424,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_post(param_entity, context).wait() {
+ match api.create_creator(param_entity, context).wait() {
Ok(rsp) => match rsp {
- ContainerPostResponse::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::CONTAINER_POST_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() {
@@ -417,11 +438,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::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::CONTAINER_POST_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() {
@@ -429,11 +450,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::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::CONTAINER_POST_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() {
@@ -441,11 +462,11 @@ where
}
Ok(response)
}
- ContainerPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_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() {
@@ -467,7 +488,7 @@ where
Ok(response)
})
},
- "ContainerPost",
+ "CreateCreator",
);
let api_clone = api.clone();
@@ -509,13 +530,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.creator_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.create_creator_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- CreatorBatchPostResponse::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::CREATOR_BATCH_POST_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() {
@@ -523,11 +544,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::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::CREATOR_BATCH_POST_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() {
@@ -535,11 +556,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::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::CREATOR_BATCH_POST_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() {
@@ -547,11 +568,11 @@ where
}
Ok(response)
}
- CreatorBatchPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_BATCH_POST_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() {
@@ -573,12 +594,12 @@ where
Ok(response)
})
},
- "CreatorBatchPost",
+ "CreateCreatorBatch",
);
let api_clone = api.clone();
- router.get(
- "/v0/creator/:id",
+ router.post(
+ "/v0/editgroup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -591,60 +612,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))))?
- };
+ // 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.creator_id_get(param_id, context).wait() {
- Ok(rsp) => match rsp {
- CreatorIdGetResponse::FoundEntity(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::CREATOR_ID_GET_FOUND_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)
- }
- CreatorIdGetResponse::BadRequest(body) => {
+ 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))))?;
+
+ 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_editgroup(param_entity, 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::CREATOR_ID_GET_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)
}
- CreatorIdGetResponse::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::CREATOR_ID_GET_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)
}
- CreatorIdGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_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)
}
},
@@ -661,12 +687,12 @@ where
Ok(response)
})
},
- "CreatorIdGet",
+ "CreateEditgroup",
);
let api_clone = api.clone();
- router.get(
- "/v0/creator/lookup",
+ router.post(
+ "/v0/file",
move |req: &mut Request| {
let mut context = Context::default();
@@ -679,56 +705,78 @@ 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))))?;
+ // 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.creator_lookup_get(param_orcid, context).wait() {
+ match api.create_file(param_entity, context).wait() {
Ok(rsp) => match rsp {
- CreatorLookupGetResponse::FoundEntity(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::CREATOR_LOOKUP_GET_FOUND_ENTITY.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)
}
- CreatorLookupGetResponse::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::CREATOR_LOOKUP_GET_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)
}
- CreatorLookupGetResponse::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::CREATOR_LOOKUP_GET_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)
}
- CreatorLookupGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_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)
}
},
@@ -745,12 +793,12 @@ where
Ok(response)
})
},
- "CreatorLookupGet",
+ "CreateFile",
);
let api_clone = api.clone();
router.post(
- "/v0/creator",
+ "/v0/file/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -767,33 +815,33 @@ where
// 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 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 = 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> =
+ 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 - doesn't match schema: {}", e))))?;
+ }).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.creator_post(param_entity, context).wait() {
+ match api.create_file_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- CreatorPostResponse::CreatedEntity(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(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_CREATED_ENTITY.clone()));
+ 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() {
@@ -801,11 +849,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::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::CREATOR_POST_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() {
@@ -813,11 +861,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::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::CREATOR_POST_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() {
@@ -825,11 +873,11 @@ where
}
Ok(response)
}
- CreatorPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_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() {
@@ -851,12 +899,12 @@ where
Ok(response)
})
},
- "CreatorPost",
+ "CreateFileBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/editgroup/:id/accept",
+ "/v0/release",
move |req: &mut Request| {
let mut context = Context::default();
@@ -869,60 +917,78 @@ 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.
+
+ 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.editgroup_id_accept_post(param_id, context).wait() {
+ match api.create_release(param_entity, context).wait() {
Ok(rsp) => match rsp {
- EditgroupIdAcceptPostResponse::MergedSuccessfully(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::EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY.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)
}
- EditgroupIdAcceptPostResponse::Unmergable(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::EDITGROUP_ID_ACCEPT_POST_UNMERGABLE.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)
}
- EditgroupIdAcceptPostResponse::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::EDITGROUP_ID_ACCEPT_POST_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)
}
- EditgroupIdAcceptPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_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)
}
},
@@ -939,12 +1005,12 @@ where
Ok(response)
})
},
- "EditgroupIdAcceptPost",
+ "CreateRelease",
);
let api_clone = api.clone();
- router.get(
- "/v0/editgroup/:id",
+ router.post(
+ "/v0/release/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -957,60 +1023,78 @@ 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.
+
+ 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::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))))?;
+
+ 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.editgroup_id_get(param_id, context).wait() {
+ match api.create_release_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- EditgroupIdGetResponse::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::EDITGROUP_ID_GET_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)
}
- EditgroupIdGetResponse::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::EDITGROUP_ID_GET_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)
}
- EditgroupIdGetResponse::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::EDITGROUP_ID_GET_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)
}
- EditgroupIdGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_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)
}
},
@@ -1027,12 +1111,12 @@ where
Ok(response)
})
},
- "EditgroupIdGet",
+ "CreateReleaseBatch",
);
let api_clone = api.clone();
router.post(
- "/v0/editgroup",
+ "/v0/work",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1057,10 +1141,11 @@ 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::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 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 {
@@ -1068,13 +1153,13 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.editgroup_post(param_entity, context).wait() {
+ match api.create_work(param_entity, context).wait() {
Ok(rsp) => match rsp {
- EditgroupPostResponse::SuccessfullyCreated(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(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_SUCCESSFULLY_CREATED.clone()));
+ 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() {
@@ -1082,11 +1167,11 @@ where
}
Ok(response)
}
- EditgroupPostResponse::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::EDITGROUP_POST_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() {
@@ -1094,11 +1179,23 @@ where
}
Ok(response)
}
- EditgroupPostResponse::GenericError(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::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)
+ }
+ 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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_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() {
@@ -1120,12 +1217,12 @@ where
Ok(response)
})
},
- "EditgroupPost",
+ "CreateWork",
);
let api_clone = api.clone();
- router.get(
- "/v0/editor/:username/changelog",
+ router.post(
+ "/v0/work/batch",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1138,50 +1235,78 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
- // Path parameters
- let param_username = {
- let param = req.extensions
- .get::<Router>()
- .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("username")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".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 username: {}", 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.
+
+ 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())))?;
- match api.editor_username_changelog_get(param_username, context).wait() {
+ match api.create_work_batch(param_entity_list.as_ref(), context).wait() {
Ok(rsp) => match rsp {
- EditorUsernameChangelogGetResponse::FoundMergedChanges(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::EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES.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() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ 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::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() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditorUsernameChangelogGetResponse::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::EDITOR_USERNAME_CHANGELOG_GET_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() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
- EditorUsernameChangelogGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_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() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -1198,12 +1323,12 @@ where
Ok(response)
})
},
- "EditorUsernameChangelogGet",
+ "CreateWorkBatch",
);
let api_clone = api.clone();
router.get(
- "/v0/editor/:username",
+ "/v0/container/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1217,46 +1342,56 @@ where
context.authorization = req.extensions.remove::<Authorization>();
// Path parameters
- let param_username = {
+ let param_id = {
let param = req.extensions
.get::<Router>()
.ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
- .find("username")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".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 username: {}", e))))?
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.editor_username_get(param_username, context).wait() {
+ match api.get_container(param_id, context).wait() {
Ok(rsp) => match rsp {
- EditorUsernameGetResponse::FoundEditor(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(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_FOUND_EDITOR.clone()));
+ 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())));
Ok(response)
}
- EditorUsernameGetResponse::NotFound(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::GET_CONTAINER_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ 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::EDITOR_USERNAME_GET_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())));
Ok(response)
}
- EditorUsernameGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_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())));
@@ -1276,12 +1411,12 @@ where
Ok(response)
})
},
- "EditorUsernameGet",
+ "GetContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/file/batch",
+ router.get(
+ "/v0/creator/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1294,78 +1429,60 @@ 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_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
+ // 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_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.file_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.get_creator(param_id, context).wait() {
Ok(rsp) => match rsp {
- FileBatchPostResponse::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::FILE_BATCH_POST_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)
}
- FileBatchPostResponse::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::FILE_BATCH_POST_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)
}
- FileBatchPostResponse::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::FILE_BATCH_POST_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)
}
- FileBatchPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_BATCH_POST_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)
}
},
@@ -1382,12 +1499,12 @@ where
Ok(response)
})
},
- "FileBatchPost",
+ "GetCreator",
);
let api_clone = api.clone();
router.get(
- "/v0/file/:id",
+ "/v0/editgroup/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1414,43 +1531,43 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.file_id_get(param_id, context).wait() {
+ match api.get_editgroup(param_id, context).wait() {
Ok(rsp) => match rsp {
- FileIdGetResponse::FoundEntity(body) => {
+ GetEditgroupResponse::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::FILE_ID_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_FOUND_ENTITY.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileIdGetResponse::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::FILE_ID_GET_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)
}
- FileIdGetResponse::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::FILE_ID_GET_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)
}
- FileIdGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_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())));
@@ -1470,12 +1587,12 @@ where
Ok(response)
})
},
- "FileIdGet",
+ "GetEditgroup",
);
let api_clone = api.clone();
router.get(
- "/v0/file/lookup",
+ "/v0/editor/:username",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1488,53 +1605,47 @@ 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_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))))?;
+ // Path parameters
+ let param_username = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("username")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".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 username: {}", e))))?
+ };
- match api.file_lookup_get(param_sha1, context).wait() {
+ match api.get_editor(param_username, context).wait() {
Ok(rsp) => match rsp {
- FileLookupGetResponse::FoundEntity(body) => {
+ GetEditorResponse::FoundEditor(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::FILE_LOOKUP_GET_FOUND_ENTITY.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_FOUND_EDITOR.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- FileLookupGetResponse::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::FILE_LOOKUP_GET_BAD_REQUEST.clone()));
-
- context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
-
- Ok(response)
- }
- FileLookupGetResponse::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::FILE_LOOKUP_GET_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)
}
- FileLookupGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_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())));
@@ -1554,12 +1665,12 @@ where
Ok(response)
})
},
- "FileLookupGet",
+ "GetEditor",
);
let api_clone = api.clone();
- router.post(
- "/v0/file",
+ router.get(
+ "/v0/editor/:username/changelog",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1572,78 +1683,50 @@ 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))))?;
-
- 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
+ // Path parameters
+ let param_username = {
+ let param = req.extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("username")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter username".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 username: {}", e))))?
};
- let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.file_post(param_entity, context).wait() {
+ match api.get_editor_changelog(param_username, context).wait() {
Ok(rsp) => match rsp {
- FilePostResponse::CreatedEntity(body) => {
+ GetEditorChangelogResponse::FoundMergedChanges(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::FILE_POST_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_FOUND_MERGED_CHANGES.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)
- }
- FilePostResponse::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::FILE_POST_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)
}
- FilePostResponse::NotFound(body) => {
+ 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::FILE_POST_NOT_FOUND.clone()));
+ 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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- FilePostResponse::GenericError(body) => {
+ 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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::FILE_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -1660,12 +1743,12 @@ where
Ok(response)
})
},
- "FilePost",
+ "GetEditorChangelog",
);
let api_clone = api.clone();
- router.post(
- "/v0/release/batch",
+ router.get(
+ "/v0/file/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1678,78 +1761,60 @@ 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_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::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))))?;
-
- param_entity_list
- } else {
- None
+ // 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_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?;
- match api.release_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.get_file(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseBatchPostResponse::CreatedEntities(body) => {
+ GetFileResponse::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::RELEASE_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_FILE_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)
}
- ReleaseBatchPostResponse::BadRequest(body) => {
+ GetFileResponse::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::RELEASE_BATCH_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_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)
}
- ReleaseBatchPostResponse::NotFound(body) => {
+ GetFileResponse::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::RELEASE_BATCH_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_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)
}
- ReleaseBatchPostResponse::GenericError(body) => {
+ GetFileResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_BATCH_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_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)
}
},
@@ -1766,7 +1831,7 @@ where
Ok(response)
})
},
- "ReleaseBatchPost",
+ "GetFile",
);
let api_clone = api.clone();
@@ -1798,43 +1863,43 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
- match api.release_id_get(param_id, context).wait() {
+ match api.get_release(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseIdGetResponse::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::RELEASE_ID_GET_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)
}
- ReleaseIdGetResponse::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::RELEASE_ID_GET_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)
}
- ReleaseIdGetResponse::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::RELEASE_ID_GET_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)
}
- ReleaseIdGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_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())));
@@ -1854,12 +1919,12 @@ where
Ok(response)
})
},
- "ReleaseIdGet",
+ "GetRelease",
);
let api_clone = api.clone();
router.get(
- "/v0/release/lookup",
+ "/v0/work/:id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1872,53 +1937,57 @@ 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_doi = query_params
- .get("doi")
- .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter doi".to_string())))?
- .first()
- .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))?
- .parse::<String>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?;
+ // 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.release_lookup_get(param_doi, context).wait() {
+ match api.get_work(param_id, context).wait() {
Ok(rsp) => match rsp {
- ReleaseLookupGetResponse::FoundEntity(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::RELEASE_LOOKUP_GET_FOUND_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())));
Ok(response)
}
- ReleaseLookupGetResponse::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::RELEASE_LOOKUP_GET_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())));
Ok(response)
}
- ReleaseLookupGetResponse::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::RELEASE_LOOKUP_GET_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())));
Ok(response)
}
- ReleaseLookupGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_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())));
@@ -1938,12 +2007,12 @@ where
Ok(response)
})
},
- "ReleaseLookupGet",
+ "GetWork",
);
let api_clone = api.clone();
- router.post(
- "/v0/release",
+ router.get(
+ "/v0/container/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -1956,78 +2025,56 @@ 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))))?;
-
- 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())))?;
+ // 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))))?;
- match api.release_post(param_entity, context).wait() {
+ match api.lookup_container(param_issnl, context).wait() {
Ok(rsp) => match rsp {
- ReleasePostResponse::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::RELEASE_POST_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)
}
- ReleasePostResponse::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::RELEASE_POST_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)
}
- ReleasePostResponse::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::RELEASE_POST_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)
}
- ReleasePostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_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)
}
},
@@ -2044,12 +2091,12 @@ where
Ok(response)
})
},
- "ReleasePost",
+ "LookupContainer",
);
let api_clone = api.clone();
- router.post(
- "/v0/work/batch",
+ router.get(
+ "/v0/creator/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2062,78 +2109,56 @@ 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_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())))?;
+ // 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))))?;
- match api.work_batch_post(param_entity_list.as_ref(), context).wait() {
+ match api.lookup_creator(param_orcid, context).wait() {
Ok(rsp) => match rsp {
- WorkBatchPostResponse::CreatedEntities(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(201), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_CREATED_ENTITIES.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ 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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::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::WORK_BATCH_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::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::WORK_BATCH_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
- WorkBatchPostResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_BATCH_POST_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())));
- if !unused_elements.is_empty() {
- response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
- }
+
Ok(response)
}
},
@@ -2150,12 +2175,12 @@ where
Ok(response)
})
},
- "WorkBatchPost",
+ "LookupCreator",
);
let api_clone = api.clone();
router.get(
- "/v0/work/:id",
+ "/v0/file/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2168,57 +2193,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_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.work_id_get(param_id, context).wait() {
+ match api.lookup_file(param_sha1, context).wait() {
Ok(rsp) => match rsp {
- WorkIdGetResponse::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::WORK_ID_GET_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)
}
- WorkIdGetResponse::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::WORK_ID_GET_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)
}
- WorkIdGetResponse::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::WORK_ID_GET_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)
}
- WorkIdGetResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_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())));
@@ -2238,12 +2259,12 @@ where
Ok(response)
})
},
- "WorkIdGet",
+ "LookupFile",
);
let api_clone = api.clone();
- router.post(
- "/v0/work",
+ router.get(
+ "/v0/release/lookup",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2256,78 +2277,56 @@ 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))))?;
-
- 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())))?;
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_doi = query_params
+ .get("doi")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing required query parameter doi".to_string())))?
+ .first()
+ .ok_or_else(|| Response::with((status::BadRequest, "Required query parameter doi was empty".to_string())))?
+ .parse::<String>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse query parameter doi - doesn't match schema: {}", e))))?;
- match api.work_post(param_entity, context).wait() {
+ match api.lookup_release(param_doi, context).wait() {
Ok(rsp) => match rsp {
- WorkPostResponse::CreatedEntity(body) => {
+ LookupReleaseResponse::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::WORK_POST_CREATED_ENTITY.clone()));
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_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)
}
- WorkPostResponse::BadRequest(body) => {
+ LookupReleaseResponse::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::WORK_POST_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_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)
}
- WorkPostResponse::NotFound(body) => {
+ LookupReleaseResponse::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::WORK_POST_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_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)
}
- WorkPostResponse::GenericError(body) => {
+ LookupReleaseResponse::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(0), body_string));
- response.headers.set(ContentType(mimetypes::responses::WORK_POST_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::LOOKUP_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)
}
},
@@ -2344,7 +2343,7 @@ where
Ok(response)
})
},
- "WorkPost",
+ "LookupRelease",
);
}