diff options
Diffstat (limited to 'rust')
-rw-r--r-- | rust/fatcat-api-spec/README.md | 24 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api.yaml | 629 | ||||
-rw-r--r-- | rust/fatcat-api-spec/api/swagger.yaml | 1965 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/client.rs | 155 | ||||
-rw-r--r-- | rust/fatcat-api-spec/examples/server_lib/server.rs | 255 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/client.rs | 1570 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/lib.rs | 478 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/mimetypes.rs | 376 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 243 | ||||
-rw-r--r-- | rust/fatcat-api-spec/src/server.rs | 2185 |
10 files changed, 7838 insertions, 42 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,6 +2252,1294 @@ paths: path: "/file/edit/:edit_id" HttpMethod: "Delete" httpmethod: "delete" + /fileset: + post: + tags: + - "filesets" + operationId: "create_fileset" + parameters: + - in: "body" + name: "entity" + required: true + schema: + $ref: "#/definitions/fileset_entity" + uppercase_data_type: "FILESETENTITY" + refName: "fileset_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_FILESET" + 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_FILESET" + 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_FILESET" + 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_FILESET" + 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_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_fileset" + uppercase_operation_id: "CREATE_FILESET" + path: "/fileset" + HttpMethod: "Post" + httpmethod: "post" + noClientExample: true + /fileset/batch: + post: + tags: + - "filesets" + operationId: "create_fileset_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/fileset_entity" + formatString: "{:?}" + example: "&Vec::new()" + model_key: "editgroup_edits" + uppercase_operation_id: "CREATE_FILESET_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_FILESET_BATCH" + uppercase_data_type: "VEC<ENTITYEDIT>" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "CREATE_FILESET_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_FILESET_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_FILESET_BATCH" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "create_fileset_batch" + uppercase_operation_id: "CREATE_FILESET_BATCH" + path: "/fileset/batch" + HttpMethod: "Post" + httpmethod: "post" + /fileset/{ident}: + get: + tags: + - "filesets" + operationId: "get_fileset" + 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 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 filesets, 'manifest'\ + \ is accepted." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity" + schema: + $ref: "#/definitions/fileset_entity" + x-responseId: "FoundEntity" + x-uppercaseResponseId: "FOUND_ENTITY" + uppercase_operation_id: "GET_FILESET" + uppercase_data_type: "FILESETENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_FILESET" + 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_FILESET" + 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_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_fileset" + uppercase_operation_id: "GET_FILESET" + path: "/fileset/:ident" + HttpMethod: "Get" + httpmethod: "get" + put: + tags: + - "filesets" + operationId: "update_fileset" + parameters: + - name: "ident" + in: "path" + required: true + type: "string" + formatString: "\\\"{}\\\"" + example: "\"ident_example\".to_string()" + - in: "body" + name: "entity" + required: true + schema: + $ref: "#/definitions/fileset_entity" + uppercase_data_type: "FILESETENTITY" + refName: "fileset_entity" + formatString: "{:?}" + example: "???" + model_key: "editgroup_edits" + uppercase_operation_id: "UPDATE_FILESET" + 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_FILESET" + 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_FILESET" + 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_FILESET" + 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_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "update_fileset" + uppercase_operation_id: "UPDATE_FILESET" + path: "/fileset/:ident" + HttpMethod: "Put" + httpmethod: "put" + noClientExample: true + delete: + tags: + - "filesets" + operationId: "delete_fileset" + 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_FILESET" + 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_FILESET" + 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_FILESET" + 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_FILESET" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "delete_fileset" + uppercase_operation_id: "DELETE_FILESET" + path: "/fileset/:ident" + HttpMethod: "Delete" + httpmethod: "delete" + /fileset/rev/{rev_id}: + get: + tags: + - "filesets" + operationId: "get_fileset_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 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 filesets, 'manifest'\ + \ is accepted." + required: false + type: "string" + formatString: "{:?}" + example: "Some(\"hide_example\".to_string())" + responses: + 200: + description: "Found Entity Revision" + schema: + $ref: "#/definitions/fileset_entity" + x-responseId: "FoundEntityRevision" + x-uppercaseResponseId: "FOUND_ENTITY_REVISION" + uppercase_operation_id: "GET_FILESET_REVISION" + uppercase_data_type: "FILESETENTITY" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_FILESET_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_FILESET_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_FILESET_REVISION" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_fileset_revision" + uppercase_operation_id: "GET_FILESET_REVISION" + path: "/fileset/rev/:rev_id" + HttpMethod: "Get" + httpmethod: "get" + /fileset/{ident}/history: + get: + tags: + - "filesets" + operationId: "get_fileset_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_FILESET_HISTORY" + uppercase_data_type: "VEC<ENTITYHISTORYENTRY>" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_FILESET_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_FILESET_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_FILESET_HISTORY" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_fileset_history" + uppercase_operation_id: "GET_FILESET_HISTORY" + path: "/fileset/:ident/history" + HttpMethod: "Get" + httpmethod: "get" + /fileset/{ident}/redirects: + get: + tags: + - "filesets" + operationId: "get_fileset_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_FILESET_REDIRECTS" + uppercase_data_type: "VEC<STRING>" + producesJson: true + 400: + description: "Bad Request" + schema: + $ref: "#/definitions/error_response" + x-responseId: "BadRequest" + x-uppercaseResponseId: "BAD_REQUEST" + uppercase_operation_id: "GET_FILESET_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_FILESET_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_FILESET_REDIRECTS" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_fileset_redirects" + uppercase_operation_id: "GET_FILESET_REDIRECTS" + path: "/fileset/:ident/redirects" + HttpMethod: "Get" + httpmethod: "get" + /fileset/edit/{edit_id}: + get: + tags: + - "filesets" + operationId: "get_fileset_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_FILESET_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_FILESET_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_FILESET_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_FILESET_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "get_fileset_edit" + uppercase_operation_id: "GET_FILESET_EDIT" + path: "/fileset/edit/:edit_id" + HttpMethod: "Get" + httpmethod: "get" + delete: + tags: + - "filesets" + operationId: "delete_fileset_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_FILESET_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_FILESET_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_FILESET_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_FILESET_EDIT" + uppercase_data_type: "ERRORRESPONSE" + producesJson: true + operation_id: "delete_fileset_edit" + uppercase_operation_id: "DELETE_FILESET_EDIT" + path: "/fileset/edit/:edit_id" + HttpMethod: "Delete" + httpmethod: "delete" + /webcapture: + post: + tags: + - "webcaptures" + operationId: "create_webcapture" + parameters: + - 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: "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<ENTITYEDIT>" + 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<ENTITYHISTORYENTRY>" + 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<STRING>" + 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: @@ -2412,7 +3700,7 @@ paths: - name: "expand" in: "query" description: "List of sub-entities to expand in response. For releases, 'files',\ - \ 'container', and 'creators' are valid." + \ 'filesets, 'webcaptures', 'container', and 'creators' are valid." required: false type: "string" formatString: "{:?}" @@ -2795,6 +4083,134 @@ paths: 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<FILESETENTITY>" + 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<WEBCAPTUREENTITY>" + 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: @@ -2902,8 +4318,8 @@ paths: 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 sub-entities to expand in response. For releases, 'files',\ + \ 'filesets, 'webcaptures', 'container', and 'creators' are valid." required: false type: "string" formatString: "{:?}" @@ -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" @@ -4684,6 +6390,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - 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" creators: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -4729,6 +6450,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: + - 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" releases: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -4774,6 +6510,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - 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" creators: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -4819,6 +6570,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: + - 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" releases: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -4936,6 +6702,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - 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" creators: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -4981,6 +6762,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: + - 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" releases: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -5037,6 +6833,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - 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" creators: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -5082,6 +6893,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: + - 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" releases: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -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: @@ -5246,6 +7167,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + webcaptures: + - 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" creators: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 @@ -5291,6 +7227,21 @@ definitions: editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y" prev_revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe" + filesets: + - 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" releases: - ident: "q3nouwy3nnbsvo3h5klxsx4a7y" edit_id: 847 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", @@ -354,6 +375,61 @@ fn main() { // }, // 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("<none>"))); + // }, + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + // 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("<none>"))); + // }, + + // Disabled because there's no example. // Some("CreateRelease") => { // let result = client.create_release(???, Some("editgroup_id_example".to_string())).wait(); // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); @@ -395,6 +471,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } + 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("<none>"))); + } + 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("<none>"))); @@ -412,6 +493,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } + 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("<none>"))); + } + 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("<none>"))); // }, + + // 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("<none>"))); + // }, + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + 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("<none>"))); + } + + // 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("<none>"))); + // }, 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("<none>"))); 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<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "create_fileset({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn create_fileset_batch( + &self, + entity_list: &Vec<models::FilesetEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + 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("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_fileset(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "delete_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_fileset_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("delete_fileset_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset(&self, ident: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetFilesetEditResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_fileset_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_fileset_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_redirects(&self, ident: String, context: &Context) -> Box<Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_fileset_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_fileset_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "update_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_release_filesets(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn get_release_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + 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<String>, context: &Context) -> Box<Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_release_webcaptures(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn lookup_release( &self, doi: Option<String>, @@ -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<String>, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "create_webcapture({:?}, {:?}) - X-Span-ID: {:?}", + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn create_webcapture_batch( + &self, + entity_list: &Vec<models::WebcaptureEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + 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("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "delete_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn delete_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("delete_webcapture_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture(&self, ident: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_webcapture_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_webcapture_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_redirects(&self, ident: String, context: &Context) -> Box<Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!("get_webcapture_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.x_span_id.unwrap_or(String::from("<none>")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + + fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "get_webcapture_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + + fn update_webcapture( + &self, + ident: String, + entity: models::WebcaptureEntity, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + let context = context.clone(); + println!( + "update_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + entity, + editgroup_id, + context.x_span_id.unwrap_or(String::from("<none>")).clone() + ); + Box::new(futures::failed("Generic failure".into())) + } + fn create_work_batch( &self, entity_list: &Vec<models::WorkEntity>, 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,6 +3021,711 @@ impl Api for Client { Box::new(futures::done(result)) } + fn create_fileset(&self, param_entity: models::FilesetEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + 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?{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_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<CreateFilesetResponse, ApiError> { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(CreateFilesetResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn create_fileset_batch( + &self, + param_entity_list: &Vec<models::FilesetEntity>, + param_autoaccept: Option<bool>, + param_editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send> { + // Query parameters + let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); + let query_editgroup_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<CreateFilesetBatchResponse, ApiError> { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_fileset(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + 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<DeleteFilesetResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_fileset_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + 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<DeleteFilesetEditResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::Success>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset(&self, param_ident: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetResponse, Error = ApiError> + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/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<GetFilesetResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::FilesetEntity>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetFilesetEditResponse, Error = ApiError> + 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<GetFilesetEditResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_history(&self, param_ident: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send> { + // Query parameters + let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); + + let url = format!( + "{}/v0/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<GetFilesetHistoryResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_redirects(&self, param_ident: String, context: &Context) -> Box<Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + 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<GetFilesetRedirectsResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<String>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_fileset_revision( + &self, + param_rev_id: String, + param_expand: Option<String>, + param_hide: Option<String>, + context: &Context, + ) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/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<GetFilesetRevisionResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::FilesetEntity>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn update_fileset( + &self, + param_ident: String, + param_entity: models::FilesetEntity, + param_editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + 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<UpdateFilesetResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + 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())); @@ -3572,6 +4280,74 @@ impl Api for Client { Box::new(futures::done(result)) } + fn get_release_filesets(&self, param_ident: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + 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<GetReleaseFilesetsResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::FilesetEntity>>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn get_release_history(&self, param_ident: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { // Query parameters let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); @@ -3780,6 +4556,74 @@ impl Api for Client { Box::new(futures::done(result)) } + fn get_release_webcaptures(&self, param_ident: String, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + 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<GetReleaseWebcapturesResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::WebcaptureEntity>>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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::<models::ErrorResponse>(&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!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn lookup_release( &self, param_doi: Option<String>, @@ -3951,6 +4795,716 @@ impl Api for Client { Box::new(futures::done(result)) } + fn create_webcapture( + &self, + param_entity: models::WebcaptureEntity, + param_editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + 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/webcapture?{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_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<CreateWebcaptureResponse, ApiError> { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(CreateWebcaptureResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn create_webcapture_batch( + &self, + param_entity_list: &Vec<models::WebcaptureEntity>, + param_autoaccept: Option<bool>, + param_editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send> { + // Query parameters + let query_autoaccept = param_autoaccept.map_or_else(String::new, |query| format!("autoaccept={autoaccept}&", autoaccept = query.to_string())); + let query_editgroup_id = param_editgroup_id.map_or_else(String::new, |query| format!("editgroup_id={editgroup_id}&", editgroup_id = query.to_string())); + + let url = format!( + "{}/v0/webcapture/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_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<CreateWebcaptureBatchResponse, ApiError> { + match response.status.to_u16() { + 201 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::EntityEdit>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(CreateWebcaptureBatchResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_webcapture(&self, param_ident: String, param_editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + 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/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) + ); + + 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<DeleteWebcaptureResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(DeleteWebcaptureResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn delete_webcapture_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send> { + let url = format!( + "{}/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::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<DeleteWebcaptureEditResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::Success>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(DeleteWebcaptureEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_webcapture(&self, param_ident: String, param_expand: Option<String>, param_hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureResponse, Error = ApiError> + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/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) + ); + + 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<GetWebcaptureResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::WebcaptureEntity>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(GetWebcaptureResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_webcapture_edit(&self, param_edit_id: i64, context: &Context) -> Box<Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send> { + let url = format!( + "{}/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 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<GetWebcaptureEditResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(GetWebcaptureEditResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_webcapture_history(&self, param_ident: String, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send> { + // Query parameters + let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string())); + + let url = format!( + "{}/v0/webcapture/{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<GetWebcaptureHistoryResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<models::EntityHistoryEntry>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(GetWebcaptureHistoryResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_webcapture_redirects(&self, param_ident: String, context: &Context) -> Box<Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send> { + let url = format!( + "{}/v0/webcapture/{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<GetWebcaptureRedirectsResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<Vec<String>>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(GetWebcaptureRedirectsResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn get_webcapture_revision( + &self, + param_rev_id: String, + param_expand: Option<String>, + param_hide: Option<String>, + context: &Context, + ) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send> { + // Query parameters + let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string())); + let query_hide = param_hide.map_or_else(String::new, |query| format!("hide={hide}&", hide = query.to_string())); + + let url = format!( + "{}/v0/webcapture/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<GetWebcaptureRevisionResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::WebcaptureEntity>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(GetWebcaptureRevisionResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + + fn update_webcapture( + &self, + param_ident: String, + param_entity: models::WebcaptureEntity, + param_editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + 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/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) + ); + + 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_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<UpdateWebcaptureResponse, ApiError> { + match response.status.to_u16() { + 200 => { + let mut buf = String::new(); + response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; + let body = serde_json::from_str::<models::EntityEdit>(&buf)?; + + Ok(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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + 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::<models::ErrorResponse>(&buf)?; + + Ok(UpdateWebcaptureResponse::GenericError(body)) + } + code => { + let mut buf = [0; 100]; + let debug_body = match response.read(&mut buf) { + Ok(len) => match str::from_utf8(&buf[..len]) { + Ok(body) => Cow::from(body), + Err(_) => Cow::from(format!("<Body was not UTF8: {:?}>", &buf[..len].to_vec())), + }, + Err(e) => Cow::from(format!("<Failed to read body: {}>", e)), + }; + Err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", code, response.headers, debug_body))) + } + } + } + + let result = request.send().map_err(|e| ApiError(format!("No response received: {}", e))).and_then(parse_response); + Box::new(futures::done(result)) + } + fn create_work_batch( &self, param_entity_list: &Vec<models::WorkEntity>, 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 @@ -519,6 +519,126 @@ pub enum UpdateFileResponse { } #[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<models::EntityEdit>), + /// 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<models::EntityHistoryEntry>), + /// 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<String>), + /// 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 CreatedEntity(models::EntityEdit), @@ -615,6 +735,18 @@ pub enum GetReleaseFilesResponse { } #[derive(Debug, PartialEq)] +pub enum GetReleaseFilesetsResponse { + /// Found + Found(Vec<models::FilesetEntity>), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] pub enum GetReleaseHistoryResponse { /// Found Entity History FoundEntityHistory(Vec<models::EntityHistoryEntry>), @@ -651,6 +783,18 @@ pub enum GetReleaseRevisionResponse { } #[derive(Debug, PartialEq)] +pub enum GetReleaseWebcapturesResponse { + /// Found + Found(Vec<models::WebcaptureEntity>), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] pub enum LookupReleaseResponse { /// Found Entity FoundEntity(models::ReleaseEntity), @@ -675,6 +819,126 @@ pub enum UpdateReleaseResponse { } #[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<models::EntityEdit>), + /// 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<models::EntityHistoryEntry>), + /// 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<String>), + /// 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 CreatedEntities(Vec<models::EntityEdit>), @@ -919,6 +1183,32 @@ pub trait Api { fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; + + fn create_fileset_batch( + &self, + entity_list: &Vec<models::FilesetEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send>; + + fn delete_fileset(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; + + fn delete_fileset_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send>; + + fn get_fileset(&self, ident: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetResponse, Error = ApiError> + Send>; + + fn get_fileset_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetFilesetEditResponse, Error = ApiError> + Send>; + + fn get_fileset_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send>; + + fn get_fileset_redirects(&self, ident: String, context: &Context) -> Box<Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send>; + + fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send>; + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; fn create_release_batch( @@ -941,12 +1231,16 @@ pub trait Api { fn get_release_files(&self, ident: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_release_filesets(&self, ident: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send>; + fn get_release_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>; fn get_release_redirects(&self, ident: String, context: &Context) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send>; fn get_release_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send>; + fn get_release_webcaptures(&self, ident: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send>; + fn lookup_release( &self, doi: Option<String>, @@ -962,6 +1256,38 @@ pub trait Api { fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; + + fn create_webcapture_batch( + &self, + entity_list: &Vec<models::WebcaptureEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send>; + + fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>, context: &Context) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; + + fn delete_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send>; + + fn get_webcapture(&self, ident: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureResponse, Error = ApiError> + Send>; + + fn get_webcapture_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send>; + + fn get_webcapture_history(&self, ident: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send>; + + fn get_webcapture_redirects(&self, ident: String, context: &Context) -> Box<Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send>; + + fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send>; + + fn update_webcapture( + &self, + ident: String, + entity: models::WebcaptureEntity, + editgroup_id: Option<String>, + context: &Context, + ) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; + fn create_work_batch( &self, entity_list: &Vec<models::WorkEntity>, @@ -1096,6 +1422,31 @@ pub trait ApiNoContext { fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>; + fn create_fileset(&self, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; + + fn create_fileset_batch( + &self, + entity_list: &Vec<models::FilesetEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send>; + + fn delete_fileset(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; + + fn delete_fileset_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send>; + + fn get_fileset(&self, ident: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFilesetResponse, Error = ApiError> + Send>; + + fn get_fileset_edit(&self, edit_id: i64) -> Box<Future<Item = GetFilesetEditResponse, Error = ApiError> + Send>; + + fn get_fileset_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send>; + + fn get_fileset_redirects(&self, ident: String) -> Box<Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send>; + + fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send>; + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; fn create_release_batch( @@ -1117,12 +1468,16 @@ pub trait ApiNoContext { fn get_release_files(&self, ident: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_release_filesets(&self, ident: String, hide: Option<String>) -> Box<Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send>; + fn get_release_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>; fn get_release_redirects(&self, ident: String) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send>; fn get_release_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send>; + fn get_release_webcaptures(&self, ident: String, hide: Option<String>) -> Box<Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send>; + fn lookup_release( &self, doi: Option<String>, @@ -1137,6 +1492,31 @@ pub trait ApiNoContext { fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; + fn create_webcapture(&self, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; + + fn create_webcapture_batch( + &self, + entity_list: &Vec<models::WebcaptureEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send>; + + fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; + + fn delete_webcapture_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send>; + + fn get_webcapture(&self, ident: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWebcaptureResponse, Error = ApiError> + Send>; + + fn get_webcapture_edit(&self, edit_id: i64) -> Box<Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send>; + + fn get_webcapture_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send>; + + fn get_webcapture_redirects(&self, ident: String) -> Box<Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send>; + + fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send>; + + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; + fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>; fn delete_work(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + self.api().create_fileset(entity, editgroup_id, &self.context()) + } + + fn create_fileset_batch( + &self, + entity_list: &Vec<models::FilesetEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + ) -> Box<Future<Item = CreateFilesetBatchResponse, Error = ApiError> + Send> { + self.api().create_fileset_batch(entity_list, autoaccept, editgroup_id, &self.context()) + } + + fn delete_fileset(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + self.api().delete_fileset(ident, editgroup_id, &self.context()) + } + + fn delete_fileset_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send> { + self.api().delete_fileset_edit(edit_id, &self.context()) + } + + fn get_fileset(&self, ident: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFilesetResponse, Error = ApiError> + Send> { + self.api().get_fileset(ident, expand, hide, &self.context()) + } + + fn get_fileset_edit(&self, edit_id: i64) -> Box<Future<Item = GetFilesetEditResponse, Error = ApiError> + Send> { + self.api().get_fileset_edit(edit_id, &self.context()) + } + + fn get_fileset_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send> { + self.api().get_fileset_history(ident, limit, &self.context()) + } + + fn get_fileset_redirects(&self, ident: String) -> Box<Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send> { + self.api().get_fileset_redirects(ident, &self.context()) + } + + fn get_fileset_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send> { + self.api().get_fileset_revision(rev_id, expand, hide, &self.context()) + } + + fn update_fileset(&self, ident: String, entity: models::FilesetEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + self.api().update_fileset(ident, entity, editgroup_id, &self.context()) + } + fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send> { + self.api().get_release_filesets(ident, hide, &self.context()) + } + fn get_release_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + 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<String>) -> Box<Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send> { + self.api().get_release_webcaptures(ident, hide, &self.context()) + } + fn lookup_release( &self, doi: Option<String>, @@ -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<String>) -> Box<Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + self.api().create_webcapture(entity, editgroup_id, &self.context()) + } + + fn create_webcapture_batch( + &self, + entity_list: &Vec<models::WebcaptureEntity>, + autoaccept: Option<bool>, + editgroup_id: Option<String>, + ) -> Box<Future<Item = CreateWebcaptureBatchResponse, Error = ApiError> + Send> { + self.api().create_webcapture_batch(entity_list, autoaccept, editgroup_id, &self.context()) + } + + fn delete_webcapture(&self, ident: String, editgroup_id: Option<String>) -> Box<Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + self.api().delete_webcapture(ident, editgroup_id, &self.context()) + } + + fn delete_webcapture_edit(&self, edit_id: i64) -> Box<Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send> { + self.api().delete_webcapture_edit(edit_id, &self.context()) + } + + fn get_webcapture(&self, ident: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWebcaptureResponse, Error = ApiError> + Send> { + self.api().get_webcapture(ident, expand, hide, &self.context()) + } + + fn get_webcapture_edit(&self, edit_id: i64) -> Box<Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send> { + self.api().get_webcapture_edit(edit_id, &self.context()) + } + + fn get_webcapture_history(&self, ident: String, limit: Option<i64>) -> Box<Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send> { + self.api().get_webcapture_history(ident, limit, &self.context()) + } + + fn get_webcapture_redirects(&self, ident: String) -> Box<Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send> { + self.api().get_webcapture_redirects(ident, &self.context()) + } + + fn get_webcapture_revision(&self, rev_id: String, expand: Option<String>, hide: Option<String>) -> Box<Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send> { + self.api().get_webcapture_revision(rev_id, expand, hide, &self.context()) + } + + fn update_webcapture(&self, ident: String, entity: models::WebcaptureEntity, editgroup_id: Option<String>) -> Box<Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + self.api().update_webcapture(ident, entity, editgroup_id, &self.context()) + } + fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + 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<Vec<models::EntityEdit>>, + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option<Vec<models::EntityEdit>>, + + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option<Vec<models::EntityEdit>>, + #[serde(rename = "releases")] #[serde(skip_serializing_if = "Option::is_none")] pub releases: Option<Vec<models::EntityEdit>>, @@ -246,6 +254,8 @@ impl EditgroupEdits { containers: None, creators: None, files: None, + filesets: None, + webcaptures: None, releases: None, works: None, } @@ -439,6 +449,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<Vec<String>>, + + #[serde(rename = "urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub urls: Option<Vec<models::FileEntityUrls>>, + + #[serde(rename = "manifest")] + #[serde(skip_serializing_if = "Option::is_none")] + pub manifest: Option<Vec<models::FilesetEntityManifest>>, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option<String>, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option<String>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option<serde_json::Value>, +} + +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<String>, + + #[serde(rename = "sha1")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha1: Option<String>, + + #[serde(rename = "sha256")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha256: Option<String>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, +} + +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")] #[serde(skip_serializing_if = "Option::is_none")] @@ -559,6 +666,16 @@ pub struct ReleaseEntity { pub container_id: Option<String>, /// Optional; GET-only + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option<Vec<models::WebcaptureEntity>>, + + /// Optional; GET-only + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option<Vec<models::FilesetEntity>>, + + /// Optional; GET-only #[serde(rename = "files")] #[serde(skip_serializing_if = "Option::is_none")] pub files: Option<Vec<models::FileEntity>>, @@ -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, @@ -735,6 +854,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<Vec<String>>, + + #[serde(rename = "timestamp")] + #[serde(skip_serializing_if = "Option::is_none")] + pub timestamp: Option<chrono::DateTime<chrono::Utc>>, + + #[serde(rename = "original_url")] + #[serde(skip_serializing_if = "Option::is_none")] + pub original_url: Option<String>, + + #[serde(rename = "archive_urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub archive_urls: Option<Vec<models::WebcaptureEntityArchiveUrls>>, + + #[serde(rename = "cdx")] + #[serde(skip_serializing_if = "Option::is_none")] + pub cdx: Option<Vec<models::WebcaptureEntityCdx>>, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option<serde_json::Value>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option<String>, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option<String>, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<String>, +} + +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<String>, + + #[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<String>, +} + +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")] #[serde(skip_serializing_if = "Option::is_none")] 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,6 +4003,996 @@ where let api_clone = api.clone(); router.post( + "/v0/fileset", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option<models::FilesetEntity> = 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_fileset(param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_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) + } + 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_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) + } + 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_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) + } + 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_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) + }) + }, + "CreateFileset", + ); + + let api_clone = api.clone(); + router.post( + "/v0/fileset/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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); + let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok()); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity_list = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + + let param_entity_list: Option<Vec<models::FilesetEntity>> = 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_fileset_batch(param_entity_list.as_ref(), param_autoaccept, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_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) + } + 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_FILESET_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) + } + 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_FILESET_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) + } + 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_FILESET_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) + }) + }, + "CreateFilesetBatch", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/fileset/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + match api.delete_fileset(param_ident, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_DELETED_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "DeleteFileset", + ); + + let api_clone = api.clone(); + router.delete( + "/v0/fileset/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::<Router>() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.delete_fileset_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_EDIT_DELETED_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "DeleteFilesetEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/fileset/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + match api.get_fileset(param_ident, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_FOUND_ENTITY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "GetFileset", + ); + + let api_clone = api.clone(); + router.get( + "/v0/fileset/edit/:edit_id", + move |req: &mut Request| { + let mut context = Context::default(); + + // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists). + fn handle_request<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::<Router>() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.get_fileset_edit(param_edit_id, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_EDIT_FOUND_EDIT.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "GetFilesetEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/fileset/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok()); + + match api.get_fileset_history(param_ident, param_limit, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_HISTORY_FOUND_ENTITY_HISTORY.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_HISTORY_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_HISTORY_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "GetFilesetHistory", + ); + + let api_clone = api.clone(); + router.get( + "/v0/fileset/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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_fileset_redirects(param_ident, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_REDIRECTS_FOUND_ENTITY_REDIRECTS.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_REDIRECTS_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_REDIRECTS_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "GetFilesetRedirects", + ); + + let api_clone = api.clone(); + router.get( + "/v0/fileset/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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_rev_id = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + match api.get_fileset_revision(param_rev_id, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + 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_FILESET_REVISION_FOUND_ENTITY_REVISION.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_REVISION_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_REVISION_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_FILESET_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) + }) + }, + "GetFilesetRevision", + ); + + let api_clone = api.clone(); + router.put( + "/v0/fileset/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option<models::FilesetEntity> = 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(); @@ -4792,6 +5785,99 @@ where 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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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(); @@ -5068,6 +6154,99 @@ where 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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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(); @@ -5282,6 +6461,996 @@ where 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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option<models::WebcaptureEntity> = 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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) + let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default(); + let param_autoaccept = query_params.get("autoaccept").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().ok()); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity_list = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity_list - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity_list = if let Some(param_entity_list_raw) = param_entity_list { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_list_raw); + + let param_entity_list: Option<Vec<models::WebcaptureEntity>> = 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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::<Router>() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.delete_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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + match api.get_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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_edit_id = { + let param = req + .extensions + .get::<Router>() + .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))? + .find("edit_id") + .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter edit_id".to_string())))?; + percent_decode(param.as_bytes()) + .decode_utf8() + .map_err(|_| Response::with((status::BadRequest, format!("Couldn't percent-decode path parameter as UTF-8: {}", param))))? + .parse() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter edit_id: {}", e))))? + }; + + match api.get_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) + } + 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_WEBCAPTURE_EDIT_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_WEBCAPTURE_EDIT_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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_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) + }) + }, + "GetWebcaptureEdit", + ); + + let api_clone = api.clone(); + router.get( + "/v0/webcapture/: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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok()); + + match api.get_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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_rev_id = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + let param_hide = query_params.get("hide").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + match api.get_webcapture_revision(param_rev_id, param_expand, param_hide, context).wait() { + Ok(rsp) => match rsp { + 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::GET_WEBCAPTURE_REVISION_FOUND_ENTITY_REVISION.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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::GET_WEBCAPTURE_REVISION_BAD_REQUEST.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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::GET_WEBCAPTURE_REVISION_NOT_FOUND.clone())); + + context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone()))); + + Ok(response) + } + 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::GET_WEBCAPTURE_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) + }) + }, + "GetWebcaptureRevision", + ); + + let api_clone = api.clone(); + router.put( + "/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<T>(req: &mut Request, api: &T, context: &mut Context) -> Result<Response, Response> + where + T: Api, + { + context.x_span_id = Some(req.headers.get::<XSpanId>().map(XSpanId::to_string).unwrap_or_else(|| self::uuid::Uuid::new_v4().to_string())); + context.auth_data = req.extensions.remove::<AuthData>(); + context.authorization = req.extensions.remove::<Authorization>(); + + // Path parameters + let param_ident = { + let param = req + .extensions + .get::<Router>() + .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::<UrlEncodedQuery>().unwrap_or_default(); + let param_editgroup_id = query_params.get("editgroup_id").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok()); + + // Body parameters (note that non-required body parameters will ignore garbage + // values, rather than causing a 400 response). Produce warning header and logs for + // any unused fields. + + let param_entity = req + .get::<bodyparser::Raw>() + .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?; + + let mut unused_elements = Vec::new(); + + let param_entity = if let Some(param_entity_raw) = param_entity { + let deserializer = &mut serde_json::Deserializer::from_str(¶m_entity_raw); + + let param_entity: Option<models::WebcaptureEntity> = 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_webcapture(param_ident, param_entity, param_editgroup_id, context).wait() { + Ok(rsp) => match rsp { + 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_WEBCAPTURE_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) + } + 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_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) + } + 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_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) + } + 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_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) + }) + }, + "UpdateWebcapture", + ); + + let api_clone = api.clone(); + router.post( "/v0/work/batch", move |req: &mut Request| { let mut context = Context::default(); |