aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api-spec')
-rw-r--r--rust/fatcat-api-spec/README.md9
-rw-r--r--rust/fatcat-api-spec/api.yaml241
-rw-r--r--rust/fatcat-api-spec/api/swagger.yaml606
-rw-r--r--rust/fatcat-api-spec/examples/client.rs60
-rw-r--r--rust/fatcat-api-spec/examples/server_lib/server.rs117
-rw-r--r--rust/fatcat-api-spec/src/client.rs521
-rw-r--r--rust/fatcat-api-spec/src/lib.rs190
-rw-r--r--rust/fatcat-api-spec/src/mimetypes.rs136
-rw-r--r--rust/fatcat-api-spec/src/models.rs53
-rw-r--r--rust/fatcat-api-spec/src/server.rs671
10 files changed, 2507 insertions, 97 deletions
diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md
index 300cba5f..cb7815d2 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: 2019-01-10T07:48:01.403Z
+- Build date: 2019-01-11T05:35:09.223Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
@@ -81,14 +81,19 @@ cargo run --example client LookupCreator
cargo run --example client UpdateCreator
cargo run --example client AuthCheck
cargo run --example client AuthOidc
+cargo run --example client GetEditgroupsReviewable
cargo run --example client GetEditor
-cargo run --example client GetEditorChangelog
+cargo run --example client GetEditorEditgroups
+cargo run --example client UpdateEditgroup
cargo run --example client UpdateEditor
cargo run --example client AcceptEditgroup
cargo run --example client CreateEditgroup
+cargo run --example client CreateEditgroupAnnotation
cargo run --example client GetChangelog
cargo run --example client GetChangelogEntry
cargo run --example client GetEditgroup
+cargo run --example client GetEditgroupAnnotations
+cargo run --example client GetEditorAnnotations
cargo run --example client CreateFile
cargo run --example client CreateFileBatch
cargo run --example client DeleteFile
diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml
index 70e8e540..61f895fa 100644
--- a/rust/fatcat-api-spec/api.yaml
+++ b/rust/fatcat-api-spec/api.yaml
@@ -465,11 +465,18 @@ definitions:
<<: *FATCATIDENT
editor_id:
<<: *FATCATIDENT
+ submitted:
+ type: string
+ format: date-time
description:
type: string
extra:
type: object
additionalProperties: {}
+ annotations:
+ type: array
+ items:
+ $ref: "#/definitions/editgroup_annotation"
edits:
type: object
properties:
@@ -501,6 +508,23 @@ definitions:
type: array
items:
$ref: "#/definitions/entity_edit"
+ editgroup_annotation:
+ type: object
+ properties:
+ annotation_id:
+ <<: *FATCATUUID
+ editgroup_id:
+ <<: *FATCATIDENT
+ editor_id:
+ <<: *FATCATIDENT
+ created:
+ type: string
+ format: date-time
+ comment_markdown:
+ type: string
+ extra:
+ type: object
+ additionalProperties: {}
changelog_entry:
type: object
required:
@@ -2524,21 +2548,37 @@ paths:
schema:
$ref: "#/definitions/error_response"
<<: *AUTHRESPONSES
- /editor/{editor_id}/changelog:
+ /editor/{editor_id}/editgroups:
parameters:
- name: editor_id
in: path
type: string
required: true
get:
- operationId: "get_editor_changelog"
+ operationId: "get_editor_editgroups"
+ parameters:
+ - name: limit
+ in: query
+ type: integer
+ format: int64
+ required: false
+ - name: before
+ in: query
+ type: string
+ format: date-time
+ required: false
+ - name: since
+ in: query
+ type: string
+ format: date-time
+ required: false
responses:
200:
description: Found
schema:
type: array
items:
- $ref: "#/definitions/changelog_entry"
+ $ref: "#/definitions/editgroup"
400:
description: Bad Request
schema:
@@ -2551,6 +2591,52 @@ paths:
description: Generic Error
schema:
$ref: "#/definitions/error_response"
+ /editor/{editor_id}/annotations:
+ parameters:
+ - name: editor_id
+ in: path
+ required: true
+ <<: *FATCATIDENT
+ get:
+ operationId: "get_editor_annotations"
+ tags: # TAGLINE
+ - edit-lifecycle # TAGLINE
+ parameters:
+ - name: limit
+ in: query
+ type: integer
+ format: int64
+ required: false
+ - name: before
+ in: query
+ type: string
+ format: date-time
+ required: false
+ - name: since
+ in: query
+ type: string
+ format: date-time
+ required: false
+ responses:
+ 200:
+ description: Success
+ schema:
+ type: array
+ items:
+ $ref: "#/definitions/editgroup_annotation"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
+ 404:
+ description: Not Found
+ schema:
+ $ref: "#/definitions/error_response"
+ 500:
+ description: Generic Error
+ schema:
+ $ref: "#/definitions/error_response"
+ <<: *AUTHRESPONSES
/editgroup:
post:
operationId: "create_editgroup"
@@ -2609,6 +2695,38 @@ paths:
description: Generic Error
schema:
$ref: "#/definitions/error_response"
+ put:
+ operationId: "update_editgroup"
+ security:
+ - Bearer: []
+ parameters:
+ - name: editgroup
+ in: body
+ required: true
+ schema:
+ $ref: "#/definitions/editgroup"
+ - name: submit
+ in: query
+ type: boolean
+ required: false
+ responses:
+ 200:
+ description: Updated Editgroup
+ schema:
+ $ref: "#/definitions/editgroup"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
+ 404:
+ description: Not Found
+ schema:
+ $ref: "#/definitions/error_response"
+ 500:
+ description: Generic Error
+ schema:
+ $ref: "#/definitions/error_response"
+ <<: *AUTHRESPONSES
/editgroup/{editgroup_id}/accept:
parameters:
- name: editgroup_id
@@ -2643,6 +2761,123 @@ paths:
schema:
$ref: "#/definitions/error_response"
<<: *AUTHRESPONSES
+ /editgroup/{editgroup_id}/annotations:
+ parameters:
+ - name: editgroup_id
+ in: path
+ required: true
+ <<: *FATCATIDENT
+ get:
+ operationId: "get_editgroup_annotations"
+ tags: # TAGLINE
+ - edit-lifecycle # TAGLINE
+ security:
+ - Bearer: []
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For editgroups: 'editors'"
+ responses:
+ 200:
+ description: Success
+ schema:
+ type: array
+ items:
+ $ref: "#/definitions/editgroup_annotation"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
+ 404:
+ description: Not Found
+ schema:
+ $ref: "#/definitions/error_response"
+ 500:
+ description: Generic Error
+ schema:
+ $ref: "#/definitions/error_response"
+ <<: *AUTHRESPONSES
+ /editgroup/{editgroup_id}/annotation:
+ parameters:
+ - name: editgroup_id
+ in: path
+ required: true
+ <<: *FATCATIDENT
+ post:
+ operationId: "create_editgroup_annotation"
+ tags: # TAGLINE
+ - edit-lifecycle # TAGLINE
+ security:
+ - Bearer: []
+ parameters:
+ - name: annotation
+ in: body
+ required: true
+ schema:
+ $ref: "#/definitions/editgroup_annotation"
+ responses:
+ 201:
+ description: Created
+ schema:
+ $ref: "#/definitions/editgroup_annotation"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
+ 404:
+ description: Not Found
+ schema:
+ $ref: "#/definitions/error_response"
+ 500:
+ description: Generic Error
+ schema:
+ $ref: "#/definitions/error_response"
+ <<: *AUTHRESPONSES
+ /editgroup/reviewable:
+ get:
+ operationId: "get_editgroups_reviewable"
+ parameters:
+ - name: expand
+ in: query
+ type: string
+ required: false
+ description: "List of sub-entities to expand in response. For editgroups: 'editors'"
+ - name: limit
+ in: query
+ type: integer
+ format: int64
+ required: false
+ - name: before
+ in: query
+ type: string
+ format: date-time
+ required: false
+ - name: since
+ in: query
+ type: string
+ format: date-time
+ required: false
+ responses:
+ 200:
+ description: Found
+ schema:
+ type: array
+ items:
+ $ref: "#/definitions/editgroup"
+ 400:
+ description: Bad Request
+ schema:
+ $ref: "#/definitions/error_response"
+ 404:
+ description: Not Found
+ schema:
+ $ref: "#/definitions/error_response"
+ 500:
+ description: Generic Error
+ schema:
+ $ref: "#/definitions/error_response"
/changelog:
parameters:
- name: limit
diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml
index 0b18add8..bf6d32dc 100644
--- a/rust/fatcat-api-spec/api/swagger.yaml
+++ b/rust/fatcat-api-spec/api/swagger.yaml
@@ -6206,9 +6206,9 @@ paths:
HttpMethod: "Put"
httpmethod: "put"
noClientExample: true
- /editor/{editor_id}/changelog:
+ /editor/{editor_id}/editgroups:
get:
- operationId: "get_editor_changelog"
+ operationId: "get_editor_editgroups"
parameters:
- name: "editor_id"
in: "path"
@@ -6216,17 +6216,119 @@ paths:
type: "string"
formatString: "\\\"{}\\\""
example: "\"editor_id_example\".to_string()"
+ - name: "limit"
+ in: "query"
+ required: false
+ type: "integer"
+ format: "int64"
+ formatString: "{:?}"
+ example: "Some(789)"
+ - name: "before"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
+ - name: "since"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
responses:
200:
description: "Found"
schema:
type: "array"
items:
- $ref: "#/definitions/changelog_entry"
+ $ref: "#/definitions/editgroup"
x-responseId: "Found"
x-uppercaseResponseId: "FOUND"
- uppercase_operation_id: "GET_EDITOR_CHANGELOG"
- uppercase_data_type: "VEC<CHANGELOGENTRY>"
+ uppercase_operation_id: "GET_EDITOR_EDITGROUPS"
+ uppercase_data_type: "VEC<EDITGROUP>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_EDITOR_EDITGROUPS"
+ 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_EDITOR_EDITGROUPS"
+ 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_EDITOR_EDITGROUPS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_editor_editgroups"
+ uppercase_operation_id: "GET_EDITOR_EDITGROUPS"
+ path: "/editor/:editor_id/editgroups"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ /editor/{editor_id}/annotations:
+ get:
+ tags:
+ - "edit-lifecycle"
+ operationId: "get_editor_annotations"
+ parameters:
+ - name: "editor_id"
+ in: "path"
+ description: "base32-encoded unique identifier"
+ required: true
+ type: "string"
+ maxLength: 26
+ minLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ formatString: "\\\"{}\\\""
+ example: "\"editor_id_example\".to_string()"
+ - name: "limit"
+ in: "query"
+ required: false
+ type: "integer"
+ format: "int64"
+ formatString: "{:?}"
+ example: "Some(789)"
+ - name: "before"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
+ - name: "since"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
+ responses:
+ 200:
+ description: "Success"
+ schema:
+ type: "array"
+ items:
+ $ref: "#/definitions/editgroup_annotation"
+ x-responseId: "Success"
+ x-uppercaseResponseId: "SUCCESS"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
+ uppercase_data_type: "VEC<EDITGROUPANNOTATION>"
producesJson: true
400:
description: "Bad Request"
@@ -6234,7 +6336,28 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "BadRequest"
x-uppercaseResponseId: "BAD_REQUEST"
- uppercase_operation_id: "GET_EDITOR_CHANGELOG"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 401:
+ description: "Not Authorized"
+ schema:
+ $ref: "#/definitions/error_response"
+ headers:
+ WWW_Authenticate:
+ type: "string"
+ x-responseId: "NotAuthorized"
+ x-uppercaseResponseId: "NOT_AUTHORIZED"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 403:
+ description: "Forbidden"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "Forbidden"
+ x-uppercaseResponseId: "FORBIDDEN"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
404:
@@ -6243,7 +6366,7 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "NotFound"
x-uppercaseResponseId: "NOT_FOUND"
- uppercase_operation_id: "GET_EDITOR_CHANGELOG"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
500:
@@ -6252,12 +6375,12 @@ paths:
$ref: "#/definitions/error_response"
x-responseId: "GenericError"
x-uppercaseResponseId: "GENERIC_ERROR"
- uppercase_operation_id: "GET_EDITOR_CHANGELOG"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
uppercase_data_type: "ERRORRESPONSE"
producesJson: true
- operation_id: "get_editor_changelog"
- uppercase_operation_id: "GET_EDITOR_CHANGELOG"
- path: "/editor/:editor_id/changelog"
+ operation_id: "get_editor_annotations"
+ uppercase_operation_id: "GET_EDITOR_ANNOTATIONS"
+ path: "/editor/:editor_id/annotations"
HttpMethod: "Get"
httpmethod: "get"
/editgroup:
@@ -6402,6 +6525,103 @@ paths:
path: "/editgroup/:editgroup_id"
HttpMethod: "Get"
httpmethod: "get"
+ put:
+ operationId: "update_editgroup"
+ parameters:
+ - name: "editgroup_id"
+ in: "path"
+ description: "base32-encoded unique identifier"
+ required: true
+ type: "string"
+ maxLength: 26
+ minLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ formatString: "\\\"{}\\\""
+ example: "\"editgroup_id_example\".to_string()"
+ - in: "body"
+ name: "editgroup"
+ required: true
+ schema:
+ $ref: "#/definitions/editgroup"
+ uppercase_data_type: "EDITGROUP"
+ refName: "editgroup"
+ formatString: "{:?}"
+ example: "???"
+ model_key: "editgroup_edits"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ consumesJson: true
+ - name: "submit"
+ in: "query"
+ required: false
+ type: "boolean"
+ formatString: "{:?}"
+ example: "Some(true)"
+ responses:
+ 200:
+ description: "Updated Editgroup"
+ schema:
+ $ref: "#/definitions/editgroup"
+ x-responseId: "UpdatedEditgroup"
+ x-uppercaseResponseId: "UPDATED_EDITGROUP"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ uppercase_data_type: "EDITGROUP"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 401:
+ description: "Not Authorized"
+ schema:
+ $ref: "#/definitions/error_response"
+ headers:
+ WWW_Authenticate:
+ type: "string"
+ x-responseId: "NotAuthorized"
+ x-uppercaseResponseId: "NOT_AUTHORIZED"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 403:
+ description: "Forbidden"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "Forbidden"
+ x-uppercaseResponseId: "FORBIDDEN"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ 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_EDITGROUP"
+ 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_EDITGROUP"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ security:
+ - Bearer: []
+ operation_id: "update_editgroup"
+ uppercase_operation_id: "UPDATE_EDITGROUP"
+ path: "/editgroup/:editgroup_id"
+ HttpMethod: "Put"
+ httpmethod: "put"
+ noClientExample: true
/editgroup/{editgroup_id}/accept:
post:
tags:
@@ -6492,6 +6712,268 @@ paths:
path: "/editgroup/:editgroup_id/accept"
HttpMethod: "Post"
httpmethod: "post"
+ /editgroup/{editgroup_id}/annotations:
+ get:
+ tags:
+ - "edit-lifecycle"
+ operationId: "get_editgroup_annotations"
+ parameters:
+ - name: "editgroup_id"
+ in: "path"
+ description: "base32-encoded unique identifier"
+ required: true
+ type: "string"
+ maxLength: 26
+ minLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ formatString: "\\\"{}\\\""
+ example: "\"editgroup_id_example\".to_string()"
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For editgroups:\
+ \ 'editors'"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ responses:
+ 200:
+ description: "Success"
+ schema:
+ type: "array"
+ items:
+ $ref: "#/definitions/editgroup_annotation"
+ x-responseId: "Success"
+ x-uppercaseResponseId: "SUCCESS"
+ uppercase_operation_id: "GET_EDITGROUP_ANNOTATIONS"
+ uppercase_data_type: "VEC<EDITGROUPANNOTATION>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_EDITGROUP_ANNOTATIONS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 401:
+ description: "Not Authorized"
+ schema:
+ $ref: "#/definitions/error_response"
+ headers:
+ WWW_Authenticate:
+ type: "string"
+ x-responseId: "NotAuthorized"
+ x-uppercaseResponseId: "NOT_AUTHORIZED"
+ uppercase_operation_id: "GET_EDITGROUP_ANNOTATIONS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 403:
+ description: "Forbidden"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "Forbidden"
+ x-uppercaseResponseId: "FORBIDDEN"
+ uppercase_operation_id: "GET_EDITGROUP_ANNOTATIONS"
+ 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_EDITGROUP_ANNOTATIONS"
+ 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_EDITGROUP_ANNOTATIONS"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ security:
+ - Bearer: []
+ operation_id: "get_editgroup_annotations"
+ uppercase_operation_id: "GET_EDITGROUP_ANNOTATIONS"
+ path: "/editgroup/:editgroup_id/annotations"
+ HttpMethod: "Get"
+ httpmethod: "get"
+ /editgroup/{editgroup_id}/annotation:
+ post:
+ tags:
+ - "edit-lifecycle"
+ operationId: "create_editgroup_annotation"
+ parameters:
+ - name: "editgroup_id"
+ in: "path"
+ description: "base32-encoded unique identifier"
+ required: true
+ type: "string"
+ maxLength: 26
+ minLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ formatString: "\\\"{}\\\""
+ example: "\"editgroup_id_example\".to_string()"
+ - in: "body"
+ name: "annotation"
+ required: true
+ schema:
+ $ref: "#/definitions/editgroup_annotation"
+ uppercase_data_type: "EDITGROUPANNOTATION"
+ refName: "editgroup_annotation"
+ formatString: "{:?}"
+ example: "???"
+ model_key: "editgroup_edits"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ consumesJson: true
+ responses:
+ 201:
+ description: "Created"
+ schema:
+ $ref: "#/definitions/editgroup_annotation"
+ x-responseId: "Created"
+ x-uppercaseResponseId: "CREATED"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ uppercase_data_type: "EDITGROUPANNOTATION"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 401:
+ description: "Not Authorized"
+ schema:
+ $ref: "#/definitions/error_response"
+ headers:
+ WWW_Authenticate:
+ type: "string"
+ x-responseId: "NotAuthorized"
+ x-uppercaseResponseId: "NOT_AUTHORIZED"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ 403:
+ description: "Forbidden"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "Forbidden"
+ x-uppercaseResponseId: "FORBIDDEN"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ 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_EDITGROUP_ANNOTATION"
+ 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_EDITGROUP_ANNOTATION"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ security:
+ - Bearer: []
+ operation_id: "create_editgroup_annotation"
+ uppercase_operation_id: "CREATE_EDITGROUP_ANNOTATION"
+ path: "/editgroup/:editgroup_id/annotation"
+ HttpMethod: "Post"
+ httpmethod: "post"
+ noClientExample: true
+ /editgroup/reviewable:
+ get:
+ operationId: "get_editgroups_reviewable"
+ parameters:
+ - name: "expand"
+ in: "query"
+ description: "List of sub-entities to expand in response. For editgroups:\
+ \ 'editors'"
+ required: false
+ type: "string"
+ formatString: "{:?}"
+ example: "Some(\"expand_example\".to_string())"
+ - name: "limit"
+ in: "query"
+ required: false
+ type: "integer"
+ format: "int64"
+ formatString: "{:?}"
+ example: "Some(789)"
+ - name: "before"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
+ - name: "since"
+ in: "query"
+ required: false
+ type: "string"
+ format: "date-time"
+ formatString: "{:?}"
+ example: "None"
+ responses:
+ 200:
+ description: "Found"
+ schema:
+ type: "array"
+ items:
+ $ref: "#/definitions/editgroup"
+ x-responseId: "Found"
+ x-uppercaseResponseId: "FOUND"
+ uppercase_operation_id: "GET_EDITGROUPS_REVIEWABLE"
+ uppercase_data_type: "VEC<EDITGROUP>"
+ producesJson: true
+ 400:
+ description: "Bad Request"
+ schema:
+ $ref: "#/definitions/error_response"
+ x-responseId: "BadRequest"
+ x-uppercaseResponseId: "BAD_REQUEST"
+ uppercase_operation_id: "GET_EDITGROUPS_REVIEWABLE"
+ 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_EDITGROUPS_REVIEWABLE"
+ 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_EDITGROUPS_REVIEWABLE"
+ uppercase_data_type: "ERRORRESPONSE"
+ producesJson: true
+ operation_id: "get_editgroups_reviewable"
+ uppercase_operation_id: "GET_EDITGROUPS_REVIEWABLE"
+ path: "/editgroup/reviewable"
+ HttpMethod: "Get"
+ httpmethod: "get"
/changelog:
get:
tags:
@@ -7614,6 +8096,7 @@ definitions:
$ref: "#/definitions/changelog_entry"
example:
editgroup:
+ submitted: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -7723,6 +8206,19 @@ definitions:
revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
description: "description"
+ annotations:
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
edit:
ident: "q3nouwy3nnbsvo3h5klxsx4a7y"
@@ -7734,6 +8230,7 @@ definitions:
revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
changelog_entry:
editgroup:
+ submitted: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -7843,6 +8340,19 @@ definitions:
revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
description: "description"
+ annotations:
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
index: 0
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
@@ -7953,13 +8463,21 @@ definitions:
minLength: 26
maxLength: 26
pattern: "[a-zA-Z2-7]{26}"
+ submitted:
+ type: "string"
+ format: "date-time"
description:
type: "string"
extra:
type: "object"
+ annotations:
+ type: "array"
+ items:
+ $ref: "#/definitions/editgroup_annotation"
edits:
$ref: "#/definitions/editgroup_edits"
example:
+ submitted: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -8069,8 +8587,60 @@ definitions:
revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
description: "description"
+ annotations:
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
upperCaseName: "EDITGROUP"
+ editgroup_annotation:
+ type: "object"
+ properties:
+ annotation_id:
+ 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}"
+ editgroup_id:
+ type: "string"
+ example: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ description: "base32-encoded unique identifier"
+ minLength: 26
+ maxLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ editor_id:
+ type: "string"
+ example: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ description: "base32-encoded unique identifier"
+ minLength: 26
+ maxLength: 26
+ pattern: "[a-zA-Z2-7]{26}"
+ created:
+ type: "string"
+ format: "date-time"
+ comment_markdown:
+ type: "string"
+ extra:
+ type: "object"
+ example:
+ annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
+ upperCaseName: "EDITGROUP_ANNOTATION"
changelog_entry:
type: "object"
required:
@@ -8091,6 +8661,7 @@ definitions:
$ref: "#/definitions/editgroup"
example:
editgroup:
+ submitted: "2000-01-23T04:56:07.000+00:00"
extra: "{}"
edits:
works:
@@ -8200,6 +8771,19 @@ definitions:
revision: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
description: "description"
+ annotations:
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
+ - annotation_id: "86daea5b-1b6b-432a-bb67-ea97795f80fe"
+ created: "2000-01-23T04:56:07.000+00:00"
+ extra: "{}"
+ editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
+ comment_markdown: "comment_markdown"
editor_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
index: 0
editgroup_id: "q3nouwy3nnbsvo3h5klxsx4a7y"
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs
index f5f336b0..b4d90719 100644
--- a/rust/fatcat-api-spec/examples/client.rs
+++ b/rust/fatcat-api-spec/examples/client.rs
@@ -13,18 +13,18 @@ use clap::{App, Arg};
#[allow(unused_imports)]
use fatcat::{
AcceptEditgroupResponse, ApiError, ApiNoContext, AuthCheckResponse, AuthOidcResponse, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse,
- CreateCreatorResponse, 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, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse,
- UpdateWorkResponse,
+ CreateCreatorResponse, CreateEditgroupAnnotationResponse, 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, GetEditgroupAnnotationsResponse, GetEditgroupResponse, GetEditgroupsReviewableResponse,
+ GetEditorAnnotationsResponse, GetEditorEditgroupsResponse, 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, UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
#[allow(unused_imports)]
use futures::{future, stream, Future, Stream};
@@ -55,12 +55,15 @@ fn main() {
"GetCreatorRevision",
"LookupCreator",
"AuthCheck",
+ "GetEditgroupsReviewable",
"GetEditor",
- "GetEditorChangelog",
+ "GetEditorEditgroups",
"AcceptEditgroup",
"GetChangelog",
"GetChangelogEntry",
"GetEditgroup",
+ "GetEditgroupAnnotations",
+ "GetEditorAnnotations",
"CreateFileBatch",
"DeleteFile",
"DeleteFileEdit",
@@ -283,17 +286,28 @@ fn main() {
// let result = client.auth_oidc(???).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
+ Some("GetEditgroupsReviewable") => {
+ let result = client.get_editgroups_reviewable(Some("expand_example".to_string()), Some(789), None, None).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
Some("GetEditor") => {
let result = client.get_editor("editor_id_example".to_string()).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
- Some("GetEditorChangelog") => {
- let result = client.get_editor_changelog("editor_id_example".to_string()).wait();
+ Some("GetEditorEditgroups") => {
+ let result = client.get_editor_editgroups("editor_id_example".to_string(), Some(789), None, None).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
// Disabled because there's no example.
+ // Some("UpdateEditgroup") => {
+ // let result = client.update_editgroup("editgroup_id_example".to_string(), ???, Some(true)).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
+
+ // Disabled because there's no example.
// Some("UpdateEditor") => {
// let result = client.update_editor("editor_id_example".to_string(), ???).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
@@ -308,6 +322,12 @@ fn main() {
// let result = client.create_editgroup(???).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
+
+ // Disabled because there's no example.
+ // Some("CreateEditgroupAnnotation") => {
+ // let result = client.create_editgroup_annotation("editgroup_id_example".to_string(), ???).wait();
+ // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ // },
Some("GetChangelog") => {
let result = client.get_changelog(Some(789)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
@@ -323,6 +343,16 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("GetEditgroupAnnotations") => {
+ let result = client.get_editgroup_annotations("editgroup_id_example".to_string(), Some("expand_example".to_string())).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
+ Some("GetEditorAnnotations") => {
+ let result = client.get_editor_annotations("editor_id_example".to_string(), Some(789), None, None).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
// Disabled because there's no example.
// Some("CreateFile") => {
// let result = client.create_file(???, "editgroup_id_example".to_string()).wait();
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs
index febd61de..3c37106a 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-api-spec/examples/server_lib/server.rs
@@ -12,18 +12,18 @@ use swagger;
use fatcat::models;
use fatcat::{
AcceptEditgroupResponse, Api, ApiError, AuthCheckResponse, AuthOidcResponse, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse,
- CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse,
- CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse,
- DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse,
+ CreateEditgroupAnnotationResponse, 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, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse,
- UpdateWorkResponse,
+ GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, GetEditgroupResponse, GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse,
+ GetEditorEditgroupsResponse, 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,
+ UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
#[derive(Copy, Clone)]
@@ -303,15 +303,61 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_editgroups_reviewable(
+ &self,
+ expand: Option<String>,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_editgroups_reviewable({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ expand,
+ limit,
+ before,
+ since,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_editor(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!("get_editor(\"{}\") - X-Span-ID: {:?}", editor_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor_changelog(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ fn get_editor_editgroups(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", editor_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "get_editor_editgroups(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ editor_id,
+ limit,
+ before,
+ since,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn update_editgroup(&self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>, context: &Context) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "update_editgroup(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ editgroup,
+ submit,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -338,6 +384,22 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn create_editgroup_annotation(
+ &self,
+ editgroup_id: String,
+ annotation: models::EditgroupAnnotation,
+ context: &Context,
+ ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "create_editgroup_annotation(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ annotation,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
let context = context.clone();
println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone());
@@ -356,6 +418,37 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_editgroup_annotations(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ expand,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_editor_annotations(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_editor_annotations(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ editor_id,
+ limit,
+ before,
+ since,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index c5cf4297..a3e97fb3 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -36,18 +36,18 @@ use swagger::{ApiError, Context, XSpanId};
use models;
use {
AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse,
- CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse,
- CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse,
- DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse,
+ CreateEditgroupAnnotationResponse, 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, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse,
- UpdateWorkResponse,
+ GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, GetEditgroupResponse, GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse,
+ GetEditorEditgroupsResponse, 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,
+ UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
/// Convert input into a base path, e.g. "http://example:123". Also checks the scheme as it goes.
@@ -2203,6 +2203,86 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_editgroups_reviewable(
+ &self,
+ param_expand: Option<String>,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
+
+ let url = format!(
+ "{}/v0/editgroup/reviewable?{expand}{limit}{before}{since}",
+ self.base_path,
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, 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<GetEditgroupsReviewableResponse, 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::Editgroup>>(&buf)?;
+
+ Ok(GetEditgroupsReviewableResponse::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(GetEditgroupsReviewableResponse::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(GetEditgroupsReviewableResponse::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(GetEditgroupsReviewableResponse::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_editor(&self, param_editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
let url = format!(
"{}/v0/editor/{editor_id}",
@@ -2267,11 +2347,26 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn get_editor_changelog(&self, param_editor_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
+ fn get_editor_editgroups(
+ &self,
+ param_editor_id: String,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
+
let url = format!(
- "{}/v0/editor/{editor_id}/changelog",
+ "{}/v0/editor/{editor_id}/editgroups?{limit}{before}{since}",
self.base_path,
- editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, QUERY_ENCODE_SET)
);
let hyper_client = (self.hyper_client)();
@@ -2283,35 +2378,136 @@ impl Api for Client {
let request = request.headers(custom_headers);
// Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
- fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorChangelogResponse, ApiError> {
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<GetEditorEditgroupsResponse, ApiError> {
match response.status.to_u16() {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<Vec<models::ChangelogEntry>>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::Editgroup>>(&buf)?;
+
+ Ok(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::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(GetEditorEditgroupsResponse::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_editgroup(
+ &self,
+ param_editgroup_id: String,
+ param_editgroup: models::Editgroup,
+ param_submit: Option<bool>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_submit = param_submit.map_or_else(String::new, |query| format!("submit={submit}&", submit = query.to_string()));
+
+ let url = format!(
+ "{}/v0/editgroup/{editgroup_id}?{submit}",
+ self.base_path,
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ submit = utf8_percent_encode(&query_submit, QUERY_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_editgroup).expect("impossible to fail to serialize");
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Put, &url);
+ let mut custom_headers = hyper::header::Headers::new();
+
+ let request = request.body(&body);
- Ok(GetEditorChangelogResponse::Found(body))
+ custom_headers.set(ContentType(mimetypes::requests::UPDATE_EDITGROUP.clone()));
+ context.x_span_id.as_ref().map(|header| custom_headers.set(XSpanId(header.clone())));
+
+ let request = request.headers(custom_headers);
+
+ // Helper function to provide a code block to use `?` in (to be replaced by the `catch` block when it exists).
+ fn parse_response(mut response: hyper::client::response::Response) -> Result<UpdateEditgroupResponse, 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::Editgroup>(&buf)?;
+
+ Ok(UpdateEditgroupResponse::UpdatedEditgroup(body))
}
400 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(GetEditorChangelogResponse::BadRequest(body))
+ Ok(UpdateEditgroupResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(UpdateEditgroupResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(UpdateEditgroupResponse::Forbidden(body))
}
404 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(GetEditorChangelogResponse::NotFound(body))
+ Ok(UpdateEditgroupResponse::NotFound(body))
}
500 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
- Ok(GetEditorChangelogResponse::GenericError(body))
+ Ok(UpdateEditgroupResponse::GenericError(body))
}
code => {
let mut buf = [0; 100];
@@ -2602,6 +2798,102 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn create_editgroup_annotation(
+ &self,
+ param_editgroup_id: String,
+ param_annotation: models::EditgroupAnnotation,
+ context: &Context,
+ ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
+ let url = format!(
+ "{}/v0/editgroup/{editgroup_id}/annotation",
+ self.base_path,
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET)
+ );
+
+ let body = serde_json::to_string(&param_annotation).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_EDITGROUP_ANNOTATION.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<CreateEditgroupAnnotationResponse, 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::EditgroupAnnotation>(&buf)?;
+
+ Ok(CreateEditgroupAnnotationResponse::Created(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(CreateEditgroupAnnotationResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(CreateEditgroupAnnotationResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(CreateEditgroupAnnotationResponse::Forbidden(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(CreateEditgroupAnnotationResponse::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(CreateEditgroupAnnotationResponse::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_changelog(&self, param_limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
// Query parameters
let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
@@ -2786,6 +3078,197 @@ impl Api for Client {
Box::new(futures::done(result))
}
+ fn get_editgroup_annotations(&self, param_editgroup_id: String, param_expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_expand = param_expand.map_or_else(String::new, |query| format!("expand={expand}&", expand = query.to_string()));
+
+ let url = format!(
+ "{}/v0/editgroup/{editgroup_id}/annotations?{expand}",
+ self.base_path,
+ editgroup_id = utf8_percent_encode(&param_editgroup_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ expand = utf8_percent_encode(&query_expand, QUERY_ENCODE_SET)
+ );
+
+ let hyper_client = (self.hyper_client)();
+ let request = hyper_client.request(hyper::method::Method::Get, &url);
+ 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<GetEditgroupAnnotationsResponse, 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::EditgroupAnnotation>>(&buf)?;
+
+ Ok(GetEditgroupAnnotationsResponse::Success(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(GetEditgroupAnnotationsResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(GetEditgroupAnnotationsResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetEditgroupAnnotationsResponse::Forbidden(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(GetEditgroupAnnotationsResponse::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(GetEditgroupAnnotationsResponse::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_editor_annotations(
+ &self,
+ param_editor_id: String,
+ param_limit: Option<i64>,
+ param_before: Option<chrono::DateTime<chrono::Utc>>,
+ param_since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_limit = param_limit.map_or_else(String::new, |query| format!("limit={limit}&", limit = query.to_string()));
+ let query_before = param_before.map_or_else(String::new, |query| format!("before={before}&", before = query.to_string()));
+ let query_since = param_since.map_or_else(String::new, |query| format!("since={since}&", since = query.to_string()));
+
+ let url = format!(
+ "{}/v0/editor/{editor_id}/annotations?{limit}{before}{since}",
+ self.base_path,
+ editor_id = utf8_percent_encode(&param_editor_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ limit = utf8_percent_encode(&query_limit, QUERY_ENCODE_SET),
+ before = utf8_percent_encode(&query_before, QUERY_ENCODE_SET),
+ since = utf8_percent_encode(&query_since, 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<GetEditorAnnotationsResponse, 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::EditgroupAnnotation>>(&buf)?;
+
+ Ok(GetEditorAnnotationsResponse::Success(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(GetEditorAnnotationsResponse::BadRequest(body))
+ }
+ 401 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ let response_www_authenticate = response
+ .headers
+ .get::<ResponseWwwAuthenticate>()
+ .ok_or_else(|| "Required response header WWW_Authenticate for response 401 was not found.")?;
+
+ Ok(GetEditorAnnotationsResponse::NotAuthorized {
+ body: body,
+ www_authenticate: response_www_authenticate.0.clone(),
+ })
+ }
+ 403 => {
+ let mut buf = String::new();
+ response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
+ let body = serde_json::from_str::<models::ErrorResponse>(&buf)?;
+
+ Ok(GetEditorAnnotationsResponse::Forbidden(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(GetEditorAnnotationsResponse::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(GetEditorAnnotationsResponse::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_file(&self, param_entity: models::FileEntity, param_editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
// Query parameters
let query_editgroup_id = format!("editgroup_id={editgroup_id}&", editgroup_id = param_editgroup_id.to_string());
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs
index 3f1afa67..9585f1c0 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -381,6 +381,18 @@ pub enum AuthOidcResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetEditgroupsReviewableResponse {
+ /// Found
+ Found(Vec<models::Editgroup>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetEditorResponse {
/// Found
Found(models::Editor),
@@ -393,11 +405,27 @@ pub enum GetEditorResponse {
}
#[derive(Debug, PartialEq)]
-pub enum GetEditorChangelogResponse {
+pub enum GetEditorEditgroupsResponse {
/// Found
- Found(Vec<models::ChangelogEntry>),
+ Found(Vec<models::Editgroup>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
+pub enum UpdateEditgroupResponse {
+ /// Updated Editgroup
+ UpdatedEditgroup(models::Editgroup),
/// Bad Request
BadRequest(models::ErrorResponse),
+ /// Not Authorized
+ NotAuthorized { body: models::ErrorResponse, www_authenticate: String },
+ /// Forbidden
+ Forbidden(models::ErrorResponse),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
@@ -455,6 +483,22 @@ pub enum CreateEditgroupResponse {
}
#[derive(Debug, PartialEq)]
+pub enum CreateEditgroupAnnotationResponse {
+ /// Created
+ Created(models::EditgroupAnnotation),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Authorized
+ NotAuthorized { body: models::ErrorResponse, www_authenticate: String },
+ /// Forbidden
+ Forbidden(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetChangelogResponse {
/// Success
Success(Vec<models::ChangelogEntry>),
@@ -489,6 +533,38 @@ pub enum GetEditgroupResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetEditgroupAnnotationsResponse {
+ /// Success
+ Success(Vec<models::EditgroupAnnotation>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Authorized
+ NotAuthorized { body: models::ErrorResponse, www_authenticate: String },
+ /// Forbidden
+ Forbidden(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
+pub enum GetEditorAnnotationsResponse {
+ /// Success
+ Success(Vec<models::EditgroupAnnotation>),
+ /// Bad Request
+ BadRequest(models::ErrorResponse),
+ /// Not Authorized
+ NotAuthorized { body: models::ErrorResponse, www_authenticate: String },
+ /// Forbidden
+ Forbidden(models::ErrorResponse),
+ /// Not Found
+ NotFound(models::ErrorResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum CreateFileResponse {
/// Created Entity
CreatedEntity(models::EntityEdit),
@@ -1338,9 +1414,27 @@ pub trait Api {
fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send>;
+ fn get_editgroups_reviewable(
+ &self,
+ expand: Option<String>,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send>;
+
fn get_editor(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn get_editor_changelog(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
+ fn get_editor_editgroups(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send>;
+
+ fn update_editgroup(&self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>, context: &Context) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send>;
fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send>;
@@ -1348,12 +1442,30 @@ pub trait Api {
fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
+ fn create_editgroup_annotation(
+ &self,
+ editgroup_id: String,
+ annotation: models::EditgroupAnnotation,
+ context: &Context,
+ ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send>;
+
fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send>;
fn get_changelog_entry(&self, index: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>;
fn get_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
+ fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send>;
+
+ fn get_editor_annotations(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ context: &Context,
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send>;
+
fn create_file(&self, entity: models::FileEntity, editgroup_id: String, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
fn create_file_batch(
@@ -1584,9 +1696,25 @@ pub trait ApiNoContext {
fn auth_oidc(&self, oidc_params: models::AuthOidc) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send>;
+ fn get_editgroups_reviewable(
+ &self,
+ expand: Option<String>,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send>;
+
fn get_editor(&self, editor_id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>;
- fn get_editor_changelog(&self, editor_id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send>;
+ fn get_editor_editgroups(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send>;
+
+ fn update_editgroup(&self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send>;
fn update_editor(&self, editor_id: String, editor: models::Editor) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send>;
@@ -1594,12 +1722,24 @@ pub trait ApiNoContext {
fn create_editgroup(&self, editgroup: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
+ fn create_editgroup_annotation(&self, editgroup_id: String, annotation: models::EditgroupAnnotation) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send>;
+
fn get_changelog(&self, limit: Option<i64>) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send>;
fn get_changelog_entry(&self, index: i64) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>;
fn get_editgroup(&self, editgroup_id: String) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>;
+ fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send>;
+
+ fn get_editor_annotations(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send>;
+
fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup_id: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
@@ -1877,12 +2017,32 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().auth_oidc(oidc_params, &self.context())
}
+ fn get_editgroups_reviewable(
+ &self,
+ expand: Option<String>,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> {
+ self.api().get_editgroups_reviewable(expand, limit, before, since, &self.context())
+ }
+
fn get_editor(&self, editor_id: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
self.api().get_editor(editor_id, &self.context())
}
- fn get_editor_changelog(&self, editor_id: String) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> {
- self.api().get_editor_changelog(editor_id, &self.context())
+ fn get_editor_editgroups(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> {
+ self.api().get_editor_editgroups(editor_id, limit, before, since, &self.context())
+ }
+
+ fn update_editgroup(&self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>) -> Box<Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> {
+ self.api().update_editgroup(editgroup_id, editgroup, submit, &self.context())
}
fn update_editor(&self, editor_id: String, editor: models::Editor) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
@@ -1897,6 +2057,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().create_editgroup(editgroup, &self.context())
}
+ fn create_editgroup_annotation(&self, editgroup_id: String, annotation: models::EditgroupAnnotation) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
+ self.api().create_editgroup_annotation(editgroup_id, annotation, &self.context())
+ }
+
fn get_changelog(&self, limit: Option<i64>) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
self.api().get_changelog(limit, &self.context())
}
@@ -1909,6 +2073,20 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().get_editgroup(editgroup_id, &self.context())
}
+ fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
+ self.api().get_editgroup_annotations(editgroup_id, expand, &self.context())
+ }
+
+ fn get_editor_annotations(
+ &self,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> {
+ self.api().get_editor_annotations(editor_id, limit, before, since, &self.context())
+ }
+
fn create_file(&self, entity: models::FileEntity, editgroup_id: String) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
self.api().create_file(entity, editgroup_id, &self.context())
}
diff --git a/rust/fatcat-api-spec/src/mimetypes.rs b/rust/fatcat-api-spec/src/mimetypes.rs
index 11159610..5c916e47 100644
--- a/rust/fatcat-api-spec/src/mimetypes.rs
+++ b/rust/fatcat-api-spec/src/mimetypes.rs
@@ -500,6 +500,22 @@ pub mod responses {
lazy_static! {
pub static ref AUTH_OIDC_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetEditgroupsReviewable
+ lazy_static! {
+ pub static ref GET_EDITGROUPS_REVIEWABLE_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupsReviewable
+ lazy_static! {
+ pub static ref GET_EDITGROUPS_REVIEWABLE_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupsReviewable
+ lazy_static! {
+ pub static ref GET_EDITGROUPS_REVIEWABLE_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupsReviewable
+ lazy_static! {
+ pub static ref GET_EDITGROUPS_REVIEWABLE_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetEditor
lazy_static! {
pub static ref GET_EDITOR_FOUND: Mime = mime!(Application / Json);
@@ -516,21 +532,45 @@ pub mod responses {
lazy_static! {
pub static ref GET_EDITOR_GENERIC_ERROR: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for GetEditorEditgroups
+ lazy_static! {
+ pub static ref GET_EDITOR_EDITGROUPS_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorEditgroups
+ lazy_static! {
+ pub static ref GET_EDITOR_EDITGROUPS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorEditgroups
+ lazy_static! {
+ pub static ref GET_EDITOR_EDITGROUPS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorEditgroups
+ lazy_static! {
+ pub static ref GET_EDITOR_EDITGROUPS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for UpdateEditgroup
+ lazy_static! {
+ pub static ref UPDATE_EDITGROUP_UPDATED_EDITGROUP: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for UpdateEditgroup
+ lazy_static! {
+ pub static ref UPDATE_EDITGROUP_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for UpdateEditgroup
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_EDITGROUP_NOT_AUTHORIZED: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for UpdateEditgroup
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_BAD_REQUEST: Mime = mime!(Application / Json);
+ pub static ref UPDATE_EDITGROUP_FORBIDDEN: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for UpdateEditgroup
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_NOT_FOUND: Mime = mime!(Application / Json);
+ pub static ref UPDATE_EDITGROUP_NOT_FOUND: Mime = mime!(Application / Json);
}
- /// Create Mime objects for the response content types for GetEditorChangelog
+ /// Create Mime objects for the response content types for UpdateEditgroup
lazy_static! {
- pub static ref GET_EDITOR_CHANGELOG_GENERIC_ERROR: Mime = mime!(Application / Json);
+ pub static ref UPDATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
/// Create Mime objects for the response content types for UpdateEditor
lazy_static! {
@@ -608,6 +648,30 @@ pub mod responses {
lazy_static! {
pub static ref CREATE_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_CREATED: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_NOT_AUTHORIZED: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_FORBIDDEN: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for GetChangelog
lazy_static! {
pub static ref GET_CHANGELOG_SUCCESS: Mime = mime!(Application / Json);
@@ -652,6 +716,54 @@ pub mod responses {
lazy_static! {
pub static ref GET_EDITGROUP_GENERIC_ERROR: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_SUCCESS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_NOT_AUTHORIZED: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_FORBIDDEN: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditgroupAnnotations
+ lazy_static! {
+ pub static ref GET_EDITGROUP_ANNOTATIONS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_SUCCESS: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_BAD_REQUEST: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_NOT_AUTHORIZED: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_FORBIDDEN: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_NOT_FOUND: Mime = mime!(Application / Json);
+ }
+ /// Create Mime objects for the response content types for GetEditorAnnotations
+ lazy_static! {
+ pub static ref GET_EDITOR_ANNOTATIONS_GENERIC_ERROR: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the response content types for CreateFile
lazy_static! {
pub static ref CREATE_FILE_CREATED_ENTITY: Mime = mime!(Application / Json);
@@ -1781,6 +1893,10 @@ pub mod requests {
lazy_static! {
pub static ref AUTH_OIDC: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for UpdateEditgroup
+ lazy_static! {
+ pub static ref UPDATE_EDITGROUP: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for UpdateEditor
lazy_static! {
pub static ref UPDATE_EDITOR: Mime = mime!(Application / Json);
@@ -1789,6 +1905,10 @@ pub mod requests {
lazy_static! {
pub static ref CREATE_EDITGROUP: Mime = mime!(Application / Json);
}
+ /// Create Mime objects for the request content types for CreateEditgroupAnnotation
+ lazy_static! {
+ pub static ref CREATE_EDITGROUP_ANNOTATION: Mime = mime!(Application / Json);
+ }
/// Create Mime objects for the request content types for CreateFile
lazy_static! {
pub static ref CREATE_FILE: Mime = mime!(Application / Json);
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index a5c588a0..d07aa320 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -234,6 +234,10 @@ pub struct Editgroup {
#[serde(skip_serializing_if = "Option::is_none")]
pub editor_id: Option<String>,
+ #[serde(rename = "submitted")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub submitted: Option<chrono::DateTime<chrono::Utc>>,
+
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
@@ -242,6 +246,10 @@ pub struct Editgroup {
#[serde(skip_serializing_if = "Option::is_none")]
pub extra: Option<serde_json::Value>,
+ #[serde(rename = "annotations")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub annotations: Option<Vec<models::EditgroupAnnotation>>,
+
#[serde(rename = "edits")]
#[serde(skip_serializing_if = "Option::is_none")]
pub edits: Option<models::EditgroupEdits>,
@@ -252,14 +260,59 @@ impl Editgroup {
Editgroup {
editgroup_id: None,
editor_id: None,
+ submitted: None,
description: None,
extra: None,
+ annotations: None,
edits: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct EditgroupAnnotation {
+ /// UUID (lower-case, dash-separated, hex-encoded 128-bit)
+ #[serde(rename = "annotation_id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub annotation_id: Option<String>,
+
+ /// base32-encoded unique identifier
+ #[serde(rename = "editgroup_id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub editgroup_id: Option<String>,
+
+ /// base32-encoded unique identifier
+ #[serde(rename = "editor_id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub editor_id: Option<String>,
+
+ #[serde(rename = "created")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub created: Option<chrono::DateTime<chrono::Utc>>,
+
+ #[serde(rename = "comment_markdown")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub comment_markdown: Option<String>,
+
+ #[serde(rename = "extra")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub extra: Option<serde_json::Value>,
+}
+
+impl EditgroupAnnotation {
+ pub fn new() -> EditgroupAnnotation {
+ EditgroupAnnotation {
+ annotation_id: None,
+ editgroup_id: None,
+ editor_id: None,
+ created: None,
+ comment_markdown: None,
+ extra: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EditgroupEdits {
#[serde(rename = "containers")]
#[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 03875a38..8b616959 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -38,18 +38,18 @@ use swagger::{ApiError, Context, XSpanId};
use models;
use {
AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse,
- CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateFilesetBatchResponse, CreateFilesetResponse, CreateReleaseBatchResponse, CreateReleaseResponse,
- CreateWebcaptureBatchResponse, CreateWebcaptureResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse,
- DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse,
+ CreateEditgroupAnnotationResponse, 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, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse,
- UpdateWorkResponse,
+ GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, GetEditgroupResponse, GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse,
+ GetEditorEditgroupsResponse, 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,
+ UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
header! { (Warning, "Warning") => [String] }
@@ -2885,6 +2885,87 @@ where
let api_clone = api.clone();
router.get(
+ "/v0/editgroup/reviewable",
+ 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_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+ let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_before = query_params.get("before").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+ let param_since = query_params.get("since").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+
+ match api.get_editgroups_reviewable(param_expand, param_limit, param_before, param_since, context).wait() {
+ Ok(rsp) => match rsp {
+ GetEditgroupsReviewableResponse::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_EDITGROUPS_REVIEWABLE_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupsReviewableResponse::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_EDITGROUPS_REVIEWABLE_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupsReviewableResponse::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_EDITGROUPS_REVIEWABLE_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupsReviewableResponse::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_EDITGROUPS_REVIEWABLE_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)
+ })
+ },
+ "GetEditgroupsReviewable",
+ );
+
+ let api_clone = api.clone();
+ router.get(
"/v0/editor/:editor_id",
move |req: &mut Request| {
let mut context = Context::default();
@@ -2974,7 +3055,7 @@ where
let api_clone = api.clone();
router.get(
- "/v0/editor/:editor_id/changelog",
+ "/v0/editor/:editor_id/editgroups",
move |req: &mut Request| {
let mut context = Context::default();
@@ -3002,46 +3083,207 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter editor_id: {}", e))))?
};
- match api.get_editor_changelog(param_editor_id, context).wait() {
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_before = query_params.get("before").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+ let param_since = query_params.get("since").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+
+ match api.get_editor_editgroups(param_editor_id, param_limit, param_before, param_since, context).wait() {
Ok(rsp) => match rsp {
- GetEditorChangelogResponse::Found(body) => {
+ GetEditorEditgroupsResponse::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_EDITOR_CHANGELOG_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_EDITGROUPS_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::BadRequest(body) => {
+ GetEditorEditgroupsResponse::BadRequest(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(400), body_string));
- response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_BAD_REQUEST.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_EDITGROUPS_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::NotFound(body) => {
+ GetEditorEditgroupsResponse::NotFound(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(404), body_string));
- response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_NOT_FOUND.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_EDITGROUPS_NOT_FOUND.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
Ok(response)
}
- GetEditorChangelogResponse::GenericError(body) => {
+ GetEditorEditgroupsResponse::GenericError(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(500), body_string));
- response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_CHANGELOG_GENERIC_ERROR.clone()));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_EDITGROUPS_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)
+ })
+ },
+ "GetEditorEditgroups",
+ );
+
+ let api_clone = api.clone();
+ router.put(
+ "/v0/editgroup/:editgroup_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>();
+
+ let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?;
+
+ // Path parameters
+ let param_editgroup_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("editgroup_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_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 editgroup_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_submit = query_params.get("submit").and_then(|list| list.first()).and_then(|x| x.parse::<bool>().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_editgroup = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_editgroup = if let Some(param_editgroup_raw) = param_editgroup {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_editgroup_raw);
+
+ let param_editgroup: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ })
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter editgroup - doesn't match schema: {}", e))))?;
+
+ param_editgroup
+ } else {
+ None
+ };
+ let param_editgroup = param_editgroup.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter editgroup".to_string())))?;
+
+ match api.update_editgroup(param_editgroup_id, param_editgroup, param_submit, context).wait() {
+ Ok(rsp) => match rsp {
+ UpdateEditgroupResponse::UpdatedEditgroup(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_EDITGROUP_UPDATED_EDITGROUP.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)
+ }
+ UpdateEditgroupResponse::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_EDITGROUP_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ UpdateEditgroupResponse::NotAuthorized { body, www_authenticate } => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(401), body_string));
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ response.headers.set(ResponseWwwAuthenticate(www_authenticate));
+
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITGROUP_NOT_AUTHORIZED.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)
+ }
+ UpdateEditgroupResponse::Forbidden(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(403), body_string));
+ response.headers.set(ContentType(mimetypes::responses::UPDATE_EDITGROUP_FORBIDDEN.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)
+ }
+ UpdateEditgroupResponse::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_EDITGROUP_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ UpdateEditgroupResponse::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_EDITGROUP_GENERIC_ERROR.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
Ok(response)
}
},
@@ -3058,7 +3300,7 @@ where
Ok(response)
})
},
- "GetEditorChangelog",
+ "UpdateEditgroup",
);
let api_clone = api.clone();
@@ -3473,6 +3715,157 @@ where
);
let api_clone = api.clone();
+ router.post(
+ "/v0/editgroup/:editgroup_id/annotation",
+ 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>();
+
+ let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?;
+
+ // Path parameters
+ let param_editgroup_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("editgroup_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_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 editgroup_id: {}", e))))?
+ };
+
+ // Body parameters (note that non-required body parameters will ignore garbage
+ // values, rather than causing a 400 response). Produce warning header and logs for
+ // any unused fields.
+
+ let param_annotation = req
+ .get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter annotation - not valid UTF-8: {}", e))))?;
+
+ let mut unused_elements = Vec::new();
+
+ let param_annotation = if let Some(param_annotation_raw) = param_annotation {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_annotation_raw);
+
+ let param_annotation: Option<models::EditgroupAnnotation> = 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 annotation - doesn't match schema: {}", e))))?;
+
+ param_annotation
+ } else {
+ None
+ };
+ let param_annotation = param_annotation.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter annotation".to_string())))?;
+
+ match api.create_editgroup_annotation(param_editgroup_id, param_annotation, context).wait() {
+ Ok(rsp) => match rsp {
+ CreateEditgroupAnnotationResponse::Created(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(201), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_ANNOTATION_CREATED.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+ if !unused_elements.is_empty() {
+ response.headers.set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
+ }
+ Ok(response)
+ }
+ CreateEditgroupAnnotationResponse::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_EDITGROUP_ANNOTATION_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)
+ }
+ CreateEditgroupAnnotationResponse::NotAuthorized { body, www_authenticate } => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(401), body_string));
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ response.headers.set(ResponseWwwAuthenticate(www_authenticate));
+
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_ANNOTATION_NOT_AUTHORIZED.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)
+ }
+ CreateEditgroupAnnotationResponse::Forbidden(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(403), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_ANNOTATION_FORBIDDEN.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)
+ }
+ CreateEditgroupAnnotationResponse::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_EDITGROUP_ANNOTATION_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)
+ }
+ CreateEditgroupAnnotationResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::CREATE_EDITGROUP_ANNOTATION_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)
+ })
+ },
+ "CreateEditgroupAnnotation",
+ );
+
+ let api_clone = api.clone();
router.get(
"/v0/changelog",
move |req: &mut Request| {
@@ -3719,6 +4112,242 @@ where
);
let api_clone = api.clone();
+ router.get(
+ "/v0/editgroup/:editgroup_id/annotations",
+ 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>();
+
+ let authorization = context.authorization.as_ref().ok_or_else(|| Response::with((status::Forbidden, "Unauthenticated".to_string())))?;
+
+ // Path parameters
+ let param_editgroup_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("editgroup_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editgroup_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 editgroup_id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_expand = query_params.get("expand").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
+ match api.get_editgroup_annotations(param_editgroup_id, param_expand, context).wait() {
+ Ok(rsp) => match rsp {
+ GetEditgroupAnnotationsResponse::Success(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_SUCCESS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupAnnotationsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupAnnotationsResponse::NotAuthorized { body, www_authenticate } => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(401), body_string));
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ response.headers.set(ResponseWwwAuthenticate(www_authenticate));
+
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_NOT_AUTHORIZED.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupAnnotationsResponse::Forbidden(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(403), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_FORBIDDEN.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupAnnotationsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditgroupAnnotationsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITGROUP_ANNOTATIONS_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)
+ })
+ },
+ "GetEditgroupAnnotations",
+ );
+
+ let api_clone = api.clone();
+ router.get(
+ "/v0/editor/:editor_id/annotations",
+ 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_editor_id = {
+ let param = req
+ .extensions
+ .get::<Router>()
+ .ok_or_else(|| Response::with((status::InternalServerError, "An internal error occurred".to_string())))?
+ .find("editor_id")
+ .ok_or_else(|| Response::with((status::BadRequest, "Missing path parameter editor_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 editor_id: {}", e))))?
+ };
+
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_limit = query_params.get("limit").and_then(|list| list.first()).and_then(|x| x.parse::<i64>().ok());
+ let param_before = query_params.get("before").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+ let param_since = query_params.get("since").and_then(|list| list.first()).and_then(|x| x.parse::<chrono::DateTime<chrono::Utc>>().ok());
+
+ match api.get_editor_annotations(param_editor_id, param_limit, param_before, param_since, context).wait() {
+ Ok(rsp) => match rsp {
+ GetEditorAnnotationsResponse::Success(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(200), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_SUCCESS.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorAnnotationsResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_BAD_REQUEST.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorAnnotationsResponse::NotAuthorized { body, www_authenticate } => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(401), body_string));
+ header! { (ResponseWwwAuthenticate, "WWW_Authenticate") => [String] }
+ response.headers.set(ResponseWwwAuthenticate(www_authenticate));
+
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_NOT_AUTHORIZED.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorAnnotationsResponse::Forbidden(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(403), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_FORBIDDEN.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorAnnotationsResponse::NotFound(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(404), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_NOT_FOUND.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ GetEditorAnnotationsResponse::GenericError(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(500), body_string));
+ response.headers.set(ContentType(mimetypes::responses::GET_EDITOR_ANNOTATIONS_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)
+ })
+ },
+ "GetEditorAnnotations",
+ );
+
+ let api_clone = api.clone();
router.post(
"/v0/file",
move |req: &mut Request| {