View | Details | Raw Unified | Return to bug 16699
Collapse All | Expand All

(-)a/api/v1/definitions.json (+14 lines)
Line 0 Link Here
1
{
2
  "patron": {
3
    "$ref": "definitions/patron.json"
4
  },
5
  "holds": {
6
    "$ref": "definitions/holds.json"
7
  },
8
  "hold": {
9
    "$ref": "definitions/hold.json"
10
  },
11
  "error": {
12
    "$ref": "definitions/error.json"
13
  }
14
}
(-)a/api/v1/definitions/index.json (-6 lines)
Lines 1-6 Link Here
1
{
2
    "patron": { "$ref": "patron.json" },
3
    "holds": { "$ref": "holds.json" },
4
    "hold": { "$ref": "hold.json" },
5
    "error": { "$ref": "error.json" }
6
}
(-)a/api/v1/parameters.json (+8 lines)
Line 0 Link Here
1
{
2
  "borrowernumberPathParam": {
3
    "$ref": "parameters/patron.json#/borrowernumberPathParam"
4
  },
5
  "holdIdPathParam": {
6
    "$ref": "parameters/hold.json#/holdIdPathParam"
7
  }
8
}
(-)a/api/v1/parameters/hold.json (+9 lines)
Line 0 Link Here
1
{
2
  "holdIdPathParam": {
3
    "name": "reserve_id",
4
    "in": "path",
5
    "description": "Internal hold identifier",
6
    "required": true,
7
    "type": "integer"
8
  }
9
}
(-)a/api/v1/parameters/patron.json (+9 lines)
Line 0 Link Here
1
{
2
  "borrowernumberPathParam": {
3
    "name": "borrowernumber",
4
    "in": "path",
5
    "description": "Internal patron identifier",
6
    "required": true,
7
    "type": "integer"
8
  }
9
}
(-)a/api/v1/paths.json (+14 lines)
Line 0 Link Here
1
{
2
  "/holds": {
3
    "$ref": "paths/holds.json#/~1holds"
4
  },
5
  "/holds/{reserve_id}": {
6
    "$ref": "paths/holds.json#/~1holds~1{reserve_id}"
7
  },
8
  "/patrons": {
9
    "$ref": "paths/patrons.json#/~1patrons"
10
  },
11
  "/patrons/{borrowernumber}": {
12
    "$ref": "paths/patrons.json#/~1patrons~1{borrowernumber}"
13
  }
14
}
(-)a/api/v1/paths/holds.json (+181 lines)
Line 0 Link Here
1
{
2
  "/holds": {
3
    "get": {
4
      "operationId": "listHolds",
5
      "tags": ["borrowers", "holds"],
6
      "parameters": [{
7
          "name": "borrowernumber",
8
          "in": "query",
9
          "description": "Internal borrower identifier",
10
          "required": true,
11
          "type": "integer"
12
        }
13
      ],
14
      "produces": ["application/json"],
15
      "responses": {
16
        "200": {
17
          "description": "A list of holds",
18
          "schema": {
19
            "$ref": "../definitions.json#/holds"
20
          }
21
        },
22
        "404": {
23
          "description": "Borrower not found",
24
          "schema": {
25
            "$ref": "../definitions.json#/error"
26
          }
27
        }
28
      }
29
    },
30
    "post": {
31
      "operationId": "addHold",
32
      "tags": ["borrowers", "holds"],
33
      "parameters": [{
34
          "name": "body",
35
          "in": "body",
36
          "description": "A JSON object containing informations about the new hold",
37
          "required": true,
38
          "schema": {
39
            "type": "object",
40
            "properties": {
41
              "borrowernumber": {
42
                "description": "Borrower internal identifier",
43
                "type": "integer"
44
              },
45
              "biblionumber": {
46
                "description": "Biblio internal identifier",
47
                "type": "integer"
48
              },
49
              "itemnumber": {
50
                "description": "Item internal identifier",
51
                "type": "integer"
52
              },
53
              "branchcode": {
54
                "description": "Pickup location",
55
                "type": "string"
56
              },
57
              "expirationdate": {
58
                "description": "Hold end date",
59
                "type": "string",
60
                "format": "date"
61
              }
62
            }
63
          }
64
        }
65
      ],
66
      "consumes": ["application/json"],
67
      "produces": ["application/json"],
68
      "responses": {
69
        "201": {
70
          "description": "Created hold",
71
          "schema": {
72
            "$ref": "../definitions.json#/hold"
73
          }
74
        },
75
        "400": {
76
          "description": "Missing or wrong parameters",
77
          "schema": {
78
            "$ref": "../definitions.json#/error"
79
          }
80
        },
81
        "403": {
82
          "description": "Hold not allowed",
83
          "schema": {
84
            "$ref": "../definitions.json#/error"
85
          }
86
        },
87
        "404": {
88
          "description": "Borrower not found",
89
          "schema": {
90
            "$ref": "../definitions.json#/error"
91
          }
92
        },
93
        "500": {
94
          "description": "Internal error",
95
          "schema": {
96
            "$ref": "../definitions.json#/error"
97
          }
98
        }
99
      }
100
    }
101
  },
102
  "/holds/{reserve_id}": {
103
    "put": {
104
      "operationId": "editHold",
105
      "tags": ["holds"],
106
      "parameters": [{
107
          "$ref": "../parameters.json#/holdIdPathParam"
108
        }, {
109
          "name": "body",
110
          "in": "body",
111
          "description": "A JSON object containing fields to modify",
112
          "required": true,
113
          "schema": {
114
            "type": "object",
115
            "properties": {
116
              "priority": {
117
                "description": "Position in waiting queue",
118
                "type": "integer",
119
                "minimum": 1
120
              },
121
              "branchcode": {
122
                "description": "Pickup location",
123
                "type": "string"
124
              },
125
              "suspend_until": {
126
                "description": "Suspend until",
127
                "type": "string",
128
                "format": "date"
129
              }
130
            }
131
          }
132
        }
133
      ],
134
      "consumes": ["application/json"],
135
      "produces": ["application/json"],
136
      "responses": {
137
        "200": {
138
          "description": "Updated hold",
139
          "schema": {
140
            "$ref": "../definitions.json#/hold"
141
          }
142
        },
143
        "400": {
144
          "description": "Missing or wrong parameters",
145
          "schema": {
146
            "$ref": "../definitions.json#/error"
147
          }
148
        },
149
        "404": {
150
          "description": "Hold not found",
151
          "schema": {
152
            "$ref": "../definitions.json#/error"
153
          }
154
        }
155
      }
156
    },
157
    "delete": {
158
      "operationId": "deleteHold",
159
      "tags": ["holds"],
160
      "parameters": [{
161
          "$ref": "../parameters.json#/holdIdPathParam"
162
        }
163
      ],
164
      "produces": ["application/json"],
165
      "responses": {
166
        "200": {
167
          "description": "Successful deletion",
168
          "schema": {
169
            "type": "object"
170
          }
171
        },
172
        "404": {
173
          "description": "Hold not found",
174
          "schema": {
175
            "$ref": "../definitions.json#/error"
176
          }
177
        }
178
      }
179
    }
180
  }
181
}
(-)a/api/v1/paths/patrons.json (+61 lines)
Line 0 Link Here
1
{
2
  "/patrons": {
3
    "get": {
4
      "operationId": "listPatrons",
5
      "tags": ["patrons"],
6
      "produces": [
7
          "application/json"
8
      ],
9
      "responses": {
10
        "200": {
11
          "description": "A list of patrons",
12
          "schema": {
13
            "type": "array",
14
            "items": {
15
              "$ref": "../definitions.json#/patron"
16
            }
17
          }
18
        },
19
        "403": {
20
          "description": "Access forbidden",
21
          "schema": {
22
            "$ref": "../definitions.json#/error"
23
          }
24
        }
25
      }
26
    }
27
  },
28
  "/patrons/{borrowernumber}": {
29
    "get": {
30
      "operationId": "getPatron",
31
      "tags": ["patrons"],
32
      "parameters": [{
33
          "$ref": "../parameters.json#/borrowernumberPathParam"
34
        }
35
      ],
36
      "produces": [
37
          "application/json"
38
      ],
39
      "responses": {
40
        "200": {
41
          "description": "A patron",
42
          "schema": {
43
            "$ref": "../definitions.json#/patron"
44
          }
45
        },
46
        "403": {
47
          "description": "Access forbidden",
48
          "schema": {
49
            "$ref": "../definitions.json#/error"
50
          }
51
        },
52
        "404": {
53
          "description": "Patron not found",
54
          "schema": {
55
            "$ref": "../definitions.json#/error"
56
          }
57
        }
58
      }
59
    }
60
  }
61
}
(-)a/api/v1/swagger.json (-234 / +3 lines)
Lines 14-255 Link Here
14
  },
