diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 22:19:04 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-15 22:19:04 -0700 |
commit | 6a3ca56b19de64a985f962196050cabf16a6722c (patch) | |
tree | 0fa0eebca6c87ba2669c2f524ec2ed14455a5ac4 /rust/fatcat-api | |
parent | 92a911e394c5fad7e7ebb1139abd50fd87450a81 (diff) | |
download | fatcat-6a3ca56b19de64a985f962196050cabf16a6722c.tar.gz fatcat-6a3ca56b19de64a985f962196050cabf16a6722c.zip |
regenerate API
Diffstat (limited to 'rust/fatcat-api')
-rw-r--r-- | rust/fatcat-api/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api/api.yaml | 85 | ||||
-rw-r--r-- | rust/fatcat-api/api/swagger.yaml | 410 | ||||
-rw-r--r-- | rust/fatcat-api/src/client.rs | 164 | ||||
-rw-r--r-- | rust/fatcat-api/src/lib.rs | 238 | ||||
-rw-r--r-- | rust/fatcat-api/src/mimetypes.rs | 134 | ||||
-rw-r--r-- | rust/fatcat-api/src/server.rs | 310 |
7 files changed, 827 insertions, 516 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index fcbb82f5..deb2c8a5 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-16T04:14:32.903Z +- Build date: 2018-05-16T05:18:32.538Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml index abf09a10..195f23fe 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -144,6 +144,7 @@ definitions: type: integer editor_id: type: integer + # TODO: work_edits array, etc. ["edits"]["work"] or ["work_edits"]? changelogentry: type: object required: @@ -159,11 +160,15 @@ definitions: x-entity-responses: &ENTITYRESPONSES 400: - description: bad request + description: Bad Request + schema: + $ref: "#/definitions/error" + 404: + description: Not Found schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" @@ -178,7 +183,7 @@ paths: $ref: "#/definitions/creator_entity" responses: 201: - description: created + description: Created Entity schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES @@ -191,7 +196,7 @@ paths: get: responses: 200: - description: fetch a single creator by id + description: Found Entity schema: $ref: "#/definitions/creator_entity" <<: *ENTITYRESPONSES @@ -204,13 +209,9 @@ paths: required: true responses: 200: - description: find a single creator by external identifer + description: Found Entity schema: $ref: "#/definitions/creator_entity" - 404: - description: no such creator - schema: - $ref: "#/definitions/error" <<: *ENTITYRESPONSES /container: post: @@ -222,7 +223,7 @@ paths: $ref: "#/definitions/container_entity" responses: 201: - description: created + description: Created Entity schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES @@ -235,7 +236,7 @@ paths: get: responses: 200: - description: fetch a single container by id + description: Found Entity schema: $ref: "#/definitions/container_entity" <<: *ENTITYRESPONSES @@ -248,13 +249,9 @@ paths: required: true responses: 200: - description: find a single container by external identifer + description: Found Entity schema: $ref: "#/definitions/container_entity" - 404: - description: no such container - schema: - $ref: "#/definitions/error" <<: *ENTITYRESPONSES /file: post: @@ -266,7 +263,7 @@ paths: $ref: "#/definitions/file_entity" responses: 201: - description: created + description: Created Entity schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES @@ -279,7 +276,7 @@ paths: get: responses: 200: - description: fetch a single file by id + description: Found Entity schema: $ref: "#/definitions/file_entity" <<: *ENTITYRESPONSES @@ -292,13 +289,9 @@ paths: required: true responses: 200: - description: find a single file by external identifer + description: Found Entity schema: $ref: "#/definitions/file_entity" - 404: - description: no such file - schema: - $ref: "#/definitions/error" <<: *ENTITYRESPONSES /release: post: @@ -310,7 +303,7 @@ paths: $ref: "#/definitions/release_entity" responses: 201: - description: created + description: Created Entity schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES @@ -323,7 +316,7 @@ paths: get: responses: 200: - description: fetch a single release by id + description: Found Entity schema: $ref: "#/definitions/release_entity" <<: *ENTITYRESPONSES @@ -336,13 +329,9 @@ paths: required: true responses: 200: - description: find a single release by external identifer + description: Found Entity schema: $ref: "#/definitions/release_entity" - 404: - description: no such release - schema: - $ref: "#/definitions/error" <<: *ENTITYRESPONSES /work: post: @@ -354,7 +343,7 @@ paths: $ref: "#/definitions/work_entity" responses: 201: - description: created + description: Created Entity schema: $ref: "#/definitions/entity_edit" <<: *ENTITYRESPONSES @@ -367,7 +356,7 @@ paths: get: responses: 200: - description: fetch a single work by id + description: Found Entity schema: $ref: "#/definitions/work_entity" <<: *ENTITYRESPONSES @@ -380,15 +369,15 @@ paths: get: responses: 200: - description: fetch generic information about an editor + description: Found Editor schema: $ref: "#/definitions/editor" 404: - description: username not found + description: Not Found schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" /editor/{username}/changelog: @@ -400,30 +389,30 @@ paths: get: responses: 200: - description: find changes (editgroups) by this editor which have been merged + description: Found Merged Changes schema: $ref: "#/definitions/changelogentry" 404: - description: username not found + description: Not Found schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" /editgroup: post: responses: 201: - description: successfully created + description: Successfully Created schema: $ref: "#/definitions/editgroup" 400: - description: invalid request parameters + description: Bad Request schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" /editgroup/{id}: @@ -435,15 +424,15 @@ paths: get: responses: 200: - description: fetch editgroup by identifier + description: Found Editgroup schema: $ref: "#/definitions/editgroup" 404: - description: no such editgroup + description: Not Found schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" /editgroup/{id}/accept: @@ -455,18 +444,18 @@ paths: post: responses: 200: - description: merged editgroup successfully ("live") + description: Merged Successfully schema: $ref: "#/definitions/success" 400: - description: editgroup is in an unmergable state + description: Unmergable schema: $ref: "#/definitions/error" 404: - description: no such editgroup + description: Not Found schema: $ref: "#/definitions/error" default: - description: generic error response + description: Generic Error schema: $ref: "#/definitions/error" diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index 8073f18d..8d8308fc 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -31,16 +31,16 @@ paths: consumesJson: true responses: 201: - description: "created" + description: "Created Entity" schema: $ref: "#/definitions/entity_edit" - x-responseId: "Created" - x-uppercaseResponseId: "CREATED" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" uppercase_operation_id: "CREATOR_POST" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -48,12 +48,21 @@ paths: uppercase_operation_id: "CREATOR_POST" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATOR_POST" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CREATOR_POST" uppercase_data_type: "ERROR" producesJson: true @@ -74,16 +83,16 @@ paths: example: "\"id_example\".to_string()" responses: 200: - description: "fetch a single creator by id" + description: "Found Entity" schema: $ref: "#/definitions/creator_entity" - x-responseId: "FetchASingleCreatorById" - x-uppercaseResponseId: "FETCH_A_SINGLE_CREATOR_BY_ID" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "CREATOR_ID_GET" uppercase_data_type: "CREATORENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -91,12 +100,21 @@ paths: uppercase_operation_id: "CREATOR_ID_GET" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATOR_ID_GET" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CREATOR_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -116,16 +134,16 @@ paths: example: "\"orcid_example\".to_string()" responses: 200: - description: "find a single creator by external identifer" + description: "Found Entity" schema: $ref: "#/definitions/creator_entity" - x-responseId: "FindASingleCreatorByExternalIdentifer" - x-uppercaseResponseId: "FIND_A_SINGLE_CREATOR_BY_EXTERNAL_IDENTIFER" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "CREATOR_LOOKUP_GET" uppercase_data_type: "CREATORENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -134,20 +152,20 @@ paths: uppercase_data_type: "ERROR" producesJson: true 404: - description: "no such creator" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchCreator" - x-uppercaseResponseId: "NO_SUCH_CREATOR" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "CREATOR_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CREATOR_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true @@ -173,16 +191,16 @@ paths: consumesJson: true responses: 201: - description: "created" + description: "Created Entity" schema: $ref: "#/definitions/entity_edit" - x-responseId: "Created" - x-uppercaseResponseId: "CREATED" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" uppercase_operation_id: "CONTAINER_POST" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -190,12 +208,21 @@ paths: uppercase_operation_id: "CONTAINER_POST" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CONTAINER_POST" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CONTAINER_POST" uppercase_data_type: "ERROR" producesJson: true @@ -216,16 +243,16 @@ paths: example: "\"id_example\".to_string()" responses: 200: - description: "fetch a single container by id" + description: "Found Entity" schema: $ref: "#/definitions/container_entity" - x-responseId: "FetchASingleContainerById" - x-uppercaseResponseId: "FETCH_A_SINGLE_CONTAINER_BY_ID" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "CONTAINER_ID_GET" uppercase_data_type: "CONTAINERENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -233,12 +260,21 @@ paths: uppercase_operation_id: "CONTAINER_ID_GET" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CONTAINER_ID_GET" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CONTAINER_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -258,16 +294,16 @@ paths: example: "\"issn_example\".to_string()" responses: 200: - description: "find a single container by external identifer" + description: "Found Entity" schema: $ref: "#/definitions/container_entity" - x-responseId: "FindASingleContainerByExternalIdentifer" - x-uppercaseResponseId: "FIND_A_SINGLE_CONTAINER_BY_EXTERNAL_IDENTIFER" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "CONTAINER_LOOKUP_GET" uppercase_data_type: "CONTAINERENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -276,20 +312,20 @@ paths: uppercase_data_type: "ERROR" producesJson: true 404: - description: "no such container" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchContainer" - x-uppercaseResponseId: "NO_SUCH_CONTAINER" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "CONTAINER_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "CONTAINER_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true @@ -315,16 +351,16 @@ paths: consumesJson: true responses: 201: - description: "created" + description: "Created Entity" schema: $ref: "#/definitions/entity_edit" - x-responseId: "Created" - x-uppercaseResponseId: "CREATED" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" uppercase_operation_id: "FILE_POST" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -332,12 +368,21 @@ paths: uppercase_operation_id: "FILE_POST" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "FILE_POST" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "FILE_POST" uppercase_data_type: "ERROR" producesJson: true @@ -358,16 +403,16 @@ paths: example: "\"id_example\".to_string()" responses: 200: - description: "fetch a single file by id" + description: "Found Entity" schema: $ref: "#/definitions/file_entity" - x-responseId: "FetchASingleFileById" - x-uppercaseResponseId: "FETCH_A_SINGLE_FILE_BY_ID" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "FILE_ID_GET" uppercase_data_type: "FILEENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -375,12 +420,21 @@ paths: uppercase_operation_id: "FILE_ID_GET" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "FILE_ID_GET" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "FILE_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -400,16 +454,16 @@ paths: example: "\"sha1_example\".to_string()" responses: 200: - description: "find a single file by external identifer" + description: "Found Entity" schema: $ref: "#/definitions/file_entity" - x-responseId: "FindASingleFileByExternalIdentifer" - x-uppercaseResponseId: "FIND_A_SINGLE_FILE_BY_EXTERNAL_IDENTIFER" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "FILE_LOOKUP_GET" uppercase_data_type: "FILEENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -418,20 +472,20 @@ paths: uppercase_data_type: "ERROR" producesJson: true 404: - description: "no such file" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchFile" - x-uppercaseResponseId: "NO_SUCH_FILE" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "FILE_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "FILE_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true @@ -457,16 +511,16 @@ paths: consumesJson: true responses: 201: - description: "created" + description: "Created Entity" schema: $ref: "#/definitions/entity_edit" - x-responseId: "Created" - x-uppercaseResponseId: "CREATED" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" uppercase_operation_id: "RELEASE_POST" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -474,12 +528,21 @@ paths: uppercase_operation_id: "RELEASE_POST" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "RELEASE_POST" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "RELEASE_POST" uppercase_data_type: "ERROR" producesJson: true @@ -500,16 +563,16 @@ paths: example: "\"id_example\".to_string()" responses: 200: - description: "fetch a single release by id" + description: "Found Entity" schema: $ref: "#/definitions/release_entity" - x-responseId: "FetchASingleReleaseById" - x-uppercaseResponseId: "FETCH_A_SINGLE_RELEASE_BY_ID" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "RELEASE_ID_GET" uppercase_data_type: "RELEASEENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -517,12 +580,21 @@ paths: uppercase_operation_id: "RELEASE_ID_GET" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "RELEASE_ID_GET" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "RELEASE_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -542,16 +614,16 @@ paths: example: "\"doi_example\".to_string()" responses: 200: - description: "find a single release by external identifer" + description: "Found Entity" schema: $ref: "#/definitions/release_entity" - x-responseId: "FindASingleReleaseByExternalIdentifer" - x-uppercaseResponseId: "FIND_A_SINGLE_RELEASE_BY_EXTERNAL_IDENTIFER" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "RELEASE_LOOKUP_GET" uppercase_data_type: "RELEASEENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -560,20 +632,20 @@ paths: uppercase_data_type: "ERROR" producesJson: true 404: - description: "no such release" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchRelease" - x-uppercaseResponseId: "NO_SUCH_RELEASE" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "RELEASE_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "RELEASE_LOOKUP_GET" uppercase_data_type: "ERROR" producesJson: true @@ -599,16 +671,16 @@ paths: consumesJson: true responses: 201: - description: "created" + description: "Created Entity" schema: $ref: "#/definitions/entity_edit" - x-responseId: "Created" - x-uppercaseResponseId: "CREATED" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" uppercase_operation_id: "WORK_POST" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -616,12 +688,21 @@ paths: uppercase_operation_id: "WORK_POST" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "WORK_POST" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "WORK_POST" uppercase_data_type: "ERROR" producesJson: true @@ -642,16 +723,16 @@ paths: example: "\"id_example\".to_string()" responses: 200: - description: "fetch a single work by id" + description: "Found Entity" schema: $ref: "#/definitions/work_entity" - x-responseId: "FetchASingleWorkById" - x-uppercaseResponseId: "FETCH_A_SINGLE_WORK_BY_ID" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" uppercase_operation_id: "WORK_ID_GET" uppercase_data_type: "WORKENTITY" producesJson: true 400: - description: "bad request" + description: "Bad Request" schema: $ref: "#/definitions/error" x-responseId: "BadRequest" @@ -659,12 +740,21 @@ paths: uppercase_operation_id: "WORK_ID_GET" uppercase_data_type: "ERROR" producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "WORK_ID_GET" + uppercase_data_type: "ERROR" + producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "WORK_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -684,29 +774,29 @@ paths: example: "\"username_example\".to_string()" responses: 200: - description: "fetch generic information about an editor" + description: "Found Editor" schema: $ref: "#/definitions/editor" - x-responseId: "FetchGenericInformationAboutAnEditor" - x-uppercaseResponseId: "FETCH_GENERIC_INFORMATION_ABOUT_AN_EDITOR" + x-responseId: "FoundEditor" + x-uppercaseResponseId: "FOUND_EDITOR" uppercase_operation_id: "EDITOR_USERNAME_GET" uppercase_data_type: "EDITOR" producesJson: true 404: - description: "username not found" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "UsernameNotFound" - x-uppercaseResponseId: "USERNAME_NOT_FOUND" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "EDITOR_USERNAME_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "EDITOR_USERNAME_GET" uppercase_data_type: "ERROR" producesJson: true @@ -726,29 +816,29 @@ paths: example: "\"username_example\".to_string()" responses: 200: - description: "find changes (editgroups) by this editor which have been merged" + description: "Found Merged Changes" schema: $ref: "#/definitions/changelogentry" - x-responseId: "FindChanges_" - x-uppercaseResponseId: "FIND_CHANGES_" + x-responseId: "FoundMergedChanges" + x-uppercaseResponseId: "FOUND_MERGED_CHANGES" uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET" uppercase_data_type: "CHANGELOGENTRY" producesJson: true 404: - description: "username not found" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "UsernameNotFound" - x-uppercaseResponseId: "USERNAME_NOT_FOUND" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "EDITOR_USERNAME_CHANGELOG_GET" uppercase_data_type: "ERROR" producesJson: true @@ -762,7 +852,7 @@ paths: parameters: [] responses: 201: - description: "successfully created" + description: "Successfully Created" schema: $ref: "#/definitions/editgroup" x-responseId: "SuccessfullyCreated" @@ -771,20 +861,20 @@ paths: uppercase_data_type: "EDITGROUP" producesJson: true 400: - description: "invalid request parameters" + description: "Bad Request" schema: $ref: "#/definitions/error" - x-responseId: "InvalidRequestParameters" - x-uppercaseResponseId: "INVALID_REQUEST_PARAMETERS" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" uppercase_operation_id: "EDITGROUP_POST" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "EDITGROUP_POST" uppercase_data_type: "ERROR" producesJson: true @@ -804,29 +894,29 @@ paths: example: "56" responses: 200: - description: "fetch editgroup by identifier" + description: "Found Editgroup" schema: $ref: "#/definitions/editgroup" - x-responseId: "FetchEditgroupByIdentifier" - x-uppercaseResponseId: "FETCH_EDITGROUP_BY_IDENTIFIER" + x-responseId: "FoundEditgroup" + x-uppercaseResponseId: "FOUND_EDITGROUP" uppercase_operation_id: "EDITGROUP_ID_GET" uppercase_data_type: "EDITGROUP" producesJson: true 404: - description: "no such editgroup" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchEditgroup" - x-uppercaseResponseId: "NO_SUCH_EDITGROUP" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "EDITGROUP_ID_GET" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "EDITGROUP_ID_GET" uppercase_data_type: "ERROR" producesJson: true @@ -846,38 +936,38 @@ paths: example: "56" responses: 200: - description: "merged editgroup successfully (\"live\")" + description: "Merged Successfully" schema: $ref: "#/definitions/success" - x-responseId: "MergedEditgroupSuccessfully_" - x-uppercaseResponseId: "MERGED_EDITGROUP_SUCCESSFULLY_" + x-responseId: "MergedSuccessfully" + x-uppercaseResponseId: "MERGED_SUCCESSFULLY" uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST" uppercase_data_type: "SUCCESS" producesJson: true 400: - description: "editgroup is in an unmergable state" + description: "Unmergable" schema: $ref: "#/definitions/error" - x-responseId: "EditgroupIsInAnUnmergableState" - x-uppercaseResponseId: "EDITGROUP_IS_IN_AN_UNMERGABLE_STATE" + x-responseId: "Unmergable" + x-uppercaseResponseId: "UNMERGABLE" uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST" uppercase_data_type: "ERROR" producesJson: true 404: - description: "no such editgroup" + description: "Not Found" schema: $ref: "#/definitions/error" - x-responseId: "NoSuchEditgroup" - x-uppercaseResponseId: "NO_SUCH_EDITGROUP" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST" uppercase_data_type: "ERROR" producesJson: true default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" - x-responseId: "GenericErrorResponse" - x-uppercaseResponseId: "GENERIC_ERROR_RESPONSE" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" uppercase_operation_id: "EDITGROUP_ID_ACCEPT_POST" uppercase_data_type: "ERROR" producesJson: true @@ -1173,10 +1263,14 @@ x-entity-edit-props: type: "integer" x-entity-responses: 400: - description: "bad request" + description: "Bad Request" + schema: + $ref: "#/definitions/error" + 404: + description: "Not Found" schema: $ref: "#/definitions/error" default: - description: "generic error response" + description: "Generic Error" schema: $ref: "#/definitions/error" diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs index 6666d6f4..f4b9e671 100644 --- a/rust/fatcat-api/src/client.rs +++ b/rust/fatcat-api/src/client.rs @@ -180,7 +180,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::ContainerEntity>(&buf)?; - Ok(ContainerIdGetResponse::FetchASingleContainerById(body)) + Ok(ContainerIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -189,12 +189,19 @@ impl Api for Client { Ok(ContainerIdGetResponse::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::Error>(&buf)?; + + Ok(ContainerIdGetResponse::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::Error>(&buf)?; - Ok(ContainerIdGetResponse::GenericErrorResponse(body)) + Ok(ContainerIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -236,7 +243,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::ContainerEntity>(&buf)?; - Ok(ContainerLookupGetResponse::FindASingleContainerByExternalIdentifer(body)) + Ok(ContainerLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -250,14 +257,14 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Error>(&buf)?; - Ok(ContainerLookupGetResponse::NoSuchContainer(body)) + Ok(ContainerLookupGetResponse::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::Error>(&buf)?; - Ok(ContainerLookupGetResponse::GenericErrorResponse(body)) + Ok(ContainerLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -301,7 +308,7 @@ impl Api for Client { 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::Created(body)) + Ok(ContainerPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -310,12 +317,19 @@ impl Api for Client { Ok(ContainerPostResponse::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::Error>(&buf)?; + + Ok(ContainerPostResponse::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::Error>(&buf)?; - Ok(ContainerPostResponse::GenericErrorResponse(body)) + Ok(ContainerPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -354,7 +368,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::CreatorEntity>(&buf)?; - Ok(CreatorIdGetResponse::FetchASingleCreatorById(body)) + Ok(CreatorIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -363,12 +377,19 @@ impl Api for Client { 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::Error>(&buf)?; + + Ok(CreatorIdGetResponse::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::Error>(&buf)?; - Ok(CreatorIdGetResponse::GenericErrorResponse(body)) + Ok(CreatorIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -410,7 +431,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::CreatorEntity>(&buf)?; - Ok(CreatorLookupGetResponse::FindASingleCreatorByExternalIdentifer(body)) + Ok(CreatorLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -424,14 +445,14 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Error>(&buf)?; - Ok(CreatorLookupGetResponse::NoSuchCreator(body)) + Ok(CreatorLookupGetResponse::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::Error>(&buf)?; - Ok(CreatorLookupGetResponse::GenericErrorResponse(body)) + Ok(CreatorLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -475,7 +496,7 @@ impl Api for Client { 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(CreatorPostResponse::Created(body)) + Ok(CreatorPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -484,12 +505,19 @@ impl Api for Client { Ok(CreatorPostResponse::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::Error>(&buf)?; + + Ok(CreatorPostResponse::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::Error>(&buf)?; - Ok(CreatorPostResponse::GenericErrorResponse(body)) + Ok(CreatorPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -528,28 +556,28 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Success>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::MergedEditgroupSuccessfully_(body)) + Ok(EditgroupIdAcceptPostResponse::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::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::EditgroupIsInAnUnmergableState(body)) + Ok(EditgroupIdAcceptPostResponse::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::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::NoSuchEditgroup(body)) + Ok(EditgroupIdAcceptPostResponse::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::Error>(&buf)?; - Ok(EditgroupIdAcceptPostResponse::GenericErrorResponse(body)) + Ok(EditgroupIdAcceptPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -588,21 +616,21 @@ impl Api for Client { 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)?; - Ok(EditgroupIdGetResponse::FetchEditgroupByIdentifier(body)) + Ok(EditgroupIdGetResponse::FoundEditgroup(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::Error>(&buf)?; - Ok(EditgroupIdGetResponse::NoSuchEditgroup(body)) + Ok(EditgroupIdGetResponse::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::Error>(&buf)?; - Ok(EditgroupIdGetResponse::GenericErrorResponse(body)) + Ok(EditgroupIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -648,14 +676,14 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Error>(&buf)?; - Ok(EditgroupPostResponse::InvalidRequestParameters(body)) + Ok(EditgroupPostResponse::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::Error>(&buf)?; - Ok(EditgroupPostResponse::GenericErrorResponse(body)) + Ok(EditgroupPostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -698,21 +726,21 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Changelogentry>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::FindChanges_(body)) + Ok(EditorUsernameChangelogGetResponse::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::Error>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::UsernameNotFound(body)) + Ok(EditorUsernameChangelogGetResponse::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::Error>(&buf)?; - Ok(EditorUsernameChangelogGetResponse::GenericErrorResponse(body)) + Ok(EditorUsernameChangelogGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -755,21 +783,21 @@ impl Api for Client { 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)?; - Ok(EditorUsernameGetResponse::FetchGenericInformationAboutAnEditor(body)) + Ok(EditorUsernameGetResponse::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::Error>(&buf)?; - Ok(EditorUsernameGetResponse::UsernameNotFound(body)) + Ok(EditorUsernameGetResponse::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::Error>(&buf)?; - Ok(EditorUsernameGetResponse::GenericErrorResponse(body)) + Ok(EditorUsernameGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -808,7 +836,7 @@ impl Api for Client { 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(FileIdGetResponse::FetchASingleFileById(body)) + Ok(FileIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -817,12 +845,19 @@ impl Api for Client { Ok(FileIdGetResponse::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::Error>(&buf)?; + + Ok(FileIdGetResponse::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::Error>(&buf)?; - Ok(FileIdGetResponse::GenericErrorResponse(body)) + Ok(FileIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -864,7 +899,7 @@ impl Api for Client { 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::FindASingleFileByExternalIdentifer(body)) + Ok(FileLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -878,14 +913,14 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Error>(&buf)?; - Ok(FileLookupGetResponse::NoSuchFile(body)) + Ok(FileLookupGetResponse::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::Error>(&buf)?; - Ok(FileLookupGetResponse::GenericErrorResponse(body)) + Ok(FileLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -929,7 +964,7 @@ impl Api for Client { 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::Created(body)) + Ok(FilePostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -938,12 +973,19 @@ impl Api for Client { Ok(FilePostResponse::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::Error>(&buf)?; + + Ok(FilePostResponse::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::Error>(&buf)?; - Ok(FilePostResponse::GenericErrorResponse(body)) + Ok(FilePostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -982,7 +1024,7 @@ impl Api for Client { 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::FetchASingleReleaseById(body)) + Ok(ReleaseIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -991,12 +1033,19 @@ impl Api for Client { Ok(ReleaseIdGetResponse::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::Error>(&buf)?; + + Ok(ReleaseIdGetResponse::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::Error>(&buf)?; - Ok(ReleaseIdGetResponse::GenericErrorResponse(body)) + Ok(ReleaseIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1038,7 +1087,7 @@ impl Api for Client { 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(ReleaseLookupGetResponse::FindASingleReleaseByExternalIdentifer(body)) + Ok(ReleaseLookupGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -1052,14 +1101,14 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::Error>(&buf)?; - Ok(ReleaseLookupGetResponse::NoSuchRelease(body)) + Ok(ReleaseLookupGetResponse::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::Error>(&buf)?; - Ok(ReleaseLookupGetResponse::GenericErrorResponse(body)) + Ok(ReleaseLookupGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1103,7 +1152,7 @@ impl Api for Client { 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(ReleasePostResponse::Created(body)) + Ok(ReleasePostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -1112,12 +1161,19 @@ impl Api for Client { Ok(ReleasePostResponse::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::Error>(&buf)?; + + Ok(ReleasePostResponse::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::Error>(&buf)?; - Ok(ReleasePostResponse::GenericErrorResponse(body)) + Ok(ReleasePostResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1156,7 +1212,7 @@ impl Api for Client { response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::<models::WorkEntity>(&buf)?; - Ok(WorkIdGetResponse::FetchASingleWorkById(body)) + Ok(WorkIdGetResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); @@ -1165,12 +1221,19 @@ impl Api for Client { Ok(WorkIdGetResponse::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::Error>(&buf)?; + + Ok(WorkIdGetResponse::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::Error>(&buf)?; - Ok(WorkIdGetResponse::GenericErrorResponse(body)) + Ok(WorkIdGetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -1214,7 +1277,7 @@ impl Api for Client { 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(WorkPostResponse::Created(body)) + Ok(WorkPostResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); @@ -1223,12 +1286,19 @@ impl Api for Client { Ok(WorkPostResponse::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::Error>(&buf)?; + + Ok(WorkPostResponse::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::Error>(&buf)?; - Ok(WorkPostResponse::GenericErrorResponse(body)) + Ok(WorkPostResponse::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 151c3a4a..17dd6c76 100644 --- a/rust/fatcat-api/src/lib.rs +++ b/rust/fatcat-api/src/lib.rs @@ -34,202 +34,222 @@ pub use swagger::{ApiError, Context, ContextWrapper}; #[derive(Debug, PartialEq)] pub enum ContainerIdGetResponse { - /// fetch a single container by id - FetchASingleContainerById(models::ContainerEntity), - /// bad request + /// Found Entity + FoundEntity(models::ContainerEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ContainerLookupGetResponse { - /// find a single container by external identifer - FindASingleContainerByExternalIdentifer(models::ContainerEntity), - /// bad request + /// Found Entity + FoundEntity(models::ContainerEntity), + /// Bad Request BadRequest(models::Error), - /// no such container - NoSuchContainer(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ContainerPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorIdGetResponse { - /// fetch a single creator by id - FetchASingleCreatorById(models::CreatorEntity), - /// bad request + /// Found Entity + FoundEntity(models::CreatorEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorLookupGetResponse { - /// find a single creator by external identifer - FindASingleCreatorByExternalIdentifer(models::CreatorEntity), - /// bad request + /// Found Entity + FoundEntity(models::CreatorEntity), + /// Bad Request BadRequest(models::Error), - /// no such creator - NoSuchCreator(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum CreatorPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupIdAcceptPostResponse { - /// merged editgroup successfully (\"live\") - MergedEditgroupSuccessfully_(models::Success), - /// editgroup is in an unmergable state - EditgroupIsInAnUnmergableState(models::Error), - /// no such editgroup - NoSuchEditgroup(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Merged Successfully + MergedSuccessfully(models::Success), + /// Unmergable + Unmergable(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupIdGetResponse { - /// fetch editgroup by identifier - FetchEditgroupByIdentifier(models::Editgroup), - /// no such editgroup - NoSuchEditgroup(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Editgroup + FoundEditgroup(models::Editgroup), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditgroupPostResponse { - /// successfully created + /// Successfully Created SuccessfullyCreated(models::Editgroup), - /// invalid request parameters - InvalidRequestParameters(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Bad Request + BadRequest(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditorUsernameChangelogGetResponse { - /// find changes (editgroups) by this editor which have been merged - FindChanges_(models::Changelogentry), - /// username not found - UsernameNotFound(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Merged Changes + FoundMergedChanges(models::Changelogentry), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum EditorUsernameGetResponse { - /// fetch generic information about an editor - FetchGenericInformationAboutAnEditor(models::Editor), - /// username not found - UsernameNotFound(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Found Editor + FoundEditor(models::Editor), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FileIdGetResponse { - /// fetch a single file by id - FetchASingleFileById(models::FileEntity), - /// bad request + /// Found Entity + FoundEntity(models::FileEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FileLookupGetResponse { - /// find a single file by external identifer - FindASingleFileByExternalIdentifer(models::FileEntity), - /// bad request + /// Found Entity + FoundEntity(models::FileEntity), + /// Bad Request BadRequest(models::Error), - /// no such file - NoSuchFile(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum FilePostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleaseIdGetResponse { - /// fetch a single release by id - FetchASingleReleaseById(models::ReleaseEntity), - /// bad request + /// Found Entity + FoundEntity(models::ReleaseEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleaseLookupGetResponse { - /// find a single release by external identifer - FindASingleReleaseByExternalIdentifer(models::ReleaseEntity), - /// bad request + /// Found Entity + FoundEntity(models::ReleaseEntity), + /// Bad Request BadRequest(models::Error), - /// no such release - NoSuchRelease(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum ReleasePostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum WorkIdGetResponse { - /// fetch a single work by id - FetchASingleWorkById(models::WorkEntity), - /// bad request + /// Found Entity + FoundEntity(models::WorkEntity), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } #[derive(Debug, PartialEq)] pub enum WorkPostResponse { - /// created - Created(models::EntityEdit), - /// bad request + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request BadRequest(models::Error), - /// generic error response - GenericErrorResponse(models::Error), + /// Not Found + NotFound(models::Error), + /// Generic Error + GenericError(models::Error), } /// API diff --git a/rust/fatcat-api/src/mimetypes.rs b/rust/fatcat-api/src/mimetypes.rs index cc362421..9d3d91a8 100644 --- a/rust/fatcat-api/src/mimetypes.rs +++ b/rust/fatcat-api/src/mimetypes.rs @@ -6,7 +6,7 @@ pub mod responses { // The macro is called per-operation to beat the recursion limit /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { - pub static ref CONTAINER_ID_GET_FETCH_A_SINGLE_CONTAINER_BY_ID: Mime = mime!(Application / Json); + pub static ref CONTAINER_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { @@ -14,11 +14,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerIdGet lazy_static! { - pub static ref CONTAINER_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ContainerIdGet + lazy_static! { + pub static ref CONTAINER_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_FIND_A_SINGLE_CONTAINER_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { @@ -26,15 +30,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_NO_SUCH_CONTAINER: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerLookupGet lazy_static! { - pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerPost lazy_static! { - pub static ref CONTAINER_POST_CREATED: Mime = mime!(Application / Json); + pub static ref CONTAINER_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ContainerPost lazy_static! { @@ -42,11 +46,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ContainerPost lazy_static! { - pub static ref CONTAINER_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CONTAINER_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ContainerPost + lazy_static! { + pub static ref CONTAINER_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { - pub static ref CREATOR_ID_GET_FETCH_A_SINGLE_CREATOR_BY_ID: Mime = mime!(Application / Json); + pub static ref CREATOR_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { @@ -54,11 +62,15 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorIdGet lazy_static! { - pub static ref CREATOR_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreatorIdGet + lazy_static! { + pub static ref CREATOR_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_FIND_A_SINGLE_CREATOR_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { @@ -66,15 +78,15 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_NO_SUCH_CREATOR: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorLookupGet lazy_static! { - pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorPost lazy_static! { - pub static ref CREATOR_POST_CREATED: Mime = mime!(Application / Json); + pub static ref CREATOR_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for CreatorPost lazy_static! { @@ -82,35 +94,39 @@ pub mod responses { } /// Create Mime objects for the response content types for CreatorPost lazy_static! { - pub static ref CREATOR_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref CREATOR_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreatorPost + lazy_static! { + pub static ref CREATOR_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_EDITGROUP_SUCCESSFULLY_: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_EDITGROUP_IS_IN_AN_UNMERGABLE_STATE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_UNMERGABLE: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_NO_SUCH_EDITGROUP: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdAcceptPost lazy_static! { - pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_FETCH_EDITGROUP_BY_IDENTIFIER: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_FOUND_EDITGROUP: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_NO_SUCH_EDITGROUP: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupIdGet lazy_static! { - pub static ref EDITGROUP_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { @@ -118,39 +134,39 @@ pub mod responses { } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { - pub static ref EDITGROUP_POST_INVALID_REQUEST_PARAMETERS: Mime = mime!(Application / Json); + pub static ref EDITGROUP_POST_BAD_REQUEST: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditgroupPost lazy_static! { - pub static ref EDITGROUP_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITGROUP_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_FIND_CHANGES_: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_USERNAME_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameChangelogGet lazy_static! { - pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_FETCH_GENERIC_INFORMATION_ABOUT_AN_EDITOR: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_FOUND_EDITOR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_USERNAME_NOT_FOUND: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for EditorUsernameGet lazy_static! { - pub static ref EDITOR_USERNAME_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref EDITOR_USERNAME_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileIdGet lazy_static! { - pub static ref FILE_ID_GET_FETCH_A_SINGLE_FILE_BY_ID: Mime = mime!(Application / Json); + pub static ref FILE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileIdGet lazy_static! { @@ -158,11 +174,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FileIdGet lazy_static! { - pub static ref FILE_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for FileIdGet + lazy_static! { + pub static ref FILE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_FIND_A_SINGLE_FILE_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { @@ -170,15 +190,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_NO_SUCH_FILE: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FileLookupGet lazy_static! { - pub static ref FILE_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FilePost lazy_static! { - pub static ref FILE_POST_CREATED: Mime = mime!(Application / Json); + pub static ref FILE_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for FilePost lazy_static! { @@ -186,11 +206,15 @@ pub mod responses { } /// Create Mime objects for the response content types for FilePost lazy_static! { - pub static ref FILE_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref FILE_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for FilePost + lazy_static! { + pub static ref FILE_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { - pub static ref RELEASE_ID_GET_FETCH_A_SINGLE_RELEASE_BY_ID: Mime = mime!(Application / Json); + pub static ref RELEASE_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { @@ -198,11 +222,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleaseIdGet lazy_static! { - pub static ref RELEASE_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ReleaseIdGet + lazy_static! { + pub static ref RELEASE_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_FIND_A_SINGLE_RELEASE_BY_EXTERNAL_IDENTIFER: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { @@ -210,15 +238,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_NO_SUCH_RELEASE: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_NOT_FOUND: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleaseLookupGet lazy_static! { - pub static ref RELEASE_LOOKUP_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_LOOKUP_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleasePost lazy_static! { - pub static ref RELEASE_POST_CREATED: Mime = mime!(Application / Json); + pub static ref RELEASE_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for ReleasePost lazy_static! { @@ -226,11 +254,15 @@ pub mod responses { } /// Create Mime objects for the response content types for ReleasePost lazy_static! { - pub static ref RELEASE_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref RELEASE_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for ReleasePost + lazy_static! { + pub static ref RELEASE_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { - pub static ref WORK_ID_GET_FETCH_A_SINGLE_WORK_BY_ID: Mime = mime!(Application / Json); + pub static ref WORK_ID_GET_FOUND_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { @@ -238,11 +270,15 @@ pub mod responses { } /// Create Mime objects for the response content types for WorkIdGet lazy_static! { - pub static ref WORK_ID_GET_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref WORK_ID_GET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for WorkIdGet + lazy_static! { + pub static ref WORK_ID_GET_GENERIC_ERROR: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkPost lazy_static! { - pub static ref WORK_POST_CREATED: Mime = mime!(Application / Json); + pub static ref WORK_POST_CREATED_ENTITY: Mime = mime!(Application / Json); } /// Create Mime objects for the response content types for WorkPost lazy_static! { @@ -250,7 +286,11 @@ pub mod responses { } /// Create Mime objects for the response content types for WorkPost lazy_static! { - pub static ref WORK_POST_GENERIC_ERROR_RESPONSE: Mime = mime!(Application / Json); + pub static ref WORK_POST_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for WorkPost + lazy_static! { + pub static ref WORK_POST_GENERIC_ERROR: Mime = mime!(Application / Json); } } diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs index 94668aa9..090c45e3 100644 --- a/rust/fatcat-api/src/server.rs +++ b/rust/fatcat-api/src/server.rs @@ -116,11 +116,11 @@ where match api.container_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - ContainerIdGetResponse::FetchASingleContainerById(body) => { + ContainerIdGetResponse::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::CONTAINER_ID_GET_FETCH_A_SINGLE_CONTAINER_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -136,11 +136,21 @@ where Ok(response) } - ContainerIdGetResponse::GenericErrorResponse(body) => { + ContainerIdGetResponse::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())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + ContainerIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -190,13 +200,11 @@ where match api.container_lookup_get(param_issn, context).wait() { Ok(rsp) => match rsp { - ContainerLookupGetResponse::FindASingleContainerByExternalIdentifer(body) => { + ContainerLookupGetResponse::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::CONTAINER_LOOKUP_GET_FIND_A_SINGLE_CONTAINER_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -212,21 +220,21 @@ where Ok(response) } - ContainerLookupGetResponse::NoSuchContainer(body) => { + ContainerLookupGetResponse::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_NO_SUCH_CONTAINER.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - ContainerLookupGetResponse::GenericErrorResponse(body) => { + ContainerLookupGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -290,11 +298,11 @@ where match api.container_post(param_body, context).wait() { Ok(rsp) => match rsp { - ContainerPostResponse::Created(body) => { + ContainerPostResponse::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.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -314,11 +322,23 @@ where } Ok(response) } - ContainerPostResponse::GenericErrorResponse(body) => { + ContainerPostResponse::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())); + + 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) + } + ContainerPostResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CONTAINER_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -374,11 +394,11 @@ where match api.creator_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - CreatorIdGetResponse::FetchASingleCreatorById(body) => { + CreatorIdGetResponse::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::CREATOR_ID_GET_FETCH_A_SINGLE_CREATOR_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -394,11 +414,21 @@ where Ok(response) } - CreatorIdGetResponse::GenericErrorResponse(body) => { + CreatorIdGetResponse::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_ID_GET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + CreatorIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -448,13 +478,11 @@ where match api.creator_lookup_get(param_orcid, context).wait() { Ok(rsp) => match rsp { - CreatorLookupGetResponse::FindASingleCreatorByExternalIdentifer(body) => { + CreatorLookupGetResponse::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::CREATOR_LOOKUP_GET_FIND_A_SINGLE_CREATOR_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -470,21 +498,21 @@ where Ok(response) } - CreatorLookupGetResponse::NoSuchCreator(body) => { + CreatorLookupGetResponse::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_NO_SUCH_CREATOR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - CreatorLookupGetResponse::GenericErrorResponse(body) => { + CreatorLookupGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -547,11 +575,11 @@ where match api.creator_post(param_body, context).wait() { Ok(rsp) => match rsp { - CreatorPostResponse::Created(body) => { + CreatorPostResponse::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::CREATOR_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -571,11 +599,23 @@ where } Ok(response) } - CreatorPostResponse::GenericErrorResponse(body) => { + CreatorPostResponse::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())); + + 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) + } + CreatorPostResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATOR_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -631,43 +671,41 @@ where match api.editgroup_id_accept_post(param_id, context).wait() { Ok(rsp) => match rsp { - EditgroupIdAcceptPostResponse::MergedEditgroupSuccessfully_(body) => { + EditgroupIdAcceptPostResponse::MergedSuccessfully(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_MERGED_EDITGROUP_SUCCESSFULLY_.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_MERGED_SUCCESSFULLY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::EditgroupIsInAnUnmergableState(body) => { + EditgroupIdAcceptPostResponse::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::EDITGROUP_ID_ACCEPT_POST_EDITGROUP_IS_IN_AN_UNMERGABLE_STATE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_UNMERGABLE.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::NoSuchEditgroup(body) => { + EditgroupIdAcceptPostResponse::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_NO_SUCH_EDITGROUP.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdAcceptPostResponse::GenericErrorResponse(body) => { + EditgroupIdAcceptPostResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_ACCEPT_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -721,31 +759,31 @@ where match api.editgroup_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - EditgroupIdGetResponse::FetchEditgroupByIdentifier(body) => { + EditgroupIdGetResponse::FoundEditgroup(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_FETCH_EDITGROUP_BY_IDENTIFIER.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FOUND_EDITGROUP.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdGetResponse::NoSuchEditgroup(body) => { + EditgroupIdGetResponse::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_NO_SUCH_EDITGROUP.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupIdGetResponse::GenericErrorResponse(body) => { + EditgroupIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -795,21 +833,21 @@ where Ok(response) } - EditgroupPostResponse::InvalidRequestParameters(body) => { + EditgroupPostResponse::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_INVALID_REQUEST_PARAMETERS.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditgroupPostResponse::GenericErrorResponse(body) => { + EditgroupPostResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITGROUP_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -863,31 +901,31 @@ where match api.editor_username_changelog_get(param_username, context).wait() { Ok(rsp) => match rsp { - EditorUsernameChangelogGetResponse::FindChanges_(body) => { + EditorUsernameChangelogGetResponse::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(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_FIND_CHANGES_.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_FOUND_MERGED_CHANGES.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameChangelogGetResponse::UsernameNotFound(body) => { + EditorUsernameChangelogGetResponse::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_USERNAME_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameChangelogGetResponse::GenericErrorResponse(body) => { + EditorUsernameChangelogGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_CHANGELOG_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -941,33 +979,31 @@ where match api.editor_username_get(param_username, context).wait() { Ok(rsp) => match rsp { - EditorUsernameGetResponse::FetchGenericInformationAboutAnEditor(body) => { + EditorUsernameGetResponse::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::EDITOR_USERNAME_GET_FETCH_GENERIC_INFORMATION_ABOUT_AN_EDITOR.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_FOUND_EDITOR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameGetResponse::UsernameNotFound(body) => { + EditorUsernameGetResponse::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_USERNAME_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - EditorUsernameGetResponse::GenericErrorResponse(body) => { + EditorUsernameGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::EDITOR_USERNAME_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1021,11 +1057,11 @@ where match api.file_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - FileIdGetResponse::FetchASingleFileById(body) => { + FileIdGetResponse::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_FETCH_A_SINGLE_FILE_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1041,11 +1077,21 @@ where Ok(response) } - FileIdGetResponse::GenericErrorResponse(body) => { + FileIdGetResponse::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())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + FileIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1095,13 +1141,11 @@ where match api.file_lookup_get(param_sha1, context).wait() { Ok(rsp) => match rsp { - FileLookupGetResponse::FindASingleFileByExternalIdentifer(body) => { + FileLookupGetResponse::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_LOOKUP_GET_FIND_A_SINGLE_FILE_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1117,21 +1161,21 @@ where Ok(response) } - FileLookupGetResponse::NoSuchFile(body) => { + FileLookupGetResponse::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_NO_SUCH_FILE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - FileLookupGetResponse::GenericErrorResponse(body) => { + FileLookupGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1194,11 +1238,11 @@ where match api.file_post(param_body, context).wait() { Ok(rsp) => match rsp { - FilePostResponse::Created(body) => { + FilePostResponse::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::FILE_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1218,11 +1262,23 @@ where } Ok(response) } - FilePostResponse::GenericErrorResponse(body) => { + FilePostResponse::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())); + + 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) => { 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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::FILE_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1278,11 +1334,11 @@ where match api.release_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - ReleaseIdGetResponse::FetchASingleReleaseById(body) => { + ReleaseIdGetResponse::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_FETCH_A_SINGLE_RELEASE_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1298,11 +1354,21 @@ where Ok(response) } - ReleaseIdGetResponse::GenericErrorResponse(body) => { + ReleaseIdGetResponse::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())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + ReleaseIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1352,13 +1418,11 @@ where match api.release_lookup_get(param_doi, context).wait() { Ok(rsp) => match rsp { - ReleaseLookupGetResponse::FindASingleReleaseByExternalIdentifer(body) => { + ReleaseLookupGetResponse::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_FIND_A_SINGLE_RELEASE_BY_EXTERNAL_IDENTIFER.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1374,21 +1438,21 @@ where Ok(response) } - ReleaseLookupGetResponse::NoSuchRelease(body) => { + ReleaseLookupGetResponse::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_NO_SUCH_RELEASE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - ReleaseLookupGetResponse::GenericErrorResponse(body) => { + ReleaseLookupGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_LOOKUP_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1451,11 +1515,11 @@ where match api.release_post(param_body, context).wait() { Ok(rsp) => match rsp { - ReleasePostResponse::Created(body) => { + ReleasePostResponse::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::RELEASE_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1475,11 +1539,23 @@ where } Ok(response) } - ReleasePostResponse::GenericErrorResponse(body) => { + ReleasePostResponse::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())); + + 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) => { 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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::RELEASE_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1535,11 +1611,11 @@ where match api.work_id_get(param_id, context).wait() { Ok(rsp) => match rsp { - WorkIdGetResponse::FetchASingleWorkById(body) => { + WorkIdGetResponse::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_FETCH_A_SINGLE_WORK_BY_ID.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1555,11 +1631,21 @@ where Ok(response) } - WorkIdGetResponse::GenericErrorResponse(body) => { + WorkIdGetResponse::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())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + WorkIdGetResponse::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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_ID_GET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -1622,11 +1708,11 @@ where match api.work_post(param_body, context).wait() { Ok(rsp) => match rsp { - WorkPostResponse::Created(body) => { + WorkPostResponse::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::WORK_POST_CREATED.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_POST_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -1646,11 +1732,23 @@ where } Ok(response) } - WorkPostResponse::GenericErrorResponse(body) => { + WorkPostResponse::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())); + + 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) => { 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_RESPONSE.clone())); + response.headers.set(ContentType(mimetypes::responses::WORK_POST_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { |