Skip to content

Commit a46a465

Browse files
committed
urls: Create endpoint to link two series
Closes getpatchwork#506 Signed-off-by: andrepapoti <[email protected]>
1 parent ef87fb4 commit a46a465

File tree

6 files changed

+3443
-7
lines changed

6 files changed

+3443
-7
lines changed

docs/api/schemas/generate-schemas.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
yaml = None
1515

1616
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
17-
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), None]
18-
LATEST_VERSION = (1, 3)
17+
VERSIONS = [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), None]
18+
LATEST_VERSION = (1, 4)
1919

2020

2121
def generate_schemas():

docs/api/schemas/latest/patchwork.yaml

+58-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ info:
1313
license:
1414
name: GPL v2 License
1515
url: https://www.gnu.org/licenses/gpl-2.0.html
16-
version: '1.3'
16+
version: '1.4'
1717
paths:
1818
/api:
1919
get:
@@ -1223,6 +1223,56 @@ paths:
12231223
$ref: '#/components/schemas/Error'
12241224
tags:
12251225
- series
1226+
/api/series/{id}/link/{related_series_id}:
1227+
parameters:
1228+
- in: path
1229+
name: id
1230+
description: A unique integer value identifying this series.
1231+
required: true
1232+
schema:
1233+
title: Series ID
1234+
type: integer
1235+
- in: path
1236+
name: related_series_id
1237+
description: A unique integer value identifying the related series.
1238+
required: true
1239+
schema:
1240+
title: Related series ID
1241+
type: integer
1242+
patch:
1243+
summary: Link both series.
1244+
description: |
1245+
Link two series makes so that they bidirectionaly relate to each other.
1246+
1247+
Series must belong to the same project to be able to be linked
1248+
operationId: series_link
1249+
responses:
1250+
'200':
1251+
description: 'Liked series'
1252+
content:
1253+
application/json:
1254+
schema:
1255+
$ref: '#/components/schemas/Series'
1256+
'400':
1257+
description: 'Bad request'
1258+
content:
1259+
application/json:
1260+
schema:
1261+
$ref: '#/components/schemas/Error'
1262+
'403':
1263+
description: 'Forbidden'
1264+
content:
1265+
application/json:
1266+
schema:
1267+
$ref: '#/components/schemas/Error'
1268+
'404':
1269+
description: 'Not found'
1270+
content:
1271+
application/json:
1272+
schema:
1273+
$ref: '#/components/schemas/Error'
1274+
tags:
1275+
- series
12261276
/api/users:
12271277
get:
12281278
summary: List users.
@@ -2605,6 +2655,13 @@ components:
26052655
$ref: '#/components/schemas/PatchEmbedded'
26062656
readOnly: true
26072657
uniqueItems: true
2658+
related_series:
2659+
title: Related series
2660+
type: array
2661+
items:
2662+
$ref: '#/components/schemas/Series'
2663+
readOnly: true
2664+
uniqueItems: true
26082665
User:
26092666
type: object
26102667
title: User

docs/api/schemas/patchwork.j2

+61
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,58 @@ paths:
12481248
$ref: '#/components/schemas/Error'
12491249
tags:
12501250
- series
1251+
{% if version >= (1, 4) %}
1252+
/api/{{ version_url }}series/{id}/link/{related_series_id}:
1253+
parameters:
1254+
- in: path
1255+
name: id
1256+
description: A unique integer value identifying this series.
1257+
required: true
1258+
schema:
1259+
title: Series ID
1260+
type: integer
1261+
- in: path
1262+
name: related_series_id
1263+
description: A unique integer value identifying the related series.
1264+
required: true
1265+
schema:
1266+
title: Related series ID
1267+
type: integer
1268+
patch:
1269+
summary: Link both series.
1270+
description: |
1271+
Link two series makes so that they bidirectionaly relate to each other.
1272+
1273+
Series must belong to the same project to be able to be linked
1274+
operationId: series_link
1275+
responses:
1276+
'200':
1277+
description: 'Liked series'
1278+
content:
1279+
application/json:
1280+
schema:
1281+
$ref: '#/components/schemas/Series'
1282+
'400':
1283+
description: 'Bad request'
1284+
content:
1285+
application/json:
1286+
schema:
1287+
$ref: '#/components/schemas/Error'
1288+
'403':
1289+
description: 'Forbidden'
1290+
content:
1291+
application/json:
1292+
schema:
1293+
$ref: '#/components/schemas/Error'
1294+
'404':
1295+
description: 'Not found'
1296+
content:
1297+
application/json:
1298+
schema:
1299+
$ref: '#/components/schemas/Error'
1300+
tags:
1301+
- series
1302+
{% endif %}
12511303
/api/{{ version_url }}users:
12521304
get:
12531305
summary: List users.
@@ -2699,6 +2751,15 @@ components:
26992751
$ref: '#/components/schemas/PatchEmbedded'
27002752
readOnly: true
27012753
uniqueItems: true
2754+
{% if version >= (1, 4) %}
2755+
related_series:
2756+
title: Related series
2757+
type: array
2758+
items:
2759+
$ref: '#/components/schemas/Series'
2760+
readOnly: true
2761+
uniqueItems: true
2762+
{% endif %}
27022763
User:
27032764
type: object
27042765
title: User

0 commit comments

Comments
 (0)