aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2018-10-26 21:46:16 +0100
committerStephen Finucane <stephen@that.guru>2018-12-22 17:19:07 +0000
commit4dd58e1c206750311849e0c2a85ba51ec0412242 (patch)
tree46d26a384272cfc5ef9c147d9e3b65aeecb5f365 /docs
parent7d8e24bc84bd0c73643822944b3c7dc901ee8b41 (diff)
downloadpatchwork-4dd58e1c206750311849e0c2a85ba51ec0412242.tar
patchwork-4dd58e1c206750311849e0c2a85ba51ec0412242.tar.gz
docs: Document the '/users' resource
This introduces our first use of parameters, both in the path and the query. The latter are extracted out as they'll be used by later changes. Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'docs')
-rw-r--r--docs/api/schemas/patchwork.yaml255
1 files changed, 255 insertions, 0 deletions
diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml
index 515dac3..a0f6e78 100644
--- a/docs/api/schemas/patchwork.yaml
+++ b/docs/api/schemas/patchwork.yaml
@@ -25,6 +25,160 @@ paths:
$ref: '#/components/schemas/Index'
tags:
- api
+ /api/users/:
+ get:
+ description: List users.
+ operationId: users_list
+ security:
+ - basicAuth: []
+ - apiKeyAuth: []
+ parameters:
+ - $ref: '#/components/parameters/Page'
+ - $ref: '#/components/parameters/PageSize'
+ - $ref: '#/components/parameters/Order'
+ - $ref: '#/components/parameters/Search'
+ responses:
+ '200':
+ description: ''
+ headers:
+ Link:
+ $ref: '#/components/headers/Link'
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ '403':
+ description: 'Forbidden'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ tags:
+ - users
+ /api/users/{id}/:
+ get:
+ description: Show a user.
+ operationId: users_read
+ security:
+ - basicAuth: []
+ - apiKeyAuth: []
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: A unique integer value identifying this user.
+ title: ID
+ type: integer
+ responses:
+ '200':
+ description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '403':
+ description: 'Forbidden'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ '404':
+ description: 'Not found'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ tags:
+ - users
+ patch:
+ description: Update a user (partial).
+ operationId: users_partial_update
+ security:
+ - basicAuth: []
+ - apiKeyAuth: []
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: A unique integer value identifying this user.
+ title: ID
+ type: integer
+ requestBody:
+ $ref: '#/components/requestBodies/User'
+ responses:
+ '200':
+ description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: 'Bad request'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorUserUpdate'
+ '403':
+ description: 'Forbidden'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ '404':
+ description: 'Not found'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ tags:
+ - users
+ put:
+ description: Update a user.
+ operationId: users_update
+ security:
+ - basicAuth: []
+ - apiKeyAuth: []
+ parameters:
+ - in: path
+ name: id
+ required: true
+ schema:
+ description: A unique integer value identifying this user.
+ title: ID
+ type: integer
+ requestBody:
+ $ref: '#/components/requestBodies/User'
+ responses:
+ '200':
+ description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: 'Bad request'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorUserUpdate'
+ '403':
+ description: 'Forbidden'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ '404':
+ description: 'Not found'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ tags:
+ - users
components:
securitySchemes:
basicAuth:
@@ -33,6 +187,57 @@ components:
apiKeyAuth:
type: http
scheme: bearer
+ parameters:
+ Page:
+ in: query
+ name: page
+ schema:
+ description: A page number within the paginated result set.
+ title: Page
+ type: integer
+ PageSize:
+ in: query
+ name: per_page
+ schema:
+ description: Number of results to return per page.
+ title: Page size
+ type: integer
+ Order:
+ in: query
+ name: order
+ schema:
+ description: Which field to use when ordering the results.
+ title: Ordering
+ type: string
+ Search:
+ in: query
+ name: q
+ schema:
+ description: A search term.
+ title: Search
+ type: string
+ headers:
+ Link:
+ description: |
+ Links to related resources, in the format defined by
+ [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5).
+ This will include a link with relation type `next` to the
+ next page, if there is a next page.
+ schema:
+ type: string
+ requestBodies:
+ User:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/User'
schemas:
Index:
type: object
@@ -72,3 +277,53 @@ components:
type: string
format: uri
readOnly: true
+ User:
+ type: object
+ properties:
+ id:
+ title: ID
+ type: integer
+ readOnly: true
+ url:
+ title: URL
+ type: string
+ format: uri
+ readOnly: true
+ username:
+ title: Username
+ type: string
+ readOnly: true
+ minLength: 1
+ maxLength: 150
+ first_name:
+ title: First name
+ type: string
+ maxLength: 30
+ last_name:
+ title: Last name
+ type: string
+ maxLength: 150
+ email:
+ title: Email address
+ type: string
+ format: email
+ readOnly: true
+ minLength: 1
+ Error:
+ type: object
+ properties:
+ detail:
+ title: Detail
+ type: string
+ readOnly: true
+ ErrorUserUpdate:
+ type: object
+ properties:
+ first_name:
+ title: First name
+ type: string
+ readOnly: true
+ last_name:
+ title: First name
+ type: string
+ readOnly: true