From 8e179c13a28b0f647b76fc05c5d6b25522866882 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 26 Dec 2018 15:15:44 -0800 Subject: rust codegen --- rust/fatcat-api-spec/README.md | 24 +- rust/fatcat-api-spec/api.yaml | 629 ++++- rust/fatcat-api-spec/api/swagger.yaml | 2399 +++++++++++++++-- rust/fatcat-api-spec/examples/client.rs | 155 +- rust/fatcat-api-spec/examples/server_lib/server.rs | 255 +- rust/fatcat-api-spec/src/client.rs | 1910 ++++++++++++-- rust/fatcat-api-spec/src/lib.rs | 478 ++++ rust/fatcat-api-spec/src/mimetypes.rs | 376 +++ rust/fatcat-api-spec/src/models.rs | 243 ++ rust/fatcat-api-spec/src/server.rs | 2737 ++++++++++++++++++-- 10 files changed, 8501 insertions(+), 705 deletions(-) diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index 446742be..bf7d63e6 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-12-25T00:18:05.291Z +- Build date: 2018-12-26T23:15:13.714Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. @@ -97,6 +97,16 @@ cargo run --example client GetFileRedirects cargo run --example client GetFileRevision cargo run --example client LookupFile cargo run --example client UpdateFile +cargo run --example client CreateFileset +cargo run --example client CreateFilesetBatch +cargo run --example client DeleteFileset +cargo run --example client DeleteFilesetEdit +cargo run --example client GetFileset +cargo run --example client GetFilesetEdit +cargo run --example client GetFilesetHistory +cargo run --example client GetFilesetRedirects +cargo run --example client GetFilesetRevision +cargo run --example client UpdateFileset cargo run --example client CreateRelease cargo run --example client CreateReleaseBatch cargo run --example client CreateWork @@ -105,11 +115,23 @@ cargo run --example client DeleteReleaseEdit cargo run --example client GetRelease cargo run --example client GetReleaseEdit cargo run --example client GetReleaseFiles +cargo run --example client GetReleaseFilesets cargo run --example client GetReleaseHistory cargo run --example client GetReleaseRedirects cargo run --example client GetReleaseRevision +cargo run --example client GetReleaseWebcaptures cargo run --example client LookupRelease cargo run --example client UpdateRelease +cargo run --example client CreateWebcapture +cargo run --example client CreateWebcaptureBatch +cargo run --example client DeleteWebcapture +cargo run --example client DeleteWebcaptureEdit +cargo run --example client GetWebcapture +cargo run --example client GetWebcaptureEdit +cargo run --example client GetWebcaptureHistory +cargo run --example client GetWebcaptureRedirects +cargo run --example client GetWebcaptureRevision +cargo run --example client UpdateWebcapture cargo run --example client CreateWorkBatch cargo run --example client DeleteWork cargo run --example client DeleteWorkEdit diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 018b58e9..3eada7e4 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -170,6 +170,129 @@ definitions: items: type: string #format: uuid + fileset_entity: + type: object + properties: + <<: *ENTITYPROPS + manifest: + # limit of 200 files, at least to start + type: array + items: + type: object + required: + - path + - size + properties: + path: + type: string + example: "img/cat.png" + size: + type: integer + example: 1048576 + format: int64 + md5: + type: string + #format: custom + example: "d41efcc592d1e40ac13905377399eb9b" + sha1: + type: string + #format: custom + example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + sha256: + type: string + #format: custom + example: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: + type: object + additionalProperties: {} + urls: + type: array + items: + type: object + required: + - url + - rel + properties: + url: + type: string + format: url + example: "https://example.edu/~frau/prcding.pdf" + rel: + type: string + example: "webarchive" + release_ids: + type: array + items: + type: string + #format: uuid + webcapture_entity: + type: object + properties: + <<: *ENTITYPROPS + cdx: + # limit of 200 CDX lines, at least to start + type: array + items: + type: object + required: + - surt + - timestamp + - url + - status_code + - sha1 + properties: + surt: + type: string + example: "org,asheesh)/apus/ch1/node15.html" + timestamp: + type: integer + example: 20020429162520 + format: int64 + url: + type: string + example: "http://www.asheesh.org:80/APUS/ch1/node15.html" + mimetype: + type: string + example: "text/html" + status_code: + type: integer + example: 200 + format: int64 + sha1: + type: string + #format: custom + example: "3f242a192acc258bdfdb151943419437f440c313" + sha256: + type: string + #format: custom + example: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + archive_urls: + type: array + items: + type: object + required: + - url + - rel + properties: + url: + type: string + format: url + example: "https://web.archive.org/web/" + rel: + type: string + example: "wayback" + original_url: + type: string + #format: url + example: "http://asheesh.org" + timestamp: + type: string + format: date-time + release_ids: + type: array + items: + type: string + #format: uuid release_entity: type: object # required for creation: title @@ -189,6 +312,16 @@ definitions: type: array items: $ref: "#/definitions/file_entity" + filesets: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/fileset_entity" + webcaptures: + description: "Optional; GET-only" + type: array + items: + $ref: "#/definitions/webcapture_entity" container_id: type: string example: "q3nouwy3nnbsvo3h5klxsx4a7y" @@ -347,6 +480,14 @@ definitions: type: array items: $ref: "#/definitions/entity_edit" + filesets: + type: array + items: + $ref: "#/definitions/entity_edit" + webcaptures: + type: array + items: + $ref: "#/definitions/entity_edit" releases: type: array items: @@ -853,7 +994,7 @@ paths: in: query type: string required: false - description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." + description: "List of entity fields to elide in response. For creators, none implemented yet." get: operationId: "get_creator_releases" tags: # TAGLINE @@ -1198,6 +1339,440 @@ paths: schema: $ref: "#/definitions/success" <<: *ENTITYRESPONSES + /fileset: + post: + operationId: "create_fileset" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: entity + in: body + required: true + schema: + $ref: "#/definitions/fileset_entity" + - name: editgroup_id + in: query + required: false + type: string + responses: + 201: + description: Created Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /fileset/batch: + post: + operationId: "create_fileset_batch" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: autoaccept + in: query + type: boolean + required: false + description: "If true, and editor is authorized, batch is accepted all at once" + - name: editgroup_id + in: query + type: string + required: false + description: "Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)" + - name: entity_list + in: body + required: true + schema: + type: array + items: + $ref: "#/definitions/fileset_entity" + responses: + 201: + description: Created Entities + schema: + type: array + items: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /fileset/{ident}: + parameters: + - name: ident + in: path + type: string + required: true + get: + operationId: "get_fileset" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: expand + in: query + type: string + required: false + description: "List of sub-entities to expand in response. For filesets, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For filesets, 'manifest' is accepted." + responses: + 200: + description: Found Entity + schema: + $ref: "#/definitions/fileset_entity" + <<: *ENTITYRESPONSES + put: + operationId: "update_fileset" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: entity + in: body + required: true + schema: + $ref: "#/definitions/fileset_entity" + - name: editgroup_id + in: query + required: false + type: string + responses: + 200: + description: Updated Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + delete: + operationId: "delete_fileset" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: editgroup_id + in: query + required: false + type: string + responses: + 200: + description: Deleted Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /fileset/rev/{rev_id}: + parameters: + - name: rev_id + in: path + type: string + #format: uuid + required: true + get: + operationId: "get_fileset_revision" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: expand + in: query + type: string + required: false + description: "List of sub-entities to expand in response. For filesets, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For filesets, 'manifest' is accepted." + responses: + 200: + description: Found Entity Revision + schema: + $ref: "#/definitions/fileset_entity" + <<: *ENTITYRESPONSES + /fileset/{ident}/history: + parameters: + - name: ident + in: path + type: string + required: true + - name: limit + in: query + type: integer + format: int64 + required: false + get: + operationId: "get_fileset_history" + tags: # TAGLINE + - filesets # TAGLINE + responses: + 200: + description: Found Entity History + schema: + type: array + items: + $ref: "#/definitions/entity_history_entry" + <<: *ENTITYRESPONSES + /fileset/{ident}/redirects: + parameters: + - name: ident + in: path + type: string + required: true + get: + tags: # TAGLINE + - filesets # TAGLINE + operationId: "get_fileset_redirects" + responses: + 200: + description: Found Entity Redirects + schema: + type: array + items: + type: string + #format: ident + <<: *ENTITYRESPONSES + /fileset/edit/{edit_id}: + get: + operationId: "get_fileset_edit" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: edit_id + in: path + type: integer + format: int64 + required: true + responses: + 200: + description: Found Edit + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + delete: + operationId: "delete_fileset_edit" + tags: # TAGLINE + - filesets # TAGLINE + parameters: + - name: edit_id + in: path + type: integer + format: int64 + required: true + responses: + 200: + description: Deleted Edit + schema: + $ref: "#/definitions/success" + <<: *ENTITYRESPONSES + /webcapture: + post: + operationId: "create_webcapture" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: entity + in: body + required: true + schema: + $ref: "#/definitions/webcapture_entity" + - name: editgroup_id + in: query + required: false + type: string + responses: + 201: + description: Created Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /webcapture/batch: + post: + operationId: "create_webcapture_batch" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: autoaccept + in: query + type: boolean + required: false + description: "If true, and editor is authorized, batch is accepted all at once" + - name: editgroup_id + in: query + type: string + required: false + description: "Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)" + - name: entity_list + in: body + required: true + schema: + type: array + items: + $ref: "#/definitions/webcapture_entity" + responses: + 201: + description: Created Entities + schema: + type: array + items: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /webcapture/{ident}: + parameters: + - name: ident + in: path + type: string + required: true + get: + operationId: "get_webcapture" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: expand + in: query + type: string + required: false + description: "List of sub-entities to expand in response. For webcaptures, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For webcaptures, 'cdx' is accepted." + responses: + 200: + description: Found Entity + schema: + $ref: "#/definitions/webcapture_entity" + <<: *ENTITYRESPONSES + put: + operationId: "update_webcapture" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: entity + in: body + required: true + schema: + $ref: "#/definitions/webcapture_entity" + - name: editgroup_id + in: query + required: false + type: string + responses: + 200: + description: Updated Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + delete: + operationId: "delete_webcapture" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: editgroup_id + in: query + required: false + type: string + responses: + 200: + description: Deleted Entity + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + /webcapture/rev/{rev_id}: + parameters: + - name: rev_id + in: path + type: string + #format: uuid + required: true + get: + operationId: "get_webcapture_revision" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: expand + in: query + type: string + required: false + description: "List of sub-entities to expand in response. For webcaptures, none accepted (yet)." + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For webcaptures, 'cdx' is accepted." + responses: + 200: + description: Found Entity Revision + schema: + $ref: "#/definitions/webcapture_entity" + <<: *ENTITYRESPONSES + /webcapture/{ident}/history: + parameters: + - name: ident + in: path + type: string + required: true + - name: limit + in: query + type: integer + format: int64 + required: false + get: + operationId: "get_webcapture_history" + tags: # TAGLINE + - webcaptures # TAGLINE + responses: + 200: + description: Found Entity History + schema: + type: array + items: + $ref: "#/definitions/entity_history_entry" + <<: *ENTITYRESPONSES + /webcapture/{ident}/redirects: + parameters: + - name: ident + in: path + type: string + required: true + get: + tags: # TAGLINE + - webcaptures # TAGLINE + operationId: "get_webcapture_redirects" + responses: + 200: + description: Found Entity Redirects + schema: + type: array + items: + type: string + #format: ident + <<: *ENTITYRESPONSES + /webcapture/edit/{edit_id}: + get: + operationId: "get_webcapture_edit" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: edit_id + in: path + type: integer + format: int64 + required: true + responses: + 200: + description: Found Edit + schema: + $ref: "#/definitions/entity_edit" + <<: *ENTITYRESPONSES + delete: + operationId: "delete_webcapture_edit" + tags: # TAGLINE + - webcaptures # TAGLINE + parameters: + - name: edit_id + in: path + type: integer + format: int64 + required: true + responses: + 200: + description: Deleted Edit + schema: + $ref: "#/definitions/success" + <<: *ENTITYRESPONSES /release: post: operationId: "create_release" @@ -1265,7 +1840,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For releases, 'files', 'container', and 'creators' are valid." + description: "List of sub-entities to expand in response. For releases, 'files', 'filesets, 'webcaptures', 'container', and 'creators' are valid." - name: hide in: query type: string @@ -1386,6 +1961,52 @@ paths: items: $ref: "#/definitions/file_entity" <<: *ENTITYRESPONSES + /release/{ident}/filesets: + parameters: + - name: ident + in: path + type: string + required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For filesets, 'manifest' is valid." + get: + operationId: "get_release_filesets" + tags: # TAGLINE + - releases # TAGLINE + responses: + 200: + description: Found + schema: + type: array + items: + $ref: "#/definitions/fileset_entity" + <<: *ENTITYRESPONSES + /release/{ident}/webcaptures: + parameters: + - name: ident + in: path + type: string + required: true + - name: hide + in: query + type: string + required: false + description: "List of entity fields to elide in response. For webcaptures, 'cdx' is valid." + get: + operationId: "get_release_webcaptures" + tags: # TAGLINE + - releases # TAGLINE + responses: + 200: + description: Found + schema: + type: array + items: + $ref: "#/definitions/webcapture_entity" + <<: *ENTITYRESPONSES /release/{ident}/redirects: parameters: - name: ident @@ -1444,7 +2065,7 @@ paths: in: query type: string required: false - description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." + description: "List of sub-entities to expand in response. For releases, 'files', 'filesets, 'webcaptures', 'container', and 'creators' are valid." responses: 200: description: Found Entity @@ -1678,7 +2299,7 @@ paths: in: query type: string required: false - description: "List of entity fields to elide in response. For releases, 'abstracts', 'refs', and 'contribs' are valid." + description: "List of entity fields to elide in response. For works, none implemented yet." get: operationId: "get_work_releases" tags: # TAGLINE diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 141841f4..4299efb4 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -1235,8 +1235,8 @@ paths: example: "\"ident_example\".to_string()" - name: "hide" in: "query" - description: "List of entity fields to elide in response. For releases, 'abstracts',\ - \ 'refs', and 'contribs' are valid." + description: "List of entity fields to elide in response. For creators, none\ + \ implemented yet." required: false type: "string" formatString: "{:?}" @@ -2252,23 +2252,23 @@ paths: path: "/file/edit/:edit_id" HttpMethod: "Delete" httpmethod: "delete" - /release: + /fileset: post: tags: - - "releases" - operationId: "create_release" + - "filesets" + operationId: "create_fileset" parameters: - in: "body" name: "entity" required: true schema: - $ref: "#/definitions/release_entity" - uppercase_data_type: "RELEASEENTITY" - refName: "release_entity" + $ref: "#/definitions/fileset_entity" + uppercase_data_type: "FILESETENTITY" + refName: "fileset_entity" formatString: "{:?}" example: "???" model_key: "editgroup_edits" - uppercase_operation_id: "CREATE_RELEASE" + uppercase_operation_id: "CREATE_FILESET" consumesJson: true - name: "editgroup_id" in: "query" @@ -2283,7 +2283,7 @@ paths: $ref: "#/definitions/entity_edit" x-responseId: "CreatedEntity" x-uppercaseResponseId: "CREATED_ENTITY" - uppercase_operation_id: "CREATE_RELEASE" + uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: @@ -2292,7 +2292,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "CREATE_RELEASE" + uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2301,7 +2301,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "CREATE_RELEASE" + uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2310,20 +2310,20 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "CREATE_RELEASE" + uppercase_operation_id: "CREATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "create_release" - uppercase_operation_id: "CREATE_RELEASE" - path: "/release" + operation_id: "create_fileset" + uppercase_operation_id: "CREATE_FILESET" + path: "/fileset" HttpMethod: "Post" httpmethod: "post" noClientExample: true - /release/batch: + /fileset/batch: post: tags: - - "releases" - operationId: "create_release_batch" + - "filesets" + operationId: "create_fileset_batch" parameters: - name: "autoaccept" in: "query" @@ -2347,11 +2347,11 @@ paths: schema: type: "array" items: - $ref: "#/definitions/release_entity" + $ref: "#/definitions/fileset_entity" formatString: "{:?}" example: "&Vec::new()" model_key: "editgroup_edits" - uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_operation_id: "CREATE_FILESET_BATCH" consumesJson: true responses: 201: @@ -2362,7 +2362,7 @@ paths: $ref: "#/definitions/entity_edit" x-responseId: "CreatedEntities" x-uppercaseResponseId: "CREATED_ENTITIES" - uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "VEC" producesJson: true 400: @@ -2371,7 +2371,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2380,7 +2380,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2389,19 +2389,19 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_operation_id: "CREATE_FILESET_BATCH" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "create_release_batch" - uppercase_operation_id: "CREATE_RELEASE_BATCH" - path: "/release/batch" + operation_id: "create_fileset_batch" + uppercase_operation_id: "CREATE_FILESET_BATCH" + path: "/fileset/batch" HttpMethod: "Post" httpmethod: "post" - /release/{ident}: + /fileset/{ident}: get: tags: - - "releases" - operationId: "get_release" + - "filesets" + operationId: "get_fileset" parameters: - name: "ident" in: "path" @@ -2411,16 +2411,16 @@ paths: example: "\"ident_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For releases, 'files',\ - \ 'container', and 'creators' are valid." + description: "List of sub-entities to expand in response. For filesets, none\ + \ accepted (yet)." required: false type: "string" formatString: "{:?}" example: "Some(\"expand_example\".to_string())" - name: "hide" in: "query" - description: "List of entity fields to elide in response. For releases, 'abstracts',\ - \ 'refs', and 'contribs' are valid." + description: "List of entity fields to elide in response. For filesets, 'manifest'\ + \ is accepted." required: false type: "string" formatString: "{:?}" @@ -2429,11 +2429,11 @@ paths: 200: description: "Found Entity" schema: - $ref: "#/definitions/release_entity" + $ref: "#/definitions/fileset_entity" x-responseId: "FoundEntity" x-uppercaseResponseId: "FOUND_ENTITY" - uppercase_operation_id: "GET_RELEASE" - uppercase_data_type: "RELEASEENTITY" + uppercase_operation_id: "GET_FILESET" + uppercase_data_type: "FILESETENTITY" producesJson: true 400: description: "Bad Request" @@ -2441,7 +2441,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE" + uppercase_operation_id: "GET_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2450,7 +2450,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "GET_RELEASE" + uppercase_operation_id: "GET_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2459,18 +2459,18 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "GET_RELEASE" + uppercase_operation_id: "GET_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "get_release" - uppercase_operation_id: "GET_RELEASE" - path: "/release/:ident" + operation_id: "get_fileset" + uppercase_operation_id: "GET_FILESET" + path: "/fileset/:ident" HttpMethod: "Get" httpmethod: "get" put: tags: - - "releases" - operationId: "update_release" + - "filesets" + operationId: "update_fileset" parameters: - name: "ident" in: "path" @@ -2482,13 +2482,13 @@ paths: name: "entity" required: true schema: - $ref: "#/definitions/release_entity" - uppercase_data_type: "RELEASEENTITY" - refName: "release_entity" + $ref: "#/definitions/fileset_entity" + uppercase_data_type: "FILESETENTITY" + refName: "fileset_entity" formatString: "{:?}" example: "???" model_key: "editgroup_edits" - uppercase_operation_id: "UPDATE_RELEASE" + uppercase_operation_id: "UPDATE_FILESET" consumesJson: true - name: "editgroup_id" in: "query" @@ -2503,7 +2503,7 @@ paths: $ref: "#/definitions/entity_edit" x-responseId: "UpdatedEntity" x-uppercaseResponseId: "UPDATED_ENTITY" - uppercase_operation_id: "UPDATE_RELEASE" + uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: @@ -2512,7 +2512,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "UPDATE_RELEASE" + uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2521,7 +2521,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "UPDATE_RELEASE" + uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2530,19 +2530,19 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "UPDATE_RELEASE" + uppercase_operation_id: "UPDATE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "update_release" - uppercase_operation_id: "UPDATE_RELEASE" - path: "/release/:ident" + operation_id: "update_fileset" + uppercase_operation_id: "UPDATE_FILESET" + path: "/fileset/:ident" HttpMethod: "Put" httpmethod: "put" noClientExample: true delete: tags: - - "releases" - operationId: "delete_release" + - "filesets" + operationId: "delete_fileset" parameters: - name: "ident" in: "path" @@ -2563,7 +2563,7 @@ paths: $ref: "#/definitions/entity_edit" x-responseId: "DeletedEntity" x-uppercaseResponseId: "DELETED_ENTITY" - uppercase_operation_id: "DELETE_RELEASE" + uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: @@ -2572,7 +2572,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "DELETE_RELEASE" + uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2581,7 +2581,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "DELETE_RELEASE" + uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2590,19 +2590,19 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "DELETE_RELEASE" + uppercase_operation_id: "DELETE_FILESET" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "delete_release" - uppercase_operation_id: "DELETE_RELEASE" - path: "/release/:ident" + operation_id: "delete_fileset" + uppercase_operation_id: "DELETE_FILESET" + path: "/fileset/:ident" HttpMethod: "Delete" httpmethod: "delete" - /release/rev/{rev_id}: + /fileset/rev/{rev_id}: get: tags: - - "releases" - operationId: "get_release_revision" + - "filesets" + operationId: "get_fileset_revision" parameters: - name: "rev_id" in: "path" @@ -2612,7 +2612,7 @@ paths: example: "\"rev_id_example\".to_string()" - name: "expand" in: "query" - description: "List of sub-entities to expand in response. For releases, none\ + description: "List of sub-entities to expand in response. For filesets, none\ \ accepted (yet)." required: false type: "string" @@ -2620,8 +2620,8 @@ paths: example: "Some(\"expand_example\".to_string())" - name: "hide" in: "query" - description: "List of entity fields to elide in response. For releases, none\ - \ accepted (yet)." + description: "List of entity fields to elide in response. For filesets, 'manifest'\ + \ is accepted." required: false type: "string" formatString: "{:?}" @@ -2630,11 +2630,11 @@ paths: 200: description: "Found Entity Revision" schema: - $ref: "#/definitions/release_entity" + $ref: "#/definitions/fileset_entity" x-responseId: "FoundEntityRevision" x-uppercaseResponseId: "FOUND_ENTITY_REVISION" - uppercase_operation_id: "GET_RELEASE_REVISION" - uppercase_data_type: "RELEASEENTITY" + uppercase_operation_id: "GET_FILESET_REVISION" + uppercase_data_type: "FILESETENTITY" producesJson: true 400: description: "Bad Request" @@ -2642,7 +2642,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_operation_id: "GET_FILESET_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2651,7 +2651,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_operation_id: "GET_FILESET_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2660,19 +2660,19 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_operation_id: "GET_FILESET_REVISION" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "get_release_revision" - uppercase_operation_id: "GET_RELEASE_REVISION" - path: "/release/rev/:rev_id" + operation_id: "get_fileset_revision" + uppercase_operation_id: "GET_FILESET_REVISION" + path: "/fileset/rev/:rev_id" HttpMethod: "Get" httpmethod: "get" - /release/{ident}/history: + /fileset/{ident}/history: get: tags: - - "releases" - operationId: "get_release_history" + - "filesets" + operationId: "get_fileset_history" parameters: - name: "ident" in: "path" @@ -2696,7 +2696,7 @@ paths: $ref: "#/definitions/entity_history_entry" x-responseId: "FoundEntityHistory" x-uppercaseResponseId: "FOUND_ENTITY_HISTORY" - uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_operation_id: "GET_FILESET_HISTORY" uppercase_data_type: "VEC" producesJson: true 400: @@ -2705,7 +2705,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_operation_id: "GET_FILESET_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2714,7 +2714,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_operation_id: "GET_FILESET_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2723,19 +2723,19 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_operation_id: "GET_FILESET_HISTORY" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "get_release_history" - uppercase_operation_id: "GET_RELEASE_HISTORY" - path: "/release/:ident/history" + operation_id: "get_fileset_history" + uppercase_operation_id: "GET_FILESET_HISTORY" + path: "/fileset/:ident/history" HttpMethod: "Get" httpmethod: "get" - /release/{ident}/files: + /fileset/{ident}/redirects: get: tags: - - "releases" - operationId: "get_release_files" + - "filesets" + operationId: "get_fileset_redirects" parameters: - name: "ident" in: "path" @@ -2743,25 +2743,17 @@ paths: type: "string" formatString: "\\\"{}\\\"" example: "\"ident_example\".to_string()" - - name: "hide" - in: "query" - description: "List of entity fields to elide in response. For files, none\ - \ accepted (yet)." - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"hide_example\".to_string())" responses: 200: - description: "Found" + description: "Found Entity Redirects" schema: type: "array" items: - $ref: "#/definitions/file_entity" - x-responseId: "Found" - x-uppercaseResponseId: "FOUND" - uppercase_operation_id: "GET_RELEASE_FILES" - uppercase_data_type: "VEC" + type: "string" + x-responseId: "FoundEntityRedirects" + x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS" + uppercase_operation_id: "GET_FILESET_REDIRECTS" + uppercase_data_type: "VEC" producesJson: true 400: description: "Bad Request" @@ -2769,7 +2761,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_operation_id: "GET_FILESET_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2778,7 +2770,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_operation_id: "GET_FILESET_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2787,37 +2779,36 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_operation_id: "GET_FILESET_REDIRECTS" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "get_release_files" - uppercase_operation_id: "GET_RELEASE_FILES" - path: "/release/:ident/files" + operation_id: "get_fileset_redirects" + uppercase_operation_id: "GET_FILESET_REDIRECTS" + path: "/fileset/:ident/redirects" HttpMethod: "Get" httpmethod: "get" - /release/{ident}/redirects: + /fileset/edit/{edit_id}: get: tags: - - "releases" - operationId: "get_release_redirects" + - "filesets" + operationId: "get_fileset_edit" parameters: - - name: "ident" + - name: "edit_id" in: "path" required: true - type: "string" - formatString: "\\\"{}\\\"" - example: "\"ident_example\".to_string()" + type: "integer" + format: "int64" + formatString: "{}" + example: "789" responses: 200: - description: "Found Entity Redirects" + description: "Found Edit" schema: - type: "array" - items: - type: "string" - x-responseId: "FoundEntityRedirects" - x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" - uppercase_data_type: "VEC" + $ref: "#/definitions/entity_edit" + x-responseId: "FoundEdit" + x-uppercaseResponseId: "FOUND_EDIT" + uppercase_operation_id: "GET_FILESET_EDIT" + uppercase_data_type: "ENTITYEDIT" producesJson: true 400: description: "Bad Request" @@ -2825,7 +2816,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_operation_id: "GET_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2834,7 +2825,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_operation_id: "GET_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2843,80 +2834,35 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_operation_id: "GET_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "get_release_redirects" - uppercase_operation_id: "GET_RELEASE_REDIRECTS" - path: "/release/:ident/redirects" + operation_id: "get_fileset_edit" + uppercase_operation_id: "GET_FILESET_EDIT" + path: "/fileset/edit/:edit_id" HttpMethod: "Get" httpmethod: "get" - /release/lookup: - get: + delete: tags: - - "releases" - operationId: "lookup_release" + - "filesets" + operationId: "delete_fileset_edit" parameters: - - name: "doi" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"doi_example\".to_string())" - - name: "wikidata_qid" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"wikidata_qid_example\".to_string())" - - name: "isbn13" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"isbn13_example\".to_string())" - - name: "pmid" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"pmid_example\".to_string())" - - name: "pmcid" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"pmcid_example\".to_string())" - - name: "core_id" - in: "query" - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"core_id_example\".to_string())" - - name: "expand" - in: "query" - description: "List of sub-entities to expand in response." - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"expand_example\".to_string())" - - name: "hide" - in: "query" - description: "List of entity fields to elide in response. For releases, 'abstracts',\ - \ 'refs', and 'contribs' are valid." - required: false - type: "string" - formatString: "{:?}" - example: "Some(\"hide_example\".to_string())" + - name: "edit_id" + in: "path" + required: true + type: "integer" + format: "int64" + formatString: "{}" + example: "789" responses: 200: - description: "Found Entity" + description: "Deleted Edit" schema: - $ref: "#/definitions/release_entity" - x-responseId: "FoundEntity" - x-uppercaseResponseId: "FOUND_ENTITY" - uppercase_operation_id: "LOOKUP_RELEASE" - uppercase_data_type: "RELEASEENTITY" + $ref: "#/definitions/success" + x-responseId: "DeletedEdit" + x-uppercaseResponseId: "DELETED_EDIT" + uppercase_operation_id: "DELETE_FILESET_EDIT" + uppercase_data_type: "SUCCESS" producesJson: true 400: description: "Bad Request" @@ -2924,7 +2870,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "BadRequest" x-uppercaseResponseId: "BAD_REQUEST" - uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_operation_id: "DELETE_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true 404: @@ -2933,7 +2879,7 @@ paths: $ref: "#/definitions/error_response" x-responseId: "NotFound" x-uppercaseResponseId: "NOT_FOUND" - uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_operation_id: "DELETE_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true 500: @@ -2942,35 +2888,1505 @@ paths: $ref: "#/definitions/error_response" x-responseId: "GenericError" x-uppercaseResponseId: "GENERIC_ERROR" - uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_operation_id: "DELETE_FILESET_EDIT" uppercase_data_type: "ERRORRESPONSE" producesJson: true - operation_id: "lookup_release" - uppercase_operation_id: "LOOKUP_RELEASE" - path: "/release/lookup" - HttpMethod: "Get" - httpmethod: "get" - /release/edit/{edit_id}: - get: + operation_id: "delete_fileset_edit" + uppercase_operation_id: "DELETE_FILESET_EDIT" + path: "/fileset/edit/:edit_id" + HttpMethod: "Delete" + httpmethod: "delete" + /webcapture: + post: tags: - - "releases" - operationId: "get_release_edit" + - "webcaptures" + operationId: "create_webcapture" parameters: - - name: "edit_id" - in: "path" + - in: "body" + name: "entity" required: true - type: "integer" - format: "int64" - formatString: "{}" - example: "789" - responses: - 200: - description: "Found Edit" - schema: - $ref: "#/definitions/entity_edit" - x-responseId: "FoundEdit" - x-uppercaseResponseId: "FOUND_EDIT" - uppercase_operation_id: "GET_RELEASE_EDIT" + schema: + $ref: "#/definitions/webcapture_entity" + uppercase_data_type: "WEBCAPTUREENTITY" + refName: "webcapture_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_WEBCAPTURE" + consumesJson: true + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 201: + description: "Created Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" + uppercase_operation_id: "CREATE_WEBCAPTURE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "CREATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "CREATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_webcapture" + uppercase_operation_id: "CREATE_WEBCAPTURE" + path: "/webcapture" + HttpMethod: "Post" + httpmethod: "post" + noClientExample: true + /webcapture/batch: + post: + tags: + - "webcaptures" + operationId: "create_webcapture_batch" + parameters: + - name: "autoaccept" + in: "query" + description: "If true, and editor is authorized, batch is accepted all at\ + \ once" + required: false + type: "boolean" + formatString: "{:?}" + example: "Some(true)" + - name: "editgroup_id" + in: "query" + description: "Editgroup to auto-accept and apply to all entities (required\ + \ if 'autoaccept' is True)" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + - in: "body" + name: "entity_list" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/webcapture_entity" + formatString: "{:?}" + example: "&Vec::new()" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + consumesJson: true + responses: + 201: + description: "Created Entities" + schema: + type: "array" + items: + $ref: "#/definitions/entity_edit" + x-responseId: "CreatedEntities" + x-uppercaseResponseId: "CREATED_ENTITIES" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_webcapture_batch" + uppercase_operation_id: "CREATE_WEBCAPTURE_BATCH" + path: "/webcapture/batch" + HttpMethod: "Post" + httpmethod: "post" + /webcapture/{ident}: + get: + tags: + - "webcaptures" + operationId: "get_webcapture" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "expand" + in: "query" + description: "List of sub-entities to expand in response. For webcaptures,\ + \ none accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For webcaptures,\ + \ 'cdx' is accepted." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity" + schema: + $ref: "#/definitions/webcapture_entity" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" + uppercase_operation_id: "GET_WEBCAPTURE" + uppercase_data_type: "WEBCAPTUREENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_webcapture" + uppercase_operation_id: "GET_WEBCAPTURE" + path: "/webcapture/:ident" + HttpMethod: "Get" + httpmethod: "get" + put: + tags: + - "webcaptures" + operationId: "update_webcapture" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - in: "body" + name: "entity" + required: true + schema: + $ref: "#/definitions/webcapture_entity" + uppercase_data_type: "WEBCAPTUREENTITY" + refName: "webcapture_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + consumesJson: true + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 200: + description: "Updated Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "UpdatedEntity" + x-uppercaseResponseId: "UPDATED_ENTITY" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "update_webcapture" + uppercase_operation_id: "UPDATE_WEBCAPTURE" + path: "/webcapture/:ident" + HttpMethod: "Put" + httpmethod: "put" + noClientExample: true + delete: + tags: + - "webcaptures" + operationId: "delete_webcapture" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 200: + description: "Deleted Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "DeletedEntity" + x-uppercaseResponseId: "DELETED_ENTITY" + uppercase_operation_id: "DELETE_WEBCAPTURE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "DELETE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "DELETE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "DELETE_WEBCAPTURE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "delete_webcapture" + uppercase_operation_id: "DELETE_WEBCAPTURE" + path: "/webcapture/:ident" + HttpMethod: "Delete" + httpmethod: "delete" + /webcapture/rev/{rev_id}: + get: + tags: + - "webcaptures" + operationId: "get_webcapture_revision" + parameters: + - name: "rev_id" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"rev_id_example\".to_string()" + - name: "expand" + in: "query" + description: "List of sub-entities to expand in response. For webcaptures,\ + \ none accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For webcaptures,\ + \ 'cdx' is accepted." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity Revision" + schema: + $ref: "#/definitions/webcapture_entity" + x-responseId: "FoundEntityRevision" + x-uppercaseResponseId: "FOUND_ENTITY_REVISION" + uppercase_operation_id: "GET_WEBCAPTURE_REVISION" + uppercase_data_type: "WEBCAPTUREENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_WEBCAPTURE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_WEBCAPTURE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_WEBCAPTURE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_webcapture_revision" + uppercase_operation_id: "GET_WEBCAPTURE_REVISION" + path: "/webcapture/rev/:rev_id" + HttpMethod: "Get" + httpmethod: "get" + /webcapture/{ident}/history: + get: + tags: + - "webcaptures" + operationId: "get_webcapture_history" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "limit" + in: "query" + required: false + type: "integer" + format: "int64" + formatString: "{:?}" + example: "Some(789)" + responses: + 200: + description: "Found Entity History" + schema: + type: "array" + items: + $ref: "#/definitions/entity_history_entry" + x-responseId: "FoundEntityHistory" + x-uppercaseResponseId: "FOUND_ENTITY_HISTORY" + uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_webcapture_history" + uppercase_operation_id: "GET_WEBCAPTURE_HISTORY" + path: "/webcapture/:ident/history" + HttpMethod: "Get" + httpmethod: "get" + /webcapture/{ident}/redirects: + get: + tags: + - "webcaptures" + operationId: "get_webcapture_redirects" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + responses: + 200: + description: "Found Entity Redirects" + schema: + type: "array" + items: + type: "string" + x-responseId: "FoundEntityRedirects" + x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS" + uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_webcapture_redirects" + uppercase_operation_id: "GET_WEBCAPTURE_REDIRECTS" + path: "/webcapture/:ident/redirects" + HttpMethod: "Get" + httpmethod: "get" + /webcapture/edit/{edit_id}: + get: + tags: + - "webcaptures" + operationId: "get_webcapture_edit" + parameters: + - name: "edit_id" + in: "path" + required: true + type: "integer" + format: "int64" + formatString: "{}" + example: "789" + responses: + 200: + description: "Found Edit" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "FoundEdit" + x-uppercaseResponseId: "FOUND_EDIT" + uppercase_operation_id: "GET_WEBCAPTURE_EDIT" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_webcapture_edit" + uppercase_operation_id: "GET_WEBCAPTURE_EDIT" + path: "/webcapture/edit/:edit_id" + HttpMethod: "Get" + httpmethod: "get" + delete: + tags: + - "webcaptures" + operationId: "delete_webcapture_edit" + parameters: + - name: "edit_id" + in: "path" + required: true + type: "integer" + format: "int64" + formatString: "{}" + example: "789" + responses: + 200: + description: "Deleted Edit" + schema: + $ref: "#/definitions/success" + x-responseId: "DeletedEdit" + x-uppercaseResponseId: "DELETED_EDIT" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + uppercase_data_type: "SUCCESS" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "delete_webcapture_edit" + uppercase_operation_id: "DELETE_WEBCAPTURE_EDIT" + path: "/webcapture/edit/:edit_id" + HttpMethod: "Delete" + httpmethod: "delete" + /release: + post: + tags: + - "releases" + operationId: "create_release" + parameters: + - in: "body" + name: "entity" + required: true + schema: + $ref: "#/definitions/release_entity" + uppercase_data_type: "RELEASEENTITY" + refName: "release_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_RELEASE" + consumesJson: true + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 201: + description: "Created Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "CreatedEntity" + x-uppercaseResponseId: "CREATED_ENTITY" + uppercase_operation_id: "CREATE_RELEASE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "CREATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "CREATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_release" + uppercase_operation_id: "CREATE_RELEASE" + path: "/release" + HttpMethod: "Post" + httpmethod: "post" + noClientExample: true + /release/batch: + post: + tags: + - "releases" + operationId: "create_release_batch" + parameters: + - name: "autoaccept" + in: "query" + description: "If true, and editor is authorized, batch is accepted all at\ + \ once" + required: false + type: "boolean" + formatString: "{:?}" + example: "Some(true)" + - name: "editgroup_id" + in: "query" + description: "Editgroup to auto-accept and apply to all entities (required\ + \ if 'autoaccept' is True)" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + - in: "body" + name: "entity_list" + required: true + schema: + type: "array" + items: + $ref: "#/definitions/release_entity" + formatString: "{:?}" + example: "&Vec::new()" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + consumesJson: true + responses: + 201: + description: "Created Entities" + schema: + type: "array" + items: + $ref: "#/definitions/entity_edit" + x-responseId: "CreatedEntities" + x-uppercaseResponseId: "CREATED_ENTITIES" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_release_batch" + uppercase_operation_id: "CREATE_RELEASE_BATCH" + path: "/release/batch" + HttpMethod: "Post" + httpmethod: "post" + /release/{ident}: + get: + tags: + - "releases" + operationId: "get_release" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "expand" + in: "query" + description: "List of sub-entities to expand in response. For releases, 'files',\ + \ 'filesets, 'webcaptures', 'container', and 'creators' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, 'abstracts',\ + \ 'refs', and 'contribs' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity" + schema: + $ref: "#/definitions/release_entity" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" + uppercase_operation_id: "GET_RELEASE" + uppercase_data_type: "RELEASEENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release" + uppercase_operation_id: "GET_RELEASE" + path: "/release/:ident" + HttpMethod: "Get" + httpmethod: "get" + put: + tags: + - "releases" + operationId: "update_release" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - in: "body" + name: "entity" + required: true + schema: + $ref: "#/definitions/release_entity" + uppercase_data_type: "RELEASEENTITY" + refName: "release_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "UPDATE_RELEASE" + consumesJson: true + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 200: + description: "Updated Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "UpdatedEntity" + x-uppercaseResponseId: "UPDATED_ENTITY" + uppercase_operation_id: "UPDATE_RELEASE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "UPDATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "UPDATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "UPDATE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "update_release" + uppercase_operation_id: "UPDATE_RELEASE" + path: "/release/:ident" + HttpMethod: "Put" + httpmethod: "put" + noClientExample: true + delete: + tags: + - "releases" + operationId: "delete_release" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "editgroup_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"editgroup_id_example\".to_string())" + responses: + 200: + description: "Deleted Entity" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "DeletedEntity" + x-uppercaseResponseId: "DELETED_ENTITY" + uppercase_operation_id: "DELETE_RELEASE" + uppercase_data_type: "ENTITYEDIT" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "DELETE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "DELETE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "DELETE_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "delete_release" + uppercase_operation_id: "DELETE_RELEASE" + path: "/release/:ident" + HttpMethod: "Delete" + httpmethod: "delete" + /release/rev/{rev_id}: + get: + tags: + - "releases" + operationId: "get_release_revision" + parameters: + - name: "rev_id" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"rev_id_example\".to_string()" + - name: "expand" + in: "query" + description: "List of sub-entities to expand in response. For releases, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For releases, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity Revision" + schema: + $ref: "#/definitions/release_entity" + x-responseId: "FoundEntityRevision" + x-uppercaseResponseId: "FOUND_ENTITY_REVISION" + uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_data_type: "RELEASEENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_revision" + uppercase_operation_id: "GET_RELEASE_REVISION" + path: "/release/rev/:rev_id" + HttpMethod: "Get" + httpmethod: "get" + /release/{ident}/history: + get: + tags: + - "releases" + operationId: "get_release_history" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "limit" + in: "query" + required: false + type: "integer" + format: "int64" + formatString: "{:?}" + example: "Some(789)" + responses: + 200: + description: "Found Entity History" + schema: + type: "array" + items: + $ref: "#/definitions/entity_history_entry" + x-responseId: "FoundEntityHistory" + x-uppercaseResponseId: "FOUND_ENTITY_HISTORY" + uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_history" + uppercase_operation_id: "GET_RELEASE_HISTORY" + path: "/release/:ident/history" + HttpMethod: "Get" + httpmethod: "get" + /release/{ident}/files: + get: + tags: + - "releases" + operationId: "get_release_files" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For files, none\ + \ accepted (yet)." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found" + schema: + type: "array" + items: + $ref: "#/definitions/file_entity" + x-responseId: "Found" + x-uppercaseResponseId: "FOUND" + uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_FILES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_files" + uppercase_operation_id: "GET_RELEASE_FILES" + path: "/release/:ident/files" + HttpMethod: "Get" + httpmethod: "get" + /release/{ident}/filesets: + get: + tags: + - "releases" + operationId: "get_release_filesets" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For filesets, 'manifest'\ + \ is valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found" + schema: + type: "array" + items: + $ref: "#/definitions/fileset_entity" + x-responseId: "Found" + x-uppercaseResponseId: "FOUND" + uppercase_operation_id: "GET_RELEASE_FILESETS" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_FILESETS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_FILESETS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_FILESETS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_filesets" + uppercase_operation_id: "GET_RELEASE_FILESETS" + path: "/release/:ident/filesets" + HttpMethod: "Get" + httpmethod: "get" + /release/{ident}/webcaptures: + get: + tags: + - "releases" + operationId: "get_release_webcaptures" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - name: "hide" + in: "query" + description: "List of entity fields to elide in response. For webcaptures,\ + \ 'cdx' is valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found" + schema: + type: "array" + items: + $ref: "#/definitions/webcapture_entity" + x-responseId: "Found" + x-uppercaseResponseId: "FOUND" + uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_webcaptures" + uppercase_operation_id: "GET_RELEASE_WEBCAPTURES" + path: "/release/:ident/webcaptures" + HttpMethod: "Get" + httpmethod: "get" + /release/{ident}/redirects: + get: + tags: + - "releases" + operationId: "get_release_redirects" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + responses: + 200: + description: "Found Entity Redirects" + schema: + type: "array" + items: + type: "string" + x-responseId: "FoundEntityRedirects" + x-uppercaseResponseId: "FOUND_ENTITY_REDIRECTS" + uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_data_type: "VEC" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "GET_RELEASE_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_release_redirects" + uppercase_operation_id: "GET_RELEASE_REDIRECTS" + path: "/release/:ident/redirects" + HttpMethod: "Get" + httpmethod: "get" + /release/lookup: + get: + tags: + - "releases" + operationId: "lookup_release" + parameters: + - name: "doi" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"doi_example\".to_string())" + - name: "wikidata_qid" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"wikidata_qid_example\".to_string())" + - name: "isbn13" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"isbn13_example\".to_string())" + - name: "pmid" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"pmid_example\".to_string())" + - name: "pmcid" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"pmcid_example\".to_string())" + - name: "core_id" + in: "query" + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"core_id_example\".to_string())" + - name: "expand" + in: "query" + description: "List of sub-entities to expand in response." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"expand_example\".to_string())" + - name: "hide" + in: "query" + description: "List of sub-entities to expand in response. For releases, 'files',\ + \ 'filesets, 'webcaptures', 'container', and 'creators' are valid." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity" + schema: + $ref: "#/definitions/release_entity" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" + uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_data_type: "RELEASEENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 404: + description: "Not Found" + schema: + $ref: "#/definitions/error_response" + x-responseId: "NotFound" + x-uppercaseResponseId: "NOT_FOUND" + uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + 500: + description: "Generic Error" + schema: + $ref: "#/definitions/error_response" + x-responseId: "GenericError" + x-uppercaseResponseId: "GENERIC_ERROR" + uppercase_operation_id: "LOOKUP_RELEASE" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "lookup_release" + uppercase_operation_id: "LOOKUP_RELEASE" + path: "/release/lookup" + HttpMethod: "Get" + httpmethod: "get" + /release/edit/{edit_id}: + get: + tags: + - "releases" + operationId: "get_release_edit" + parameters: + - name: "edit_id" + in: "path" + required: true + type: "integer" + format: "int64" + formatString: "{}" + example: "789" + responses: + 200: + description: "Found Edit" + schema: + $ref: "#/definitions/entity_edit" + x-responseId: "FoundEdit" + x-uppercaseResponseId: "FOUND_EDIT" + uppercase_operation_id: "GET_RELEASE_EDIT" uppercase_data_type: "ENTITYEDIT" producesJson: true 400: @@ -3608,8 +5024,8 @@ paths: example: "\"ident_example\".to_string()" - name: "hide" in: "query" - description: "List of entity fields to elide in response. For releases, 'abstracts',\ - \ 'refs', and 'contribs' are valid." + description: "List of entity fields to elide in response. For works, none\ + \ implemented yet." required: false type: "string" formatString: "{:?}" @@ -4368,6 +5784,168 @@ definitions: edit_extra: "{}" md5: "d41efcc592d1e40ac13905377399eb9b" upperCaseName: "FILE_ENTITY" + fileset_entity: + type: "object" + properties: + release_ids: + type: "array" + items: + type: "string" + urls: + type: "array" + items: + $ref: "#/definitions/file_entity_urls" + manifest: + type: "array" + items: + $ref: "#/definitions/fileset_entity_manifest" + state: + type: "string" + enum: + - "wip" + - "active" + - "redirect" + - "deleted" + ident: + type: "string" + example: "q3nouwy3nnbsvo3h5klxsx4a7y" + description: "base32-encoded unique identifier" + minLength: 26 + maxLength: 26 + pattern: "[a-zA-Z2-7]{26}" + revision: + type: "string" + example: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + description: "UUID (lower-case, dash-separated, hex-encoded 128-bit)" + minLength: 36 + maxLength: 36 + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + redirect: + type: "string" + example: "q3nouwy3nnbsvo3h5klxsx4a7y" + description: "base32-encoded unique identifier" + minLength: 26 + maxLength: 26 + pattern: "[a-zA-Z2-7]{26}" + extra: + type: "object" + edit_extra: + type: "object" + example: + redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + urls: + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + manifest: + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + upperCaseName: "FILESET_ENTITY" + webcapture_entity: + type: "object" + properties: + release_ids: + type: "array" + items: + type: "string" + timestamp: + type: "string" + format: "date-time" + original_url: + type: "string" + example: "http://asheesh.org" + archive_urls: + type: "array" + items: + $ref: "#/definitions/webcapture_entity_archive_urls" + cdx: + type: "array" + items: + $ref: "#/definitions/webcapture_entity_cdx" + edit_extra: + type: "object" + extra: + type: "object" + redirect: + type: "string" + example: "q3nouwy3nnbsvo3h5klxsx4a7y" + description: "base32-encoded unique identifier" + minLength: 26 + maxLength: 26 + pattern: "[a-zA-Z2-7]{26}" + revision: + type: "string" + example: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + description: "UUID (lower-case, dash-separated, hex-encoded 128-bit)" + minLength: 36 + maxLength: 36 + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + ident: + type: "string" + example: "q3nouwy3nnbsvo3h5klxsx4a7y" + description: "base32-encoded unique identifier" + minLength: 26 + maxLength: 26 + pattern: "[a-zA-Z2-7]{26}" + state: + type: "string" + enum: + - "wip" + - "active" + - "redirect" + - "deleted" + example: + redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + archive_urls: + - rel: "wayback" + url: "https://web.archive.org/web/" + - rel: "wayback" + url: "https://web.archive.org/web/" + original_url: "http://asheesh.org" + cdx: + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + timestamp: "2000-01-23T04:56:07.000+00:00" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + upperCaseName: "WEBCAPTURE_ENTITY" release_entity: type: "object" properties: @@ -4424,6 +6002,16 @@ definitions: container_id: type: "string" example: "q3nouwy3nnbsvo3h5klxsx4a7y" + webcaptures: + type: "array" + description: "Optional; GET-only" + items: + $ref: "#/definitions/webcapture_entity" + filesets: + type: "array" + description: "Optional; GET-only" + items: + $ref: "#/definitions/fileset_entity" files: type: "array" description: "Optional; GET-only" @@ -4484,6 +6072,69 @@ definitions: state: "wip" edit_extra: "{}" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + archive_urls: + - rel: "wayback" + url: "https://web.archive.org/web/" + - rel: "wayback" + url: "https://web.archive.org/web/" + original_url: "http://asheesh.org" + cdx: + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + timestamp: "2000-01-23T04:56:07.000+00:00" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + archive_urls: + - rel: "wayback" + url: "https://web.archive.org/web/" + - rel: "wayback" + url: "https://web.archive.org/web/" + original_url: "http://asheesh.org" + cdx: + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + - sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + timestamp: "2000-01-23T04:56:07.000+00:00" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" language: "language" title: "title" @@ -4605,6 +6256,61 @@ definitions: - "release_ids" edit_extra: "{}" md5: "d41efcc592d1e40ac13905377399eb9b" + filesets: + - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + urls: + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + manifest: + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - redirect: "q3nouwy3nnbsvo3h5klxsx4a7y" + urls: + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + - rel: "webarchive" + url: "https://example.edu/~frau/prcding.pdf" + manifest: + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + - sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + extra: "{}" + state: "wip" + release_ids: + - "release_ids" + - "release_ids" + edit_extra: "{}" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" pmcid: "pmcid" container_id: "q3nouwy3nnbsvo3h5klxsx4a7y" doi: "10.1234/abcde.789" @@ -4670,6 +6376,21 @@ definitions: extra: "{}" edits: works: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -4715,6 +6436,21 @@ definitions: prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" containers: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -4760,6 +6496,21 @@ definitions: extra: "{}" edits: works: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -4805,6 +6556,21 @@ definitions: prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" containers: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -4922,6 +6688,21 @@ definitions: extra: "{}" edits: works: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -4967,6 +6748,21 @@ definitions: prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" containers: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -5023,6 +6819,21 @@ definitions: extra: "{}" edits: works: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -5068,6 +6879,21 @@ definitions: prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" containers: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -5188,6 +7014,93 @@ definitions: rel: "webarchive" url: "https://example.edu/~frau/prcding.pdf" upperCaseName: "FILE_ENTITY_URLS" + fileset_entity_manifest: + required: + - "path" + - "size" + properties: + path: + type: "string" + example: "img/cat.png" + size: + type: "integer" + format: "int64" + example: 1048576 + md5: + type: "string" + example: "d41efcc592d1e40ac13905377399eb9b" + sha1: + type: "string" + example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + sha256: + type: "string" + example: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: + type: "object" + example: + sha1: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" + path: "img/cat.png" + size: 1048576 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + extra: "{}" + md5: "d41efcc592d1e40ac13905377399eb9b" + upperCaseName: "FILESET_ENTITY_MANIFEST" + webcapture_entity_archive_urls: + required: + - "rel" + - "url" + properties: + url: + type: "string" + format: "url" + example: "https://web.archive.org/web/" + rel: + type: "string" + example: "wayback" + example: + rel: "wayback" + url: "https://web.archive.org/web/" + upperCaseName: "WEBCAPTURE_ENTITY_ARCHIVE_URLS" + webcapture_entity_cdx: + required: + - "sha1" + - "status_code" + - "surt" + - "timestamp" + - "url" + properties: + surt: + type: "string" + example: "org,asheesh)/apus/ch1/node15.html" + timestamp: + type: "integer" + format: "int64" + example: 20020429162520 + url: + type: "string" + example: "http://www.asheesh.org:80/APUS/ch1/node15.html" + mimetype: + type: "string" + example: "text/html" + status_code: + type: "integer" + format: "int64" + example: 200 + sha1: + type: "string" + example: "3f242a192acc258bdfdb151943419437f440c313" + sha256: + type: "string" + example: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + example: + sha1: "3f242a192acc258bdfdb151943419437f440c313" + surt: "org,asheesh)/apus/ch1/node15.html" + status_code: 200 + sha256: "a77e4c11a57f1d757fca5754a8f83b5d4ece49a2d28596889127c1a2f3f28832" + mimetype: "text/html" + url: "http://www.asheesh.org:80/APUS/ch1/node15.html" + timestamp: 20020429162520 + upperCaseName: "WEBCAPTURE_ENTITY_CDX" release_entity_abstracts: properties: sha1: @@ -5222,6 +7135,14 @@ definitions: type: "array" items: $ref: "#/definitions/entity_edit" + filesets: + type: "array" + items: + $ref: "#/definitions/entity_edit" + webcaptures: + type: "array" + items: + $ref: "#/definitions/entity_edit" releases: type: "array" items: @@ -5232,6 +7153,21 @@ definitions: $ref: "#/definitions/entity_edit" example: works: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" @@ -5277,6 +7213,21 @@ definitions: prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" containers: + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + edit_id: 847 + extra: "{}" + redirect_ident: "q3nouwy3nnbsvo3h5klxsx4a7y" + editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" + prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 extra: "{}" diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs index 34131db7..52a9e16a 100644 --- a/rust/fatcat-api-spec/examples/client.rs +++ b/rust/fatcat-api-spec/examples/client.rs @@ -13,14 +13,17 @@ use clap::{App, Arg}; #[allow(unused_imports)] use fatcat::{ AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, - CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, - DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, - DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, - GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, - GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, - GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetWorkEditResponse, + CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, + CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, + DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, + DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, + GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, + GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, + GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, + GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, - LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; #[allow(unused_imports)] use futures::{future, stream, Future, Stream}; @@ -65,16 +68,34 @@ fn main() { "GetFileRedirects", "GetFileRevision", "LookupFile", + "CreateFilesetBatch", + "DeleteFileset", + "DeleteFilesetEdit", + "GetFileset", + "GetFilesetEdit", + "GetFilesetHistory", + "GetFilesetRedirects", + "GetFilesetRevision", "CreateReleaseBatch", "DeleteRelease", "DeleteReleaseEdit", "GetRelease", "GetReleaseEdit", "GetReleaseFiles", + "GetReleaseFilesets", "GetReleaseHistory", "GetReleaseRedirects", "GetReleaseRevision", + "GetReleaseWebcaptures", "LookupRelease", + "CreateWebcaptureBatch", + "DeleteWebcapture", + "DeleteWebcaptureEdit", + "GetWebcapture", + "GetWebcaptureEdit", + "GetWebcaptureHistory", + "GetWebcaptureRedirects", + "GetWebcaptureRevision", "CreateWorkBatch", "DeleteWork", "DeleteWorkEdit", @@ -353,6 +374,61 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, + // Disabled because there's no example. + // Some("CreateFileset") => { + // let result = client.create_fileset(???, Some("editgroup_id_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, + Some("CreateFilesetBatch") => { + let result = client.create_fileset_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("DeleteFileset") => { + let result = client.delete_fileset("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("DeleteFilesetEdit") => { + let result = client.delete_fileset_edit(789).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetFileset") => { + let result = client + .get_fileset("ident_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetFilesetEdit") => { + let result = client.get_fileset_edit(789).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetFilesetHistory") => { + let result = client.get_fileset_history("ident_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetFilesetRedirects") => { + let result = client.get_fileset_redirects("ident_example".to_string()).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetFilesetRevision") => { + let result = client + .get_fileset_revision("rev_id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + // Disabled because there's no example. + // Some("UpdateFileset") => { + // let result = client.update_fileset("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, + // Disabled because there's no example. // Some("CreateRelease") => { // let result = client.create_release(???, Some("editgroup_id_example".to_string())).wait(); @@ -395,6 +471,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetReleaseFilesets") => { + let result = client.get_release_filesets("ident_example".to_string(), Some("hide_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("GetReleaseHistory") => { let result = client.get_release_history("ident_example".to_string(), Some(789)).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); @@ -412,6 +493,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetReleaseWebcaptures") => { + let result = client.get_release_webcaptures("ident_example".to_string(), Some("hide_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("LookupRelease") => { let result = client .lookup_release( @@ -433,6 +519,61 @@ fn main() { // let result = client.update_release("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); // }, + + // Disabled because there's no example. + // Some("CreateWebcapture") => { + // let result = client.create_webcapture(???, Some("editgroup_id_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, + Some("CreateWebcaptureBatch") => { + let result = client.create_webcapture_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("DeleteWebcapture") => { + let result = client.delete_webcapture("ident_example".to_string(), Some("editgroup_id_example".to_string())).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("DeleteWebcaptureEdit") => { + let result = client.delete_webcapture_edit(789).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetWebcapture") => { + let result = client + .get_webcapture("ident_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetWebcaptureEdit") => { + let result = client.get_webcapture_edit(789).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetWebcaptureHistory") => { + let result = client.get_webcapture_history("ident_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetWebcaptureRedirects") => { + let result = client.get_webcapture_redirects("ident_example".to_string()).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + Some("GetWebcaptureRevision") => { + let result = client + .get_webcapture_revision("rev_id_example".to_string(), Some("expand_example".to_string()), Some("hide_example".to_string())) + .wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + + // Disabled because there's no example. + // Some("UpdateWebcapture") => { + // let result = client.update_webcapture("ident_example".to_string(), ???, Some("editgroup_id_example".to_string())).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + // }, Some("CreateWorkBatch") => { let result = client.create_work_batch(&Vec::new(), Some(true), Some("editgroup_id_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs index bbd00b83..ad41ff27 100644 --- a/rust/fatcat-api-spec/examples/server_lib/server.rs +++ b/rust/fatcat-api-spec/examples/server_lib/server.rs @@ -12,14 +12,17 @@ use swagger; use fatcat::models; use fatcat::{ AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, - DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse, - GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, - GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, - GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, + CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, + CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, + DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, + DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, + GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, + GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, + GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, + GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, + GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, + UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; #[derive(Copy, Clone)] @@ -462,6 +465,111 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "create_fileset({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn create_fileset_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + let context = context.clone(); + println!( + "create_fileset_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + entity_list, + autoaccept, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_fileset(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "delete_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_fileset_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_fileset_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_fileset_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_fileset_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_redirects(&self, ident: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_fileset_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_fileset_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "update_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -548,6 +656,17 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_release_filesets(&self, ident: String, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_release_filesets(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn get_release_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send> { let context = context.clone(); println!( @@ -577,6 +696,17 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn get_release_webcaptures(&self, ident: String, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_release_webcaptures(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn lookup_release( &self, doi: Option, @@ -617,6 +747,117 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "create_webcapture({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn create_webcapture_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + let context = context.clone(); + println!( + "create_webcapture_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", + entity_list, + autoaccept, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_webcapture(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "delete_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("delete_webcapture_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_webcapture_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_webcapture_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_redirects(&self, ident: String, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("get_webcapture_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send> { + let context = context.clone(); + println!( + "get_webcapture_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn update_webcapture( + &self, + ident: String, + entity: models::WebcaptureEntity, + editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + let context = context.clone(); + println!( + "update_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn create_work_batch( &self, entity_list: &Vec, diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs index 1898f0b5..c764df6f 100644 --- a/rust/fatcat-api-spec/src/client.rs +++ b/rust/fatcat-api-spec/src/client.rs @@ -36,14 +36,17 @@ use swagger::{ApiError, Context, XSpanId}; use models; use { AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, - CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, - DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse, - GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, - GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, - GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, + CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, + CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, + DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, + DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, + GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, + GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, + GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, GetReleaseFilesResponse, + GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, + GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, + GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, + UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; /// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes. @@ -3018,12 +3021,12 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_fileset(&self, param_entity: models::FilesetEntity, param_editgroup_id: Option, context: &Context) -> Box + Send> { // Query parameters let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); let url = format!( - "{}/v0/release?{editgroup_id}", + "{}/v0/fileset?{editgroup_id}", self.base_path, editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) ); @@ -3036,41 +3039,41 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.clone())); + custom_headers.set(ContentType(mimetypes::requests::CREATE_FILESET.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseResponse::CreatedEntity(body)) + Ok(CreateFilesetResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseResponse::BadRequest(body)) + Ok(CreateFilesetResponse::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::(&buf)?; - Ok(CreateReleaseResponse::NotFound(body)) + Ok(CreateFilesetResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseResponse::GenericError(body)) + Ok(CreateFilesetResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3090,67 +3093,1610 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_release_batch( + fn create_fileset_batch( &self, - param_entity_list: &Vec, + param_entity_list: &Vec, param_autoaccept: Option, param_editgroup_id: Option, context: &Context, - ) -> Box + Send> { + ) -> Box + Send> { + // Query parameters + let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/fileset/batch?{autoaccept}{editgroup_id}", + self.base_path, + autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Post, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_FILESET_BATCH.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(CreateFilesetBatchResponse::CreatedEntities(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFilesetBatchResponse::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::(&buf)?; + + Ok(CreateFilesetBatchResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateFilesetBatchResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_fileset(&self, param_ident: String, param_editgroup_id: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/fileset/{ident}?{editgroup_id}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Delete, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetResponse::DeletedEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetResponse::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::(&buf)?; + + Ok(DeleteFilesetResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_fileset_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/fileset/edit/{edit_id}", + self.base_path, + edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Delete, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetEditResponse::DeletedEdit(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetEditResponse::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::(&buf)?; + + Ok(DeleteFilesetEditResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteFilesetEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset(&self, param_ident: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/fileset/{ident}?{expand}{hide}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetResponse::FoundEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetResponse::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::(&buf)?; + + Ok(GetFilesetResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/fileset/edit/{edit_id}", + self.base_path, + edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetEditResponse::FoundEdit(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetEditResponse::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::(&buf)?; + + Ok(GetFilesetEditResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_history(&self, param_ident: String, param_limit: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); + + let url = format!( + "{}/v0/fileset/{ident}/history?{limit}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetFilesetHistoryResponse::FoundEntityHistory(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetHistoryResponse::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::(&buf)?; + + Ok(GetFilesetHistoryResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetHistoryResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_redirects(&self, param_ident: String, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/fileset/{ident}/redirects", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetFilesetRedirectsResponse::FoundEntityRedirects(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetRedirectsResponse::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::(&buf)?; + + Ok(GetFilesetRedirectsResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetRedirectsResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_revision( + &self, + param_rev_id: String, + param_expand: Option, + param_hide: Option, + context: &Context, + ) -> Box + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/fileset/rev/{rev_id}?{expand}{hide}", + self.base_path, + rev_id = utf8_percent_encode(¶m_rev_id.to_string(), PATH_SEGMENT_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetRevisionResponse::FoundEntityRevision(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetRevisionResponse::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::(&buf)?; + + Ok(GetFilesetRevisionResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetFilesetRevisionResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn update_fileset( + &self, + param_ident: String, + param_entity: models::FilesetEntity, + param_editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + // Query parameters + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/fileset/{ident}?{editgroup_id}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Put, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::UPDATE_FILESET.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateFilesetResponse::UpdatedEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateFilesetResponse::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::(&buf)?; + + Ok(UpdateFilesetResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(UpdateFilesetResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/release?{editgroup_id}", + self.base_path, + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Post, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseResponse::CreatedEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn create_release_batch( + &self, + param_entity_list: &Vec, + param_autoaccept: Option, + param_editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + // Query parameters + let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/release/batch?{autoaccept}{editgroup_id}", + self.base_path, + autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Post, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(CreateReleaseBatchResponse::CreatedEntities(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseBatchResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseBatchResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateReleaseBatchResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn create_work(&self, param_entity: models::WorkEntity, param_editgroup_id: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!("{}/v0/work?{editgroup_id}", self.base_path, editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET)); + + let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Post, &url); + let mut custom_headers = hyper::header::Headers::new(); + + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK.clone())); + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkResponse::CreatedEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(CreateWorkResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_release(&self, param_ident: String, param_editgroup_id: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}?{editgroup_id}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Delete, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseResponse::DeletedEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_release_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/release/edit/{edit_id}", + self.base_path, + edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Delete, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseEditResponse::DeletedEdit(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseEditResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseEditResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(DeleteReleaseEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release(&self, param_ident: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}?{expand}{hide}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseResponse::FoundEntity(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/release/edit/{edit_id}", + self.base_path, + edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseEditResponse::FoundEdit(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseEditResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseEditResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_files(&self, param_ident: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}/files?{hide}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetReleaseFilesResponse::Found(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseFilesResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseFilesResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseFilesResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_filesets(&self, param_ident: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}/filesets?{hide}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetReleaseFilesetsResponse::Found(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseFilesetsResponse::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::(&buf)?; + + Ok(GetReleaseFilesetsResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseFilesetsResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_history(&self, param_ident: String, param_limit: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}/history?{limit}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetReleaseHistoryResponse::FoundEntityHistory(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseHistoryResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseHistoryResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseHistoryResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_redirects(&self, param_ident: String, context: &Context) -> Box + Send> { + let url = format!( + "{}/v0/release/{ident}/redirects", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetReleaseRedirectsResponse::FoundEntityRedirects(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRedirectsResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRedirectsResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRedirectsResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_revision( + &self, + param_rev_id: String, + param_expand: Option, + param_hide: Option, + context: &Context, + ) -> Box + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/rev/{rev_id}?{expand}{hide}", + self.base_path, + rev_id = utf8_percent_encode(¶m_rev_id.to_string(), PATH_SEGMENT_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRevisionResponse::FoundEntityRevision(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRevisionResponse::BadRequest(body)) + } + 404 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRevisionResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseRevisionResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_release_webcaptures(&self, param_ident: String, param_hide: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/release/{ident}/webcaptures?{hide}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ); + + let hyper_client = (self.hyper_client)(); + let request = hyper_client.request(hyper::method::Method::Get, &url); + let mut custom_headers = hyper::header::Headers::new(); + + context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); + + let request = request.headers(custom_headers); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn parse_response(mut response: hyper::client::response::Response) -> Result { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::>(&buf)?; + + Ok(GetReleaseWebcapturesResponse::Found(body)) + } + 400 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseWebcapturesResponse::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::(&buf)?; + + Ok(GetReleaseWebcapturesResponse::NotFound(body)) + } + 500 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::(&buf)?; + + Ok(GetReleaseWebcapturesResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn lookup_release( + &self, + param_doi: Option, + param_wikidata_qid: Option, + param_isbn13: Option, + param_pmid: Option, + param_pmcid: Option, + param_core_id: Option, + param_expand: Option, + param_hide: Option, + context: &Context, + ) -> Box + Send> { // Query parameters - let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); - let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let query_doi = param_doi.map_or_else(String::new, |query| format!("doi={doi}&", doi = query.to_string())); + let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = query.to_string())); + let query_isbn13 = param_isbn13.map_or_else(String::new, |query| format!("isbn13={isbn13}&", isbn13 = query.to_string())); + let query_pmid = param_pmid.map_or_else(String::new, |query| format!("pmid={pmid}&", pmid = query.to_string())); + let query_pmcid = param_pmcid.map_or_else(String::new, |query| format!("pmcid={pmcid}&", pmcid = query.to_string())); + let query_core_id = param_core_id.map_or_else(String::new, |query| format!("core_id={core_id}&", core_id = query.to_string())); + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); let url = format!( - "{}/v0/release/batch?{autoaccept}{editgroup_id}", + "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core_id}{expand}{hide}", self.base_path, - autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), - editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET), + wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET), + isbn13 = utf8_percent_encode(&query_isbn13, QUERY_ENCODE_SET), + pmid = utf8_percent_encode(&query_pmid, QUERY_ENCODE_SET), + pmcid = utf8_percent_encode(&query_pmcid, QUERY_ENCODE_SET), + core_id = utf8_percent_encode(&query_core_id, QUERY_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), + hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); - let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); - let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Post, &url); + let request = hyper_client.request(hyper::method::Method::Get, &url); let mut custom_headers = hyper::header::Headers::new(); - let request = request.body(&body); - - custom_headers.set(ContentType(mimetypes::requests::CREATE_RELEASE_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { - 201 => { + 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::CreatedEntities(body)) + Ok(LookupReleaseResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::BadRequest(body)) + Ok(LookupReleaseResponse::BadRequest(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::NotFound(body)) + Ok(LookupReleaseResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateReleaseBatchResponse::GenericError(body)) + Ok(LookupReleaseResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3170,55 +4716,66 @@ impl Api for Client { Box::new(futures::done(result)) } - fn create_work(&self, param_entity: models::WorkEntity, param_editgroup_id: Option, context: &Context) -> Box + Send> { + fn update_release( + &self, + param_ident: String, + param_entity: models::ReleaseEntity, + param_editgroup_id: Option, + context: &Context, + ) -> Box + Send> { // Query parameters let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); - let url = format!("{}/v0/work?{editgroup_id}", self.base_path, editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET)); + let url = format!( + "{}/v0/release/{ident}?{editgroup_id}", + self.base_path, + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) + ); let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Post, &url); + let request = hyper_client.request(hyper::method::Method::Put, &url); let mut custom_headers = hyper::header::Headers::new(); let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::CREATE_WORK.clone())); + custom_headers.set(ContentType(mimetypes::requests::UPDATE_RELEASE.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { - 201 => { + 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkResponse::CreatedEntity(body)) + Ok(UpdateReleaseResponse::UpdatedEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkResponse::BadRequest(body)) + Ok(UpdateReleaseResponse::BadRequest(body)) } 404 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkResponse::NotFound(body)) + Ok(UpdateReleaseResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(CreateWorkResponse::GenericError(body)) + Ok(UpdateReleaseResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3238,55 +4795,64 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_release(&self, param_ident: String, param_editgroup_id: Option, context: &Context) -> Box + Send> { + fn create_webcapture( + &self, + param_entity: models::WebcaptureEntity, + param_editgroup_id: Option, + context: &Context, + ) -> Box + Send> { // Query parameters let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); let url = format!( - "{}/v0/release/{ident}?{editgroup_id}", + "{}/v0/webcapture?{editgroup_id}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) ); + let body = serde_json::to_string(¶m_entity).expect("impossible to fail to serialize"); + let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Delete, &url); + let request = hyper_client.request(hyper::method::Method::Post, &url); let mut custom_headers = hyper::header::Headers::new(); + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_WEBCAPTURE.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { - 200 => { + 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(DeleteReleaseResponse::DeletedEntity(body)) + Ok(CreateWebcaptureResponse::CreatedEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(DeleteReleaseResponse::BadRequest(body)) + Ok(CreateWebcaptureResponse::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::(&buf)?; - Ok(DeleteReleaseResponse::NotFound(body)) + Ok(CreateWebcaptureResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(DeleteReleaseResponse::GenericError(body)) + Ok(CreateWebcaptureResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3306,51 +4872,67 @@ impl Api for Client { Box::new(futures::done(result)) } - fn delete_release_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + fn create_webcapture_batch( + &self, + param_entity_list: &Vec, + param_autoaccept: Option, + param_editgroup_id: Option, + context: &Context, + ) -> Box + Send> { + // Query parameters + let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + let url = format!( - "{}/v0/release/edit/{edit_id}", + "{}/v0/webcapture/batch?{autoaccept}{editgroup_id}", self.base_path, - edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) + autoaccept = utf8_percent_encode(&query_autoaccept, QUERY_ENCODE_SET), + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) ); + let body = serde_json::to_string(¶m_entity_list).expect("impossible to fail to serialize"); + let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Delete, &url); + let request = hyper_client.request(hyper::method::Method::Post, &url); let mut custom_headers = hyper::header::Headers::new(); + let request = request.body(&body); + + custom_headers.set(ContentType(mimetypes::requests::CREATE_WEBCAPTURE_BATCH.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { - 200 => { + 201 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; + let body = serde_json::from_str::>(&buf)?; - Ok(DeleteReleaseEditResponse::DeletedEdit(body)) + Ok(CreateWebcaptureBatchResponse::CreatedEntities(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(DeleteReleaseEditResponse::BadRequest(body)) + Ok(CreateWebcaptureBatchResponse::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::(&buf)?; - Ok(DeleteReleaseEditResponse::NotFound(body)) + Ok(CreateWebcaptureBatchResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(DeleteReleaseEditResponse::GenericError(body)) + Ok(CreateWebcaptureBatchResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3370,21 +4952,19 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release(&self, param_ident: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { + fn delete_webcapture(&self, param_ident: String, param_editgroup_id: Option, context: &Context) -> Box + Send> { // Query parameters - let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); - let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); let url = format!( - "{}/v0/release/{ident}?{expand}{hide}", + "{}/v0/webcapture/{ident}?{editgroup_id}", self.base_path, ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), - hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Get, &url); + let request = hyper_client.request(hyper::method::Method::Delete, &url); let mut custom_headers = hyper::header::Headers::new(); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); @@ -3392,35 +4972,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseResponse::FoundEntity(body)) + Ok(DeleteWebcaptureResponse::DeletedEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseResponse::BadRequest(body)) + Ok(DeleteWebcaptureResponse::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::(&buf)?; - Ok(GetReleaseResponse::NotFound(body)) + Ok(DeleteWebcaptureResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseResponse::GenericError(body)) + Ok(DeleteWebcaptureResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3440,15 +5020,15 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { + fn delete_webcapture_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release/edit/{edit_id}", + "{}/v0/webcapture/edit/{edit_id}", self.base_path, edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); - let request = hyper_client.request(hyper::method::Method::Get, &url); + let request = hyper_client.request(hyper::method::Method::Delete, &url); let mut custom_headers = hyper::header::Headers::new(); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); @@ -3456,35 +5036,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseEditResponse::FoundEdit(body)) + Ok(DeleteWebcaptureEditResponse::DeletedEdit(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseEditResponse::BadRequest(body)) + Ok(DeleteWebcaptureEditResponse::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::(&buf)?; - Ok(GetReleaseEditResponse::NotFound(body)) + Ok(DeleteWebcaptureEditResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseEditResponse::GenericError(body)) + Ok(DeleteWebcaptureEditResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3504,14 +5084,16 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_files(&self, param_ident: String, param_hide: Option, context: &Context) -> Box + Send> { + fn get_webcapture(&self, param_ident: String, param_expand: Option, param_hide: Option, context: &Context) -> Box + Send> { // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); let url = format!( - "{}/v0/release/{ident}/files?{hide}", + "{}/v0/webcapture/{ident}?{expand}{hide}", self.base_path, ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); @@ -3524,35 +5106,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseFilesResponse::Found(body)) + Ok(GetWebcaptureResponse::FoundEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseFilesResponse::BadRequest(body)) + Ok(GetWebcaptureResponse::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::(&buf)?; - Ok(GetReleaseFilesResponse::NotFound(body)) + Ok(GetWebcaptureResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseFilesResponse::GenericError(body)) + Ok(GetWebcaptureResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3572,15 +5154,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_history(&self, param_ident: String, param_limit: Option, context: &Context) -> Box + Send> { - // Query parameters - let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); - + fn get_webcapture_edit(&self, param_edit_id: i64, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release/{ident}/history?{limit}", + "{}/v0/webcapture/edit/{edit_id}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), - limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET) + edit_id = utf8_percent_encode(¶m_edit_id.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -3592,35 +5170,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseHistoryResponse::FoundEntityHistory(body)) + Ok(GetWebcaptureEditResponse::FoundEdit(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseHistoryResponse::BadRequest(body)) + Ok(GetWebcaptureEditResponse::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::(&buf)?; - Ok(GetReleaseHistoryResponse::NotFound(body)) + Ok(GetWebcaptureEditResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseHistoryResponse::GenericError(body)) + Ok(GetWebcaptureEditResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3640,11 +5218,15 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_redirects(&self, param_ident: String, context: &Context) -> Box + Send> { + fn get_webcapture_history(&self, param_ident: String, param_limit: Option, context: &Context) -> Box + Send> { + // Query parameters + let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); + let url = format!( - "{}/v0/release/{ident}/redirects", + "{}/v0/webcapture/{ident}/history?{limit}", self.base_path, - ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), + limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -3656,35 +5238,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(&buf)?; + let body = serde_json::from_str::>(&buf)?; - Ok(GetReleaseRedirectsResponse::FoundEntityRedirects(body)) + Ok(GetWebcaptureHistoryResponse::FoundEntityHistory(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseRedirectsResponse::BadRequest(body)) + Ok(GetWebcaptureHistoryResponse::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::(&buf)?; - Ok(GetReleaseRedirectsResponse::NotFound(body)) + Ok(GetWebcaptureHistoryResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseRedirectsResponse::GenericError(body)) + Ok(GetWebcaptureHistoryResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3704,23 +5286,11 @@ impl Api for Client { Box::new(futures::done(result)) } - fn get_release_revision( - &self, - param_rev_id: String, - param_expand: Option, - param_hide: Option, - context: &Context, - ) -> Box + Send> { - // Query parameters - let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); - let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); - + fn get_webcapture_redirects(&self, param_ident: String, context: &Context) -> Box + Send> { let url = format!( - "{}/v0/release/rev/{rev_id}?{expand}{hide}", + "{}/v0/webcapture/{ident}/redirects", self.base_path, - rev_id = utf8_percent_encode(¶m_rev_id.to_string(), PATH_SEGMENT_ENCODE_SET), - expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), - hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) + ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET) ); let hyper_client = (self.hyper_client)(); @@ -3732,35 +5302,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; + let body = serde_json::from_str::>(&buf)?; - Ok(GetReleaseRevisionResponse::FoundEntityRevision(body)) + Ok(GetWebcaptureRedirectsResponse::FoundEntityRedirects(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseRevisionResponse::BadRequest(body)) + Ok(GetWebcaptureRedirectsResponse::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::(&buf)?; - Ok(GetReleaseRevisionResponse::NotFound(body)) + Ok(GetWebcaptureRedirectsResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(GetReleaseRevisionResponse::GenericError(body)) + Ok(GetWebcaptureRedirectsResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3780,37 +5350,21 @@ impl Api for Client { Box::new(futures::done(result)) } - fn lookup_release( + fn get_webcapture_revision( &self, - param_doi: Option, - param_wikidata_qid: Option, - param_isbn13: Option, - param_pmid: Option, - param_pmcid: Option, - param_core_id: Option, + param_rev_id: String, param_expand: Option, param_hide: Option, context: &Context, - ) -> Box + Send> { + ) -> Box + Send> { // Query parameters - let query_doi = param_doi.map_or_else(String::new, |query| format!("doi={doi}&", doi = query.to_string())); - let query_wikidata_qid = param_wikidata_qid.map_or_else(String::new, |query| format!("wikidata_qid={wikidata_qid}&", wikidata_qid = query.to_string())); - let query_isbn13 = param_isbn13.map_or_else(String::new, |query| format!("isbn13={isbn13}&", isbn13 = query.to_string())); - let query_pmid = param_pmid.map_or_else(String::new, |query| format!("pmid={pmid}&", pmid = query.to_string())); - let query_pmcid = param_pmcid.map_or_else(String::new, |query| format!("pmcid={pmcid}&", pmcid = query.to_string())); - let query_core_id = param_core_id.map_or_else(String::new, |query| format!("core_id={core_id}&", core_id = query.to_string())); let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); let url = format!( - "{}/v0/release/lookup?{doi}{wikidata_qid}{isbn13}{pmid}{pmcid}{core_id}{expand}{hide}", + "{}/v0/webcapture/rev/{rev_id}?{expand}{hide}", self.base_path, - doi = utf8_percent_encode(&query_doi, QUERY_ENCODE_SET), - wikidata_qid = utf8_percent_encode(&query_wikidata_qid, QUERY_ENCODE_SET), - isbn13 = utf8_percent_encode(&query_isbn13, QUERY_ENCODE_SET), - pmid = utf8_percent_encode(&query_pmid, QUERY_ENCODE_SET), - pmcid = utf8_percent_encode(&query_pmcid, QUERY_ENCODE_SET), - core_id = utf8_percent_encode(&query_core_id, QUERY_ENCODE_SET), + rev_id = utf8_percent_encode(¶m_rev_id.to_string(), PATH_SEGMENT_ENCODE_SET), expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET), hide = utf8_percent_encode(&query_hide, QUERY_ENCODE_SET) ); @@ -3824,35 +5378,35 @@ impl Api for Client { let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::(&buf)?; + let body = serde_json::from_str::(&buf)?; - Ok(LookupReleaseResponse::FoundEntity(body)) + Ok(GetWebcaptureRevisionResponse::FoundEntityRevision(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(LookupReleaseResponse::BadRequest(body)) + Ok(GetWebcaptureRevisionResponse::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::(&buf)?; - Ok(LookupReleaseResponse::NotFound(body)) + Ok(GetWebcaptureRevisionResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(LookupReleaseResponse::GenericError(body)) + Ok(GetWebcaptureRevisionResponse::GenericError(body)) } code => { let mut buf = [0; 100]; @@ -3872,18 +5426,18 @@ impl Api for Client { Box::new(futures::done(result)) } - fn update_release( + fn update_webcapture( &self, param_ident: String, - param_entity: models::ReleaseEntity, + param_entity: models::WebcaptureEntity, param_editgroup_id: Option, context: &Context, - ) -> Box + Send> { + ) -> Box + Send> { // Query parameters let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); let url = format!( - "{}/v0/release/{ident}?{editgroup_id}", + "{}/v0/webcapture/{ident}?{editgroup_id}", self.base_path, ident = utf8_percent_encode(¶m_ident.to_string(), PATH_SEGMENT_ENCODE_SET), editgroup_id = utf8_percent_encode(&query_editgroup_id, QUERY_ENCODE_SET) @@ -3897,41 +5451,41 @@ impl Api for Client { let request = request.body(&body); - custom_headers.set(ContentType(mimetypes::requests::UPDATE_RELEASE.clone())); + custom_headers.set(ContentType(mimetypes::requests::UPDATE_WEBCAPTURE.clone())); context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone()))); let request = request.headers(custom_headers); // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn parse_response(mut response: hyper::client::response::Response) -> Result { + fn parse_response(mut response: hyper::client::response::Response) -> Result { match response.status.to_u16() { 200 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(UpdateReleaseResponse::UpdatedEntity(body)) + Ok(UpdateWebcaptureResponse::UpdatedEntity(body)) } 400 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(UpdateReleaseResponse::BadRequest(body)) + Ok(UpdateWebcaptureResponse::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::(&buf)?; - Ok(UpdateReleaseResponse::NotFound(body)) + Ok(UpdateWebcaptureResponse::NotFound(body)) } 500 => { let mut buf = String::new(); response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; let body = serde_json::from_str::(&buf)?; - Ok(UpdateReleaseResponse::GenericError(body)) + Ok(UpdateWebcaptureResponse::GenericError(body)) } code => { let mut buf = [0; 100]; diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs index 4ba734b1..ad05aba7 100644 --- a/rust/fatcat-api-spec/src/lib.rs +++ b/rust/fatcat-api-spec/src/lib.rs @@ -518,6 +518,126 @@ pub enum UpdateFileResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum CreateFilesetResponse { + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum CreateFilesetBatchResponse { + /// Created Entities + CreatedEntities(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum DeleteFilesetResponse { + /// Deleted Entity + DeletedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum DeleteFilesetEditResponse { + /// Deleted Edit + DeletedEdit(models::Success), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetFilesetResponse { + /// Found Entity + FoundEntity(models::FilesetEntity), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetFilesetEditResponse { + /// Found Edit + FoundEdit(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetFilesetHistoryResponse { + /// Found Entity History + FoundEntityHistory(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetFilesetRedirectsResponse { + /// Found Entity Redirects + FoundEntityRedirects(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetFilesetRevisionResponse { + /// Found Entity Revision + FoundEntityRevision(models::FilesetEntity), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum UpdateFilesetResponse { + /// Updated Entity + UpdatedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum CreateReleaseResponse { /// Created Entity @@ -614,6 +734,18 @@ pub enum GetReleaseFilesResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum GetReleaseFilesetsResponse { + /// Found + Found(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum GetReleaseHistoryResponse { /// Found Entity History @@ -650,6 +782,18 @@ pub enum GetReleaseRevisionResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum GetReleaseWebcapturesResponse { + /// Found + Found(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum LookupReleaseResponse { /// Found Entity @@ -674,6 +818,126 @@ pub enum UpdateReleaseResponse { GenericError(models::ErrorResponse), } +#[derive(Debug, PartialEq)] +pub enum CreateWebcaptureResponse { + /// Created Entity + CreatedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum CreateWebcaptureBatchResponse { + /// Created Entities + CreatedEntities(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum DeleteWebcaptureResponse { + /// Deleted Entity + DeletedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum DeleteWebcaptureEditResponse { + /// Deleted Edit + DeletedEdit(models::Success), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetWebcaptureResponse { + /// Found Entity + FoundEntity(models::WebcaptureEntity), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetWebcaptureEditResponse { + /// Found Edit + FoundEdit(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetWebcaptureHistoryResponse { + /// Found Entity History + FoundEntityHistory(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetWebcaptureRedirectsResponse { + /// Found Entity Redirects + FoundEntityRedirects(Vec), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum GetWebcaptureRevisionResponse { + /// Found Entity Revision + FoundEntityRevision(models::WebcaptureEntity), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +pub enum UpdateWebcaptureResponse { + /// Updated Entity + UpdatedEntity(models::EntityEdit), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + #[derive(Debug, PartialEq)] pub enum CreateWorkBatchResponse { /// Created Entities @@ -919,6 +1183,32 @@ pub trait Api { fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + + fn create_fileset_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + context: &Context, + ) -> Box + Send>; + + fn delete_fileset(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; + + fn delete_fileset_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; + + fn get_fileset(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; + + fn get_fileset_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; + + fn get_fileset_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; + + fn get_fileset_redirects(&self, ident: String, context: &Context) -> Box + Send>; + + fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_release_batch( @@ -941,12 +1231,16 @@ pub trait Api { fn get_release_files(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; + fn get_release_filesets(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; + fn get_release_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_release_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_release_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; + fn get_release_webcaptures(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; + fn lookup_release( &self, doi: Option, @@ -962,6 +1256,38 @@ pub trait Api { fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option, context: &Context) -> Box + Send>; + + fn create_webcapture_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + context: &Context, + ) -> Box + Send>; + + fn delete_webcapture(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; + + fn delete_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; + + fn get_webcapture(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; + + fn get_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; + + fn get_webcapture_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; + + fn get_webcapture_redirects(&self, ident: String, context: &Context) -> Box + Send>; + + fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; + + fn update_webcapture( + &self, + ident: String, + entity: models::WebcaptureEntity, + editgroup_id: Option, + context: &Context, + ) -> Box + Send>; + fn create_work_batch( &self, entity_list: &Vec, @@ -1096,6 +1422,31 @@ pub trait ApiNoContext { fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option) -> Box + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option) -> Box + Send>; + + fn create_fileset_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + ) -> Box + Send>; + + fn delete_fileset(&self, ident: String, editgroup_id: Option) -> Box + Send>; + + fn delete_fileset_edit(&self, edit_id: i64) -> Box + Send>; + + fn get_fileset(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; + + fn get_fileset_edit(&self, edit_id: i64) -> Box + Send>; + + fn get_fileset_history(&self, ident: String, limit: Option) -> Box + Send>; + + fn get_fileset_redirects(&self, ident: String) -> Box + Send>; + + fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option) -> Box + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send>; fn create_release_batch( @@ -1117,12 +1468,16 @@ pub trait ApiNoContext { fn get_release_files(&self, ident: String, hide: Option) -> Box + Send>; + fn get_release_filesets(&self, ident: String, hide: Option) -> Box + Send>; + fn get_release_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_release_redirects(&self, ident: String) -> Box + Send>; fn get_release_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; + fn get_release_webcaptures(&self, ident: String, hide: Option) -> Box + Send>; + fn lookup_release( &self, doi: Option, @@ -1137,6 +1492,31 @@ pub trait ApiNoContext { fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option) -> Box + Send>; + + fn create_webcapture_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + ) -> Box + Send>; + + fn delete_webcapture(&self, ident: String, editgroup_id: Option) -> Box + Send>; + + fn delete_webcapture_edit(&self, edit_id: i64) -> Box + Send>; + + fn get_webcapture(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; + + fn get_webcapture_edit(&self, edit_id: i64) -> Box + Send>; + + fn get_webcapture_history(&self, ident: String, limit: Option) -> Box + Send>; + + fn get_webcapture_redirects(&self, ident: String) -> Box + Send>; + + fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; + + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option) -> Box + Send>; + fn create_work_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send>; fn delete_work(&self, ident: String, editgroup_id: Option) -> Box + Send>; @@ -1361,6 +1741,51 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().update_file(ident, entity, editgroup_id, &self.context()) } + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option) -> Box + Send> { + self.api().create_fileset(entity, editgroup_id, &self.context()) + } + + fn create_fileset_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + ) -> Box + Send> { + self.api().create_fileset_batch(entity_list, autoaccept, editgroup_id, &self.context()) + } + + fn delete_fileset(&self, ident: String, editgroup_id: Option) -> Box + Send> { + self.api().delete_fileset(ident, editgroup_id, &self.context()) + } + + fn delete_fileset_edit(&self, edit_id: i64) -> Box + Send> { + self.api().delete_fileset_edit(edit_id, &self.context()) + } + + fn get_fileset(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_fileset(ident, expand, hide, &self.context()) + } + + fn get_fileset_edit(&self, edit_id: i64) -> Box + Send> { + self.api().get_fileset_edit(edit_id, &self.context()) + } + + fn get_fileset_history(&self, ident: String, limit: Option) -> Box + Send> { + self.api().get_fileset_history(ident, limit, &self.context()) + } + + fn get_fileset_redirects(&self, ident: String) -> Box + Send> { + self.api().get_fileset_redirects(ident, &self.context()) + } + + fn get_fileset_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_fileset_revision(rev_id, expand, hide, &self.context()) + } + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option) -> Box + Send> { + self.api().update_fileset(ident, entity, editgroup_id, &self.context()) + } + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send> { self.api().create_release(entity, editgroup_id, &self.context()) } @@ -1398,6 +1823,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_release_files(ident, hide, &self.context()) } + fn get_release_filesets(&self, ident: String, hide: Option) -> Box + Send> { + self.api().get_release_filesets(ident, hide, &self.context()) + } + fn get_release_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_release_history(ident, limit, &self.context()) } @@ -1410,6 +1839,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_release_revision(rev_id, expand, hide, &self.context()) } + fn get_release_webcaptures(&self, ident: String, hide: Option) -> Box + Send> { + self.api().get_release_webcaptures(ident, hide, &self.context()) + } + fn lookup_release( &self, doi: Option, @@ -1428,6 +1861,51 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().update_release(ident, entity, editgroup_id, &self.context()) } + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option) -> Box + Send> { + self.api().create_webcapture(entity, editgroup_id, &self.context()) + } + + fn create_webcapture_batch( + &self, + entity_list: &Vec, + autoaccept: Option, + editgroup_id: Option, + ) -> Box + Send> { + self.api().create_webcapture_batch(entity_list, autoaccept, editgroup_id, &self.context()) + } + + fn delete_webcapture(&self, ident: String, editgroup_id: Option) -> Box + Send> { + self.api().delete_webcapture(ident, editgroup_id, &self.context()) + } + + fn delete_webcapture_edit(&self, edit_id: i64) -> Box + Send> { + self.api().delete_webcapture_edit(edit_id, &self.context()) + } + + fn get_webcapture(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_webcapture(ident, expand, hide, &self.context()) + } + + fn get_webcapture_edit(&self, edit_id: i64) -> Box + Send> { + self.api().get_webcapture_edit(edit_id, &self.context()) + } + + fn get_webcapture_history(&self, ident: String, limit: Option) -> Box + Send> { + self.api().get_webcapture_history(ident, limit, &self.context()) + } + + fn get_webcapture_redirects(&self, ident: String) -> Box + Send> { + self.api().get_webcapture_redirects(ident, &self.context()) + } + + fn get_webcapture_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { + self.api().get_webcapture_revision(rev_id, expand, hide, &self.context()) + } + + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option) -> Box + Send> { + self.api().update_webcapture(ident, entity, editgroup_id, &self.context()) + } + fn create_work_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send> { self.api().create_work_batch(entity_list, autoaccept, editgroup_id, &self.context()) } diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs index 20d3331c..e0683dbb 100644 --- a/rust/fatcat-api-spec/src/mimetypes.rs +++ b/rust/fatcat-api-spec/src/mimetypes.rs @@ -648,6 +648,166 @@ pub mod responses { lazy_static! { pub static ref UPDATE_FILE_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET_CREATED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileset + lazy_static! { + pub static ref DELETE_FILESET_DELETED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileset + lazy_static! { + pub static ref DELETE_FILESET_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileset + lazy_static! { + pub static ref DELETE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFileset + lazy_static! { + pub static ref DELETE_FILESET_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFilesetEdit + lazy_static! { + pub static ref DELETE_FILESET_EDIT_DELETED_EDIT: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFilesetEdit + lazy_static! { + pub static ref DELETE_FILESET_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFilesetEdit + lazy_static! { + pub static ref DELETE_FILESET_EDIT_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteFilesetEdit + lazy_static! { + pub static ref DELETE_FILESET_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFileset + lazy_static! { + pub static ref GET_FILESET_FOUND_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFileset + lazy_static! { + pub static ref GET_FILESET_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFileset + lazy_static! { + pub static ref GET_FILESET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFileset + lazy_static! { + pub static ref GET_FILESET_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetEdit + lazy_static! { + pub static ref GET_FILESET_EDIT_FOUND_EDIT: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetEdit + lazy_static! { + pub static ref GET_FILESET_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetEdit + lazy_static! { + pub static ref GET_FILESET_EDIT_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetEdit + lazy_static! { + pub static ref GET_FILESET_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetHistory + lazy_static! { + pub static ref GET_FILESET_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetHistory + lazy_static! { + pub static ref GET_FILESET_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetHistory + lazy_static! { + pub static ref GET_FILESET_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetHistory + lazy_static! { + pub static ref GET_FILESET_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRedirects + lazy_static! { + pub static ref GET_FILESET_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRedirects + lazy_static! { + pub static ref GET_FILESET_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRedirects + lazy_static! { + pub static ref GET_FILESET_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRedirects + lazy_static! { + pub static ref GET_FILESET_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRevision + lazy_static! { + pub static ref GET_FILESET_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRevision + lazy_static! { + pub static ref GET_FILESET_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRevision + lazy_static! { + pub static ref GET_FILESET_REVISION_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetFilesetRevision + lazy_static! { + pub static ref GET_FILESET_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET_UPDATED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for CreateRelease lazy_static! { pub static ref CREATE_RELEASE_CREATED_ENTITY: Mime = mime!(Application / Json); @@ -776,6 +936,22 @@ pub mod responses { lazy_static! { pub static ref GET_RELEASE_FILES_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for GetReleaseFilesets + lazy_static! { + pub static ref GET_RELEASE_FILESETS_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseFilesets + lazy_static! { + pub static ref GET_RELEASE_FILESETS_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseFilesets + lazy_static! { + pub static ref GET_RELEASE_FILESETS_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseFilesets + lazy_static! { + pub static ref GET_RELEASE_FILESETS_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for GetReleaseHistory lazy_static! { pub static ref GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json); @@ -824,6 +1000,22 @@ pub mod responses { lazy_static! { pub static ref GET_RELEASE_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for GetReleaseWebcaptures + lazy_static! { + pub static ref GET_RELEASE_WEBCAPTURES_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseWebcaptures + lazy_static! { + pub static ref GET_RELEASE_WEBCAPTURES_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseWebcaptures + lazy_static! { + pub static ref GET_RELEASE_WEBCAPTURES_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetReleaseWebcaptures + lazy_static! { + pub static ref GET_RELEASE_WEBCAPTURES_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for LookupRelease lazy_static! { pub static ref LOOKUP_RELEASE_FOUND_ENTITY: Mime = mime!(Application / Json); @@ -856,6 +1048,166 @@ pub mod responses { lazy_static! { pub static ref UPDATE_RELEASE_GENERIC_ERROR: Mime = mime!(Application / Json); } + /// Create Mime objects for the response content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE_CREATED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcapture + lazy_static! { + pub static ref DELETE_WEBCAPTURE_DELETED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcapture + lazy_static! { + pub static ref DELETE_WEBCAPTURE_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcapture + lazy_static! { + pub static ref DELETE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcapture + lazy_static! { + pub static ref DELETE_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcaptureEdit + lazy_static! { + pub static ref DELETE_WEBCAPTURE_EDIT_DELETED_EDIT: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcaptureEdit + lazy_static! { + pub static ref DELETE_WEBCAPTURE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcaptureEdit + lazy_static! { + pub static ref DELETE_WEBCAPTURE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for DeleteWebcaptureEdit + lazy_static! { + pub static ref DELETE_WEBCAPTURE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcapture + lazy_static! { + pub static ref GET_WEBCAPTURE_FOUND_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcapture + lazy_static! { + pub static ref GET_WEBCAPTURE_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcapture + lazy_static! { + pub static ref GET_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcapture + lazy_static! { + pub static ref GET_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureEdit + lazy_static! { + pub static ref GET_WEBCAPTURE_EDIT_FOUND_EDIT: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureEdit + lazy_static! { + pub static ref GET_WEBCAPTURE_EDIT_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureEdit + lazy_static! { + pub static ref GET_WEBCAPTURE_EDIT_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureEdit + lazy_static! { + pub static ref GET_WEBCAPTURE_EDIT_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureHistory + lazy_static! { + pub static ref GET_WEBCAPTURE_HISTORY_FOUND_ENTITY_HISTORY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureHistory + lazy_static! { + pub static ref GET_WEBCAPTURE_HISTORY_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureHistory + lazy_static! { + pub static ref GET_WEBCAPTURE_HISTORY_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureHistory + lazy_static! { + pub static ref GET_WEBCAPTURE_HISTORY_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRedirects + lazy_static! { + pub static ref GET_WEBCAPTURE_REDIRECTS_FOUND_ENTITY_REDIRECTS: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRedirects + lazy_static! { + pub static ref GET_WEBCAPTURE_REDIRECTS_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRedirects + lazy_static! { + pub static ref GET_WEBCAPTURE_REDIRECTS_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRedirects + lazy_static! { + pub static ref GET_WEBCAPTURE_REDIRECTS_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRevision + lazy_static! { + pub static ref GET_WEBCAPTURE_REVISION_FOUND_ENTITY_REVISION: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRevision + lazy_static! { + pub static ref GET_WEBCAPTURE_REVISION_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRevision + lazy_static! { + pub static ref GET_WEBCAPTURE_REVISION_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for GetWebcaptureRevision + lazy_static! { + pub static ref GET_WEBCAPTURE_REVISION_GENERIC_ERROR: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE_UPDATED_ENTITY: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE_BAD_REQUEST: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE_NOT_FOUND: Mime = mime!(Application / Json); + } + /// Create Mime objects for the response content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE_GENERIC_ERROR: Mime = mime!(Application / Json); + } /// Create Mime objects for the response content types for CreateWorkBatch lazy_static! { pub static ref CREATE_WORK_BATCH_CREATED_ENTITIES: Mime = mime!(Application / Json); @@ -1061,6 +1413,18 @@ pub mod requests { lazy_static! { pub static ref UPDATE_FILE: Mime = mime!(Application / Json); } + /// Create Mime objects for the request content types for CreateFileset + lazy_static! { + pub static ref CREATE_FILESET: Mime = mime!(Application / Json); + } + /// Create Mime objects for the request content types for CreateFilesetBatch + lazy_static! { + pub static ref CREATE_FILESET_BATCH: Mime = mime!(Application / Json); + } + /// Create Mime objects for the request content types for UpdateFileset + lazy_static! { + pub static ref UPDATE_FILESET: Mime = mime!(Application / Json); + } /// Create Mime objects for the request content types for CreateRelease lazy_static! { pub static ref CREATE_RELEASE: Mime = mime!(Application / Json); @@ -1077,6 +1441,18 @@ pub mod requests { lazy_static! { pub static ref UPDATE_RELEASE: Mime = mime!(Application / Json); } + /// Create Mime objects for the request content types for CreateWebcapture + lazy_static! { + pub static ref CREATE_WEBCAPTURE: Mime = mime!(Application / Json); + } + /// Create Mime objects for the request content types for CreateWebcaptureBatch + lazy_static! { + pub static ref CREATE_WEBCAPTURE_BATCH: Mime = mime!(Application / Json); + } + /// Create Mime objects for the request content types for UpdateWebcapture + lazy_static! { + pub static ref UPDATE_WEBCAPTURE: Mime = mime!(Application / Json); + } /// Create Mime objects for the request content types for CreateWorkBatch lazy_static! { pub static ref CREATE_WORK_BATCH: Mime = mime!(Application / Json); diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 8f3e525a..c6fc3ae1 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -231,6 +231,14 @@ pub struct EditgroupEdits { #[serde(skip_serializing_if = "Option::is_none")] pub files: Option>, + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option>, + + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option>, + #[serde(rename = "releases")] #[serde(skip_serializing_if = "Option::is_none")] pub releases: Option>, @@ -246,6 +254,8 @@ impl EditgroupEdits { containers: None, creators: None, files: None, + filesets: None, + webcaptures: None, releases: None, works: None, } @@ -438,6 +448,103 @@ impl FileEntityUrls { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FilesetEntity { + #[serde(rename = "release_ids")] + #[serde(skip_serializing_if = "Option::is_none")] + pub release_ids: Option>, + + #[serde(rename = "urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub urls: Option>, + + #[serde(rename = "manifest")] + #[serde(skip_serializing_if = "Option::is_none")] + pub manifest: Option>, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option, +} + +impl FilesetEntity { + pub fn new() -> FilesetEntity { + FilesetEntity { + release_ids: None, + urls: None, + manifest: None, + state: None, + ident: None, + revision: None, + redirect: None, + extra: None, + edit_extra: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FilesetEntityManifest { + #[serde(rename = "path")] + pub path: String, + + #[serde(rename = "size")] + pub size: i64, + + #[serde(rename = "md5")] + #[serde(skip_serializing_if = "Option::is_none")] + pub md5: Option, + + #[serde(rename = "sha1")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha1: Option, + + #[serde(rename = "sha256")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha256: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, +} + +impl FilesetEntityManifest { + pub fn new(path: String, size: i64) -> FilesetEntityManifest { + FilesetEntityManifest { + path: path, + size: size, + md5: None, + sha1: None, + sha256: None, + extra: None, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ReleaseContrib { #[serde(rename = "index")] @@ -558,6 +665,16 @@ pub struct ReleaseEntity { #[serde(skip_serializing_if = "Option::is_none")] pub container_id: Option, + /// Optional; GET-only + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option>, + + /// Optional; GET-only + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option>, + /// Optional; GET-only #[serde(rename = "files")] #[serde(skip_serializing_if = "Option::is_none")] @@ -628,6 +745,8 @@ impl ReleaseEntity { release_status: None, release_type: None, container_id: None, + webcaptures: None, + filesets: None, files: None, container: None, work_id: None, @@ -734,6 +853,130 @@ impl Success { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntity { + #[serde(rename = "release_ids")] + #[serde(skip_serializing_if = "Option::is_none")] + pub release_ids: Option>, + + #[serde(rename = "timestamp")] + #[serde(skip_serializing_if = "Option::is_none")] + pub timestamp: Option>, + + #[serde(rename = "original_url")] + #[serde(skip_serializing_if = "Option::is_none")] + pub original_url: Option, + + #[serde(rename = "archive_urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub archive_urls: Option>, + + #[serde(rename = "cdx")] + #[serde(skip_serializing_if = "Option::is_none")] + pub cdx: Option>, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option, +} + +impl WebcaptureEntity { + pub fn new() -> WebcaptureEntity { + WebcaptureEntity { + release_ids: None, + timestamp: None, + original_url: None, + archive_urls: None, + cdx: None, + edit_extra: None, + extra: None, + redirect: None, + revision: None, + ident: None, + state: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntityArchiveUrls { + #[serde(rename = "url")] + pub url: String, + + #[serde(rename = "rel")] + pub rel: String, +} + +impl WebcaptureEntityArchiveUrls { + pub fn new(url: String, rel: String) -> WebcaptureEntityArchiveUrls { + WebcaptureEntityArchiveUrls { url: url, rel: rel } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntityCdx { + #[serde(rename = "surt")] + pub surt: String, + + #[serde(rename = "timestamp")] + pub timestamp: i64, + + #[serde(rename = "url")] + pub url: String, + + #[serde(rename = "mimetype")] + #[serde(skip_serializing_if = "Option::is_none")] + pub mimetype: Option, + + #[serde(rename = "status_code")] + pub status_code: i64, + + #[serde(rename = "sha1")] + pub sha1: String, + + #[serde(rename = "sha256")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha256: Option, +} + +impl WebcaptureEntityCdx { + pub fn new(surt: String, timestamp: i64, url: String, status_code: i64, sha1: String) -> WebcaptureEntityCdx { + WebcaptureEntityCdx { + surt: surt, + timestamp: timestamp, + url: url, + mimetype: None, + status_code: status_code, + sha1: sha1, + sha256: None, + } + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct WorkEntity { #[serde(rename = "edit_extra")] diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs index 51b1ac45..0576bfc7 100644 --- a/rust/fatcat-api-spec/src/server.rs +++ b/rust/fatcat-api-spec/src/server.rs @@ -38,14 +38,17 @@ use swagger::{ApiError, Context, XSpanId}; use models; use { AcceptEditgroupResponse, Api, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, - CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, - DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse, - GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse, - GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse, - GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse, - GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, + CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWebcaptureBatchResponse, CreateWebcaptureResponse, + CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, + DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, + DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, + GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, + GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, + GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, GetReleaseEditResponse, GetReleaseFilesResponse, + GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, + GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, GetWorkRedirectsResponse, + GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, + UpdateCreatorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse, }; header! { (Warning, "Warning") => [String] } @@ -4000,7 +4003,7 @@ where let api_clone = api.clone(); router.post( - "/v0/release", + "/v0/fileset", move |req: &mut Request| { let mut context = Context::default(); @@ -4030,7 +4033,7 @@ where let param_entity = if let Some(param_entity_raw) = param_entity { let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); - let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) @@ -4042,13 +4045,13 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.create_release(param_entity, param_editgroup_id, context).wait() { + match api.create_fileset(param_entity, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { - CreateReleaseResponse::CreatedEntity(body) => { + CreateFilesetResponse::CreatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_CREATED_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_CREATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4056,11 +4059,11 @@ where } Ok(response) } - CreateReleaseResponse::BadRequest(body) => { + CreateFilesetResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4068,11 +4071,11 @@ where } Ok(response) } - CreateReleaseResponse::NotFound(body) => { + CreateFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4080,11 +4083,11 @@ where } Ok(response) } - CreateReleaseResponse::GenericError(body) => { + CreateFilesetResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4106,12 +4109,12 @@ where Ok(response) }) }, - "CreateRelease", + "CreateFileset", ); let api_clone = api.clone(); router.post( - "/v0/release/batch", + "/v0/fileset/batch", move |req: &mut Request| { let mut context = Context::default(); @@ -4142,7 +4145,7 @@ where let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); - let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) @@ -4154,124 +4157,13 @@ where }; let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; - match api.create_release_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, context).wait() { - Ok(rsp) => match rsp { - CreateReleaseBatchResponse::CreatedEntities(body) => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - if !unused_elements.is_empty() { - response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); - } - Ok(response) - } - CreateReleaseBatchResponse::BadRequest(body) => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_BAD_REQUEST.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - if !unused_elements.is_empty() { - response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); - } - Ok(response) - } - CreateReleaseBatchResponse::NotFound(body) => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_FOUND.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - if !unused_elements.is_empty() { - response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); - } - Ok(response) - } - CreateReleaseBatchResponse::GenericError(body) => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); - - let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone())); - - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - if !unused_elements.is_empty() { - response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); - } - Ok(response) - } - }, - Err(_) => { - // Application code returned an error. This should not happen, as the implementation should - // return a valid response. - Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) - } - } - } - - handle_request(req, &api_clone, &mut context).or_else(|mut response| { - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); - Ok(response) - }) - }, - "CreateReleaseBatch", - ); - - let api_clone = api.clone(); - router.post( - "/v0/work", - move |req: &mut Request| { - let mut context = Context::default(); - - // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). - fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result - where - T: Api, - { - context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); - context.auth_data = req.extensions.remove::(); - context.authorization = req.extensions.remove::(); - - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - - // Body parameters (note that non-required body parameters will ignore garbage - // values, rather than causing a 400 response). Produce warning header and logs for - // any unused fields. - - let param_entity = req - .get::() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; - - let mut unused_elements = Vec::new(); - - let param_entity = if let Some(param_entity_raw) = param_entity { - let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); - - let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { - warn!("Ignoring unknown field in body: {}", path); - unused_elements.push(path.to_string()); - }) - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; - - param_entity - } else { - None - }; - let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - - match api.create_work(param_entity, param_editgroup_id, context).wait() { + match api.create_fileset_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { - CreateWorkResponse::CreatedEntity(body) => { + CreateFilesetBatchResponse::CreatedEntities(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(201), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_CREATED_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_CREATED_ENTITIES.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4279,11 +4171,11 @@ where } Ok(response) } - CreateWorkResponse::BadRequest(body) => { + CreateFilesetBatchResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4291,11 +4183,11 @@ where } Ok(response) } - CreateWorkResponse::NotFound(body) => { + CreateFilesetBatchResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4303,11 +4195,11 @@ where } Ok(response) } - CreateWorkResponse::GenericError(body) => { + CreateFilesetBatchResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::CREATE_FILESET_BATCH_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -4329,12 +4221,12 @@ where Ok(response) }) }, - "CreateWork", + "CreateFilesetBatch", ); let api_clone = api.clone(); router.delete( - "/v0/release/:ident", + "/v0/fileset/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -4366,43 +4258,43 @@ where let query_params = req.get::().unwrap_or_default(); let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.delete_release(param_ident, param_editgroup_id, context).wait() { + match api.delete_fileset(param_ident, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { - DeleteReleaseResponse::DeletedEntity(body) => { + DeleteFilesetResponse::DeletedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_DELETED_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_DELETED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseResponse::BadRequest(body) => { + DeleteFilesetResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseResponse::NotFound(body) => { + DeleteFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseResponse::GenericError(body) => { + DeleteFilesetResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4422,12 +4314,12 @@ where Ok(response) }) }, - "DeleteRelease", + "DeleteFileset", ); let api_clone = api.clone(); router.delete( - "/v0/release/edit/:edit_id", + "/v0/fileset/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -4455,43 +4347,43 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.delete_release_edit(param_edit_id, context).wait() { + match api.delete_fileset_edit(param_edit_id, context).wait() { Ok(rsp) => match rsp { - DeleteReleaseEditResponse::DeletedEdit(body) => { + DeleteFilesetEditResponse::DeletedEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_DELETED_EDIT.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_EDIT_DELETED_EDIT.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseEditResponse::BadRequest(body) => { + DeleteFilesetEditResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_EDIT_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseEditResponse::NotFound(body) => { + DeleteFilesetEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_EDIT_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - DeleteReleaseEditResponse::GenericError(body) => { + DeleteFilesetEditResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::DELETE_FILESET_EDIT_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4511,12 +4403,12 @@ where Ok(response) }) }, - "DeleteReleaseEdit", + "DeleteFilesetEdit", ); let api_clone = api.clone(); router.get( - "/v0/release/:ident", + "/v0/fileset/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -4549,43 +4441,43 @@ where let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.get_release(param_ident, param_expand, param_hide, context).wait() { + match api.get_fileset(param_ident, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { - GetReleaseResponse::FoundEntity(body) => { + GetFilesetResponse::FoundEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FOUND_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_FOUND_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseResponse::BadRequest(body) => { + GetFilesetResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseResponse::NotFound(body) => { + GetFilesetResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseResponse::GenericError(body) => { + GetFilesetResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4605,12 +4497,12 @@ where Ok(response) }) }, - "GetRelease", + "GetFileset", ); let api_clone = api.clone(); router.get( - "/v0/release/edit/:edit_id", + "/v0/fileset/edit/:edit_id", move |req: &mut Request| { let mut context = Context::default(); @@ -4638,43 +4530,43 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? }; - match api.get_release_edit(param_edit_id, context).wait() { + match api.get_fileset_edit(param_edit_id, context).wait() { Ok(rsp) => match rsp { - GetReleaseEditResponse::FoundEdit(body) => { + GetFilesetEditResponse::FoundEdit(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_FOUND_EDIT.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_EDIT_FOUND_EDIT.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseEditResponse::BadRequest(body) => { + GetFilesetEditResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_EDIT_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseEditResponse::NotFound(body) => { + GetFilesetEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_EDIT_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseEditResponse::GenericError(body) => { + GetFilesetEditResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_EDIT_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4694,12 +4586,12 @@ where Ok(response) }) }, - "GetReleaseEdit", + "GetFilesetEdit", ); let api_clone = api.clone(); router.get( - "/v0/release/:ident/files", + "/v0/fileset/:ident/history", move |req: &mut Request| { let mut context = Context::default(); @@ -4729,45 +4621,45 @@ where // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); - let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api.get_release_files(param_ident, param_hide, context).wait() { + match api.get_fileset_history(param_ident, param_limit, context).wait() { Ok(rsp) => match rsp { - GetReleaseFilesResponse::Found(body) => { + GetFilesetHistoryResponse::FoundEntityHistory(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_HISTORY_FOUND_ENTITY_HISTORY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseFilesResponse::BadRequest(body) => { + GetFilesetHistoryResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_HISTORY_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseFilesResponse::NotFound(body) => { + GetFilesetHistoryResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_HISTORY_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseFilesResponse::GenericError(body) => { + GetFilesetHistoryResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_HISTORY_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4787,12 +4679,12 @@ where Ok(response) }) }, - "GetReleaseFiles", + "GetFilesetHistory", ); let api_clone = api.clone(); router.get( - "/v0/release/:ident/history", + "/v0/fileset/:ident/redirects", move |req: &mut Request| { let mut context = Context::default(); @@ -4820,47 +4712,43 @@ where .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; - // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) - let query_params = req.get::().unwrap_or_default(); - let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - - match api.get_release_history(param_ident, param_limit, context).wait() { + match api.get_fileset_redirects(param_ident, context).wait() { Ok(rsp) => match rsp { - GetReleaseHistoryResponse::FoundEntityHistory(body) => { + GetFilesetRedirectsResponse::FoundEntityRedirects(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseHistoryResponse::BadRequest(body) => { + GetFilesetRedirectsResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REDIRECTS_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseHistoryResponse::NotFound(body) => { + GetFilesetRedirectsResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REDIRECTS_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseHistoryResponse::GenericError(body) => { + GetFilesetRedirectsResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REDIRECTS_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4880,12 +4768,12 @@ where Ok(response) }) }, - "GetReleaseHistory", + "GetFilesetRedirects", ); let api_clone = api.clone(); router.get( - "/v0/release/:ident/redirects", + "/v0/fileset/rev/:rev_id", move |req: &mut Request| { let mut context = Context::default(); @@ -4899,57 +4787,62 @@ where context.authorization = req.extensions.remove::(); // Path parameters - let param_ident = { + let param_rev_id = { let param = req .extensions .get::() .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? - .find("ident") - .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + .find("rev_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter rev_id".to_string())))?; percent_decode(param.as_bytes()) .decode_utf8() .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? .parse() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter rev_id: {}", e))))? }; - match api.get_release_redirects(param_ident, context).wait() { + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_fileset_revision(param_rev_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { - GetReleaseRedirectsResponse::FoundEntityRedirects(body) => { + GetFilesetRevisionResponse::FoundEntityRevision(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REVISION_FOUND_ENTITY_REVISION.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRedirectsResponse::BadRequest(body) => { + GetFilesetRevisionResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REVISION_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRedirectsResponse::NotFound(body) => { + GetFilesetRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REVISION_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRedirectsResponse::GenericError(body) => { + GetFilesetRevisionResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_FILESET_REVISION_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -4969,12 +4862,12 @@ where Ok(response) }) }, - "GetReleaseRedirects", + "GetFilesetRevision", ); let api_clone = api.clone(); - router.get( - "/v0/release/rev/:rev_id", + router.put( + "/v0/fileset/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -4988,62 +4881,2150 @@ where context.authorization = req.extensions.remove::(); // Path parameters - let param_rev_id = { + let param_ident = { let param = req .extensions .get::() .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? - .find("rev_id") - .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter rev_id".to_string())))?; + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; percent_decode(param.as_bytes()) .decode_utf8() .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? .parse() - .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter rev_id: {}", e))))? + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? }; // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); - let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - - match api.get_release_revision(param_rev_id, param_expand, param_hide, context).wait() { - Ok(rsp) => match rsp { - GetReleaseRevisionResponse::FoundEntityRevision(body) => { - let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_FOUND_ENTITY_REVISION.clone())); + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. - context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + let param_entity = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + + param_entity + } else { + None + }; + let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; + + match api.update_fileset(param_ident, param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + UpdateFilesetResponse::UpdatedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILESET_UPDATED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateFilesetResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILESET_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateFilesetResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILESET_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) + } + UpdateFilesetResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_FILESET_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "UpdateFileset", + ); + + let api_clone = api.clone(); + router.post( + "/v0/release", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + + param_entity + } else { + None + }; + let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; + + match api.create_release(param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + CreateReleaseResponse::CreatedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_CREATED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "CreateRelease", + ); + + let api_clone = api.clone(); + router.post( + "/v0/release/batch", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity_list = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + + let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + + param_entity_list + } else { + None + }; + let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + + match api.create_release_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + CreateReleaseBatchResponse::CreatedEntities(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_CREATED_ENTITIES.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseBatchResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseBatchResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateReleaseBatchResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_RELEASE_BATCH_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "CreateReleaseBatch", + ); + + let api_clone = api.clone(); + router.post( + "/v0/work", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + + param_entity + } else { + None + }; + let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; + + match api.create_work(param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + CreateWorkResponse::CreatedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_CREATED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWorkResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWorkResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWorkResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WORK_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "CreateWork", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/release/:ident", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.delete_release(param_ident, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + DeleteReleaseResponse::DeletedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_DELETED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "DeleteRelease", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/release/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.delete_release_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + DeleteReleaseEditResponse::DeletedEdit(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_DELETED_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseEditResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseEditResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteReleaseEditResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_RELEASE_EDIT_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "DeleteReleaseEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release(param_ident, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetReleaseResponse::FoundEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FOUND_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetRelease", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.get_release_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + GetReleaseEditResponse::FoundEdit(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_FOUND_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseEditResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseEditResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseEditResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_EDIT_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident/files", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_files(param_ident, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetReleaseFilesResponse::Found(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILES_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseFiles", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident/filesets", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_filesets(param_ident, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetReleaseFilesetsResponse::Found(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILESETS_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesetsResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILESETS_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesetsResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILESETS_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseFilesetsResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_FILESETS_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseFilesets", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident/history", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_history(param_ident, param_limit, context).wait() { + Ok(rsp) => match rsp { + GetReleaseHistoryResponse::FoundEntityHistory(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_FOUND_ENTITY_HISTORY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseHistoryResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseHistoryResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseHistoryResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_HISTORY_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseHistory", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident/redirects", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + match api.get_release_redirects(param_ident, context).wait() { + Ok(rsp) => match rsp { + GetReleaseRedirectsResponse::FoundEntityRedirects(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRedirectsResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRedirectsResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRedirectsResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REDIRECTS_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseRedirects", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/rev/:rev_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_rev_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("rev_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter rev_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter rev_id: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_revision(param_rev_id, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetReleaseRevisionResponse::FoundEntityRevision(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_FOUND_ENTITY_REVISION.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRevisionResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRevisionResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseRevisionResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseRevision", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/:ident/webcaptures", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_release_webcaptures(param_ident, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetReleaseWebcapturesResponse::Found(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_WEBCAPTURES_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseWebcapturesResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_WEBCAPTURES_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseWebcapturesResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_WEBCAPTURES_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetReleaseWebcapturesResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_WEBCAPTURES_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetReleaseWebcaptures", + ); + + let api_clone = api.clone(); + router.get( + "/v0/release/lookup", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_doi = query_params.get("doi").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_wikidata_qid = query_params.get("wikidata_qid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_isbn13 = query_params.get("isbn13").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_pmid = query_params.get("pmid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_pmcid = query_params.get("pmcid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_core_id = query_params.get("core_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api + .lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_core_id, param_expand, param_hide, context) + .wait() + { + Ok(rsp) => match rsp { + LookupReleaseResponse::FoundEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_FOUND_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + LookupReleaseResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + LookupReleaseResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + LookupReleaseResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "LookupRelease", + ); + + let api_clone = api.clone(); + router.put( + "/v0/release/:ident", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + + param_entity + } else { + None + }; + let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; + + match api.update_release(param_ident, param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + UpdateReleaseResponse::UpdatedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_UPDATED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateReleaseResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateReleaseResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + UpdateReleaseResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "UpdateRelease", + ); + + let api_clone = api.clone(); + router.post( + "/v0/webcapture", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?; + + param_entity + } else { + None + }; + let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; + + match api.create_webcapture(param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + CreateWebcaptureResponse::CreatedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_CREATED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWebcaptureResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWebcaptureResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_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) + } + CreateWebcaptureResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "CreateWebcapture", + ); + + let api_clone = api.clone(); + router.post( + "/v0/webcapture/batch", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity_list = req + .get::() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + + let param_entity_list: Option> = serde_ignored::deserialize(deserializer, |path| { + warn!("Ignoring unknown field in body: {}", path); + unused_elements.push(path.to_string()); + }) + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - doesn't match schema: {}", e))))?; + + param_entity_list + } else { + None + }; + let param_entity_list = param_entity_list.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity_list".to_string())))?; + + match api.create_webcapture_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + CreateWebcaptureBatchResponse::CreatedEntities(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(201), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_CREATED_ENTITIES.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWebcaptureBatchResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWebcaptureBatchResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + CreateWebcaptureBatchResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::CREATE_WEBCAPTURE_BATCH_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + if !unused_elements.is_empty() { + response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); + } + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "CreateWebcaptureBatch", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/webcapture/:ident", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.delete_webcapture(param_ident, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + DeleteWebcaptureResponse::DeletedEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_DELETED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "DeleteWebcapture", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/webcapture/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.delete_webcapture_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + DeleteWebcaptureEditResponse::DeletedEdit(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_EDIT_DELETED_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureEditResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureEditResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + DeleteWebcaptureEditResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::DELETE_WEBCAPTURE_EDIT_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "DeleteWebcaptureEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/webcapture/:ident", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_webcapture(param_ident, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + GetWebcaptureResponse::FoundEntity(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_FOUND_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetWebcapture", + ); + + let api_clone = api.clone(); + router.get( + "/v0/webcapture/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.get_webcapture_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + GetWebcaptureEditResponse::FoundEdit(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_EDIT_FOUND_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRevisionResponse::BadRequest(body) => { + GetWebcaptureEditResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_EDIT_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRevisionResponse::NotFound(body) => { + GetWebcaptureEditResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_EDIT_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - GetReleaseRevisionResponse::GenericError(body) => { + GetWebcaptureEditResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::GET_RELEASE_REVISION_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_EDIT_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -5063,12 +7044,12 @@ where Ok(response) }) }, - "GetReleaseRevision", + "GetWebcaptureEdit", ); let api_clone = api.clone(); router.get( - "/v0/release/lookup", + "/v0/webcapture/:ident/history", move |req: &mut Request| { let mut context = Context::default(); @@ -5081,57 +7062,245 @@ where context.auth_data = req.extensions.remove::(); context.authorization = req.extensions.remove::(); + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::().unwrap_or_default(); + let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); + + match api.get_webcapture_history(param_ident, param_limit, context).wait() { + Ok(rsp) => match rsp { + GetWebcaptureHistoryResponse::FoundEntityHistory(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_HISTORY_FOUND_ENTITY_HISTORY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureHistoryResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_HISTORY_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureHistoryResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_HISTORY_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureHistoryResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_HISTORY_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetWebcaptureHistory", + ); + + let api_clone = api.clone(); + router.get( + "/v0/webcapture/:ident/redirects", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("ident") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter ident".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter ident: {}", e))))? + }; + + match api.get_webcapture_redirects(param_ident, context).wait() { + Ok(rsp) => match rsp { + GetWebcaptureRedirectsResponse::FoundEntityRedirects(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(200), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureRedirectsResponse::BadRequest(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(400), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REDIRECTS_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureRedirectsResponse::NotFound(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(404), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REDIRECTS_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + GetWebcaptureRedirectsResponse::GenericError(body) => { + let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); + + let mut response = Response::with((status::Status::from_u16(500), body_string)); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REDIRECTS_GENERIC_ERROR.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + Err(Response::with((status::InternalServerError, "An internal error occurred".to_string()))) + } + } + } + + handle_request(req, &api_clone, &mut context).or_else(|mut response| { + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + Ok(response) + }) + }, + "GetWebcaptureRedirects", + ); + + let api_clone = api.clone(); + router.get( + "/v0/webcapture/rev/:rev_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request(req: &mut Request, api: &T, context: &mut Context) -> Result + where + T: Api, + { + context.x_span_id = Some(req.headers.get::().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::(); + context.authorization = req.extensions.remove::(); + + // Path parameters + let param_rev_id = { + let param = req + .extensions + .get::() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("rev_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter rev_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter rev_id: {}", e))))? + }; + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) let query_params = req.get::().unwrap_or_default(); - let param_doi = query_params.get("doi").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_wikidata_qid = query_params.get("wikidata_qid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_isbn13 = query_params.get("isbn13").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_pmid = query_params.get("pmid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_pmcid = query_params.get("pmcid").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - let param_core_id = query_params.get("core_id").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::().ok()); - match api - .lookup_release(param_doi, param_wikidata_qid, param_isbn13, param_pmid, param_pmcid, param_core_id, param_expand, param_hide, context) - .wait() - { + match api.get_webcapture_revision(param_rev_id, param_expand, param_hide, context).wait() { Ok(rsp) => match rsp { - LookupReleaseResponse::FoundEntity(body) => { + GetWebcaptureRevisionResponse::FoundEntityRevision(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_FOUND_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REVISION_FOUND_ENTITY_REVISION.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - LookupReleaseResponse::BadRequest(body) => { + GetWebcaptureRevisionResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REVISION_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - LookupReleaseResponse::NotFound(body) => { + GetWebcaptureRevisionResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REVISION_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); Ok(response) } - LookupReleaseResponse::GenericError(body) => { + GetWebcaptureRevisionResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::LOOKUP_RELEASE_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::GET_WEBCAPTURE_REVISION_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); @@ -5151,12 +7320,12 @@ where Ok(response) }) }, - "LookupRelease", + "GetWebcaptureRevision", ); let api_clone = api.clone(); router.put( - "/v0/release/:ident", + "/v0/webcapture/:ident", move |req: &mut Request| { let mut context = Context::default(); @@ -5201,7 +7370,7 @@ where let param_entity = if let Some(param_entity_raw) = param_entity { let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); - let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { + let param_entity: Option = serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) @@ -5213,13 +7382,13 @@ where }; let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?; - match api.update_release(param_ident, param_entity, param_editgroup_id, context).wait() { + match api.update_webcapture(param_ident, param_entity, param_editgroup_id, context).wait() { Ok(rsp) => match rsp { - UpdateReleaseResponse::UpdatedEntity(body) => { + UpdateWebcaptureResponse::UpdatedEntity(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(200), body_string)); - response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_UPDATED_ENTITY.clone())); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WEBCAPTURE_UPDATED_ENTITY.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5227,11 +7396,11 @@ where } Ok(response) } - UpdateReleaseResponse::BadRequest(body) => { + UpdateWebcaptureResponse::BadRequest(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(400), body_string)); - response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_BAD_REQUEST.clone())); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WEBCAPTURE_BAD_REQUEST.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5239,11 +7408,11 @@ where } Ok(response) } - UpdateReleaseResponse::NotFound(body) => { + UpdateWebcaptureResponse::NotFound(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(404), body_string)); - response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_NOT_FOUND.clone())); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WEBCAPTURE_NOT_FOUND.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5251,11 +7420,11 @@ where } Ok(response) } - UpdateReleaseResponse::GenericError(body) => { + UpdateWebcaptureResponse::GenericError(body) => { let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize"); let mut response = Response::with((status::Status::from_u16(500), body_string)); - response.headers.set(ContentType(mimetypes::responses::UPDATE_RELEASE_GENERIC_ERROR.clone())); + response.headers.set(ContentType(mimetypes::responses::UPDATE_WEBCAPTURE_GENERIC_ERROR.clone())); context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); if !unused_elements.is_empty() { @@ -5277,7 +7446,7 @@ where Ok(response) }) }, - "UpdateRelease", + "UpdateWebcapture", ); let api_clone = api.clone(); -- cgit v1.2.3