14
  },
15
  "basePath": "/api/v1",
15
  "basePath": "/api/v1",
16
  "paths": {
16
  "paths": {
17
    "/patrons": {
17
    "$ref": "paths.json"
18
      "get": {
19
        "operationId": "listPatrons",
20
        "tags": ["patrons"],
21
        "produces": [
22
          "application/json"
23
        ],
24
        "responses": {
25
          "200": {
26
            "description": "A list of patrons",
27
            "schema": {
28
              "type": "array",
29
              "items": {
30
                "$ref": "#/definitions/patron"
31
              }
32
            }
33
          },
34
          "403": {
35
            "description": "Access forbidden",
36
            "schema": {
37
              "$ref": "#/definitions/error"
38
            }
39
          }
40
        }
41
      }
42
    },
43
    "/patrons/{borrowernumber}": {
44
      "get": {
45
        "operationId": "getPatron",
46
        "tags": ["patrons"],
47
        "parameters": [
48
          {
49
            "$ref": "#/parameters/borrowernumberPathParam"
50
          }
51
        ],
52
        "produces": [
53
          "application/json"
54
        ],
55
        "responses": {
56
          "200": {
57
            "description": "A patron",
58
            "schema": {
59
              "$ref": "#/definitions/patron"
60
            }
61
          },
62
          "403": {
63
            "description": "Access forbidden",
64
            "schema": {
65
              "$ref": "#/definitions/error"
66
            }
67
          },
68
          "404": {
69
            "description": "Patron not found",
70
            "schema": {
71
              "$ref": "#/definitions/error"
72
            }
73
          }
74
        }
75
      }
76
    },
77
    "/holds": {
78
      "get": {
79
        "operationId": "listHolds",
80
        "tags": ["borrowers", "holds"],
81
        "parameters": [
82
          {
83
            "name": "borrowernumber",
84
            "in": "query",
85
            "description": "Internal borrower identifier",
86
            "required": true,
87
            "type": "integer"
88
          }
89
        ],
90
        "produces": ["application/json"],
91
        "responses": {
92
          "200": {
93
            "description": "A list of holds",
94
            "schema": { "$ref": "#/definitions/holds" }
95
          },
96
          "404": {
97
            "description": "Borrower not found",
98
            "schema": { "$ref": "#/definitions/error" }
99
          }
100
        }
101
      },
102
      "post": {
103
        "operationId": "addHold",
104
        "tags": ["borrowers", "holds"],
105
        "parameters": [
106
          {
107
            "name": "body",
108
            "in": "body",
109
            "description": "A JSON object containing informations about the new hold",
110
            "required": true,
111
            "schema": {
112
              "type": "object",
113
              "properties": {
114
                "borrowernumber": {
115
                  "description": "Borrower internal identifier",
116
                  "type": "integer"
117
                },
118
                "biblionumber": {
119
                  "description": "Biblio internal identifier",
120
                  "type": "integer"
121
                },
122
                "itemnumber": {
123
                  "description": "Item internal identifier",
124
                  "type": "integer"
125
                },
126
                "branchcode": {
127
                  "description": "Pickup location",
128
                  "type": "string"
129
                },
130
                "expirationdate": {
131
                  "description": "Hold end date",
132
                  "type": "string",
133
                  "format": "date"
134
                }
135
              }
136
            }
137
          }
138
        ],
139
        "consumes": ["application/json"],
140
        "produces": ["application/json"],
141
        "responses": {
142
          "201": {
143
            "description": "Created hold",
144
            "schema": { "$ref": "#/definitions/hold" }
145
          },
146
          "400": {
147
            "description": "Missing or wrong parameters",
148
            "schema": { "$ref": "#/definitions/error" }
149
          },
150
          "403": {
151
            "description": "Hold not allowed",
152
            "schema": { "$ref": "#/definitions/error" }
153
          },
154
          "404": {
155
            "description": "Borrower not found",
156
            "schema": { "$ref": "#/definitions/error" }
157
          },
158
          "500": {
159
            "description": "Internal error",
160
            "schema": { "$ref": "#/definitions/error" }
161
          }
162
        }
163
      }
164
    },
165
    "/holds/{reserve_id}": {
166
      "put": {
167
        "operationId": "editHold",
168
        "tags": ["holds"],
169
        "parameters": [
170
          { "$ref": "#/parameters/holdIdPathParam" },
171
          {
172
            "name": "body",
173
            "in": "body",
174
            "description": "A JSON object containing fields to modify",
175
            "required": true,
176
            "schema": {
177
              "type": "object",
178
              "properties": {
179
                "priority": {
180
                  "description": "Position in waiting queue",
181
                  "type": "integer",
182
                  "minimum": 1
183
                },
184
                "branchcode": {
185
                  "description": "Pickup location",
186
                  "type": "string"
187
                },
188
                "suspend_until": {
189
                  "description": "Suspend until",
190
                  "type": "string",
191
                  "format": "date"
192
                }
193
              }
194
            }
195
          }
196
        ],
197
        "consumes": ["application/json"],
198
        "produces": ["application/json"],
199
        "responses": {
200
          "200": {
201
            "description": "Updated hold",
202
            "schema": { "$ref": "#/definitions/hold" }
203
          },
204
          "400": {
205
            "description": "Missing or wrong parameters",
206
            "schema": { "$ref": "#/definitions/error" }
207
          },
208
          "404": {
209
            "description": "Hold not found",
210
            "schema": { "$ref": "#/definitions/error" }
211
          }
212
        }
213
      },
214
      "delete": {
215
        "operationId": "deleteHold",
216
        "tags": ["holds"],
217
        "parameters": [
218
          { "$ref": "#/parameters/holdIdPathParam" }
219
        ],
220
        "produces": ["application/json"],
221
        "responses": {
222
          "200": {
223
            "description": "Successful deletion",
224
            "schema": {
225
              "type": "object"
226
            }
227
          },
228
          "404": {
229
            "description": "Hold not found",
230
            "schema": { "$ref": "#/definitions/error" }
231
          }
232
        }
233
      }
234
    }
235
  },
18
  },
236
  "definitions": {
19
  "definitions": {
237
    "$ref": "./definitions/index.json"
20
    "$ref": "definitions.json"
238
  },
21
  },
239
  "parameters": {
22
  "parameters": {
240
    "borrowernumberPathParam": {
23
    "$ref": "parameters.json"
241
      "name": "borrowernumber",
242
      "in": "path",
243
      "description": "Internal patron identifier",
244
      "required": true,
245
      "type": "integer"
246
    },
247
    "holdIdPathParam": {
248
      "name": "reserve_id",
249
      "in": "path",
250
      "description": "Internal hold identifier",
251
      "required": true,
252
      "type": "integer"
253
    }
254
  }
24
  }
255
}
25
}
256
- 

Return to bug 16699