Skip to content

Commit

Permalink
urls: Create endpoint to link two series
Browse files Browse the repository at this point in the history
Closes getpatchwork#506

Signed-off-by: andrepapoti <[email protected]>
  • Loading branch information
andrepapoti committed Mar 19, 2024
1 parent ef87fb4 commit 75d237c
Show file tree
Hide file tree
Showing 6 changed files with 3,428 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api/schemas/generate-schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
yaml = None

ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), None]
LATEST_VERSION = (1, 3)
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), None]
LATEST_VERSION = (1, 4)


def generate_schemas():
Expand Down
59 changes: 58 additions & 1 deletion docs/api/schemas/latest/patchwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ info:
license:
name: GPL v2 License
url: https://www.gnu.org/licenses/gpl-2.0.html
version: '1.3'
version: '1.4'
paths:
/api:
get:
Expand Down Expand Up @@ -1223,6 +1223,56 @@ paths:
$ref: '#/components/schemas/Error'
tags:
- series
/api/series/{id}/link/{related_series_id}:
parameters:
- in: path
name: id
description: A unique integer value identifying this series.
required: true
schema:
title: Series ID
type: integer
- in: path
name: related_series_id
description: A unique integer value identifying the related series.
required: true
schema:
title: Related series ID
type: integer
patch:
summary: Link both series.
description: |
Link two series makes so that they bidirectionaly relate to each other.
Series must belong to the same project to be able to be linked
operationId: series_link
responses:
'200':
description: 'Liked series'
content:
application/json:
schema:
$ref: '#/components/schemas/Series'
'400':
description: 'Bad request'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: 'Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'Not found'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- series
/api/users:
get:
summary: List users.
Expand Down Expand Up @@ -2605,6 +2655,13 @@ components:
$ref: '#/components/schemas/PatchEmbedded'
readOnly: true
uniqueItems: true
related_series:
title: Related series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
User:
type: object
title: User
Expand Down
61 changes: 61 additions & 0 deletions docs/api/schemas/patchwork.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,58 @@ paths:
$ref: '#/components/schemas/Error'
tags:
- series
{% if version >= (1, 4) %}
/api/{{ version_url }}series/{id}/link/{related_series_id}:
parameters:
- in: path
name: id
description: A unique integer value identifying this series.
required: true
schema:
title: Series ID
type: integer
- in: path
name: related_series_id
description: A unique integer value identifying the related series.
required: true
schema:
title: Related series ID
type: integer
patch:
summary: Link both series.
description: |
Link two series makes so that they bidirectionaly relate to each other.

Series must belong to the same project to be able to be linked
operationId: series_link
responses:
'200':
description: 'Liked series'
content:
application/json:
schema:
$ref: '#/components/schemas/Series'
'400':
description: 'Bad request'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: 'Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'Not found'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- series
{% endif %}
/api/{{ version_url }}users:
get:
summary: List users.
Expand Down Expand Up @@ -2699,6 +2751,15 @@ components:
$ref: '#/components/schemas/PatchEmbedded'
readOnly: true
uniqueItems: true
{% if version >= (1, 4) %}
related_series:
title: Related series
type: array
items:
$ref: '#/components/schemas/Series'
readOnly: true
uniqueItems: true
{% endif %}
User:
type: object
title: User
Expand Down
Loading

0 comments on commit 75d237c

Please sign in to comment.