|
Lines 9-35
export class PreservationAPIClient extends HttpClient {
Link Here
|
| 9 |
|
9 |
|
| 10 |
get trains() { |
10 |
get trains() { |
| 11 |
return { |
11 |
return { |
| 12 |
get: (id) => |
12 |
get: id => |
| 13 |
this.get({ |
13 |
this.get({ |
| 14 |
endpoint: "trains/" + id, |
14 |
endpoint: "trains/" + id, |
| 15 |
headers: { |
15 |
headers: { |
| 16 |
"x-koha-embed": |
16 |
"x-koha-embed": |
| 17 |
"default_processing,default_processing.attributes,items,items.attributes,items.attributes.processing_attribute", |
17 |
"default_processing,default_processing.attributes,items,items.attributes,items.attributes+strings,items.attributes.processing_attribute", |
| 18 |
}, |
18 |
}, |
| 19 |
}), |
19 |
}), |
| 20 |
getAll: (query = {}) => |
20 |
getAll: (query = {}) => |
| 21 |
this.get({ |
21 |
this.get({ |
| 22 |
endpoint: "trains?" + |
22 |
endpoint: |
|
|
23 |
"trains?" + |
| 23 |
new URLSearchParams({ |
24 |
new URLSearchParams({ |
| 24 |
_per_page: -1, |
25 |
_per_page: -1, |
| 25 |
...(query && { q: JSON.stringify(query) }), |
26 |
...(query && { q: JSON.stringify(query) }), |
| 26 |
}), |
27 |
}), |
| 27 |
}), |
28 |
}), |
| 28 |
delete: (id) => |
29 |
delete: id => |
| 29 |
this.delete({ |
30 |
this.delete({ |
| 30 |
endpoint: "trains/" + id, |
31 |
endpoint: "trains/" + id, |
| 31 |
}), |
32 |
}), |
| 32 |
create: (train) => |
33 |
create: train => |
| 33 |
this.post({ |
34 |
this.post({ |
| 34 |
endpoint: "trains", |
35 |
endpoint: "trains", |
| 35 |
body: train, |
36 |
body: train, |
|
Lines 54-80
export class PreservationAPIClient extends HttpClient {
Link Here
|
| 54 |
|
55 |
|
| 55 |
get processings() { |
56 |
get processings() { |
| 56 |
return { |
57 |
return { |
| 57 |
get: (id) => |
58 |
get: id => |
| 58 |
this.get({ |
59 |
this.get({ |
| 59 |
endpoint: "processings/" + id, |
60 |
endpoint: "processings/" + id, |
| 60 |
headers: { |
61 |
headers: { |
| 61 |
"x-koha-embed": "attributes", |
62 |
"x-koha-embed": "attributes", |
| 62 |
}, |
63 |
}, |
| 63 |
}), |
64 |
}), |
| 64 |
getAll: (query) => |
65 |
getAll: query => |
| 65 |
this.get({ |
66 |
this.get({ |
| 66 |
endpoint: "processings?" + |
67 |
endpoint: |
|
|
68 |
"processings?" + |
| 67 |
new URLSearchParams({ |
69 |
new URLSearchParams({ |
| 68 |
_per_page: -1, |
70 |
_per_page: -1, |
| 69 |
...(query && { q: JSON.stringify(query) }), |
71 |
...(query && { q: JSON.stringify(query) }), |
| 70 |
}), |
72 |
}), |
| 71 |
}), |
73 |
}), |
| 72 |
|
74 |
|
| 73 |
delete: (id) => |
75 |
delete: id => |
| 74 |
this.delete({ |
76 |
this.delete({ |
| 75 |
endpoint: "processings/" + id, |
77 |
endpoint: "processings/" + id, |
| 76 |
}), |
78 |
}), |
| 77 |
create: (processing) => |
79 |
create: processing => |
| 78 |
this.post({ |
80 |
this.post({ |
| 79 |
endpoint: "processings", |
81 |
endpoint: "processings", |
| 80 |
body: processing, |
82 |
body: processing, |
|
Lines 148-154
export class PreservationAPIClient extends HttpClient {
Link Here
|
| 148 |
|
150 |
|
| 149 |
get waiting_list_items() { |
151 |
get waiting_list_items() { |
| 150 |
return { |
152 |
return { |
| 151 |
get_from_barcode: (barcode) => { |
153 |
get_from_barcode: barcode => { |
| 152 |
const q = { |
154 |
const q = { |
| 153 |
"me.barcode": barcode, |
155 |
"me.barcode": barcode, |
| 154 |
}; |
156 |
}; |
|
Lines 164-178
export class PreservationAPIClient extends HttpClient {
Link Here
|
| 164 |
headers: { |
166 |
headers: { |
| 165 |
"x-koha-embed": "biblio", |
167 |
"x-koha-embed": "biblio", |
| 166 |
}, |
168 |
}, |
| 167 |
}).then((response) => { |
169 |
}).then(response => { |
| 168 |
return response.length ? response[0] : undefined; |
170 |
return response.length ? response[0] : undefined; |
| 169 |
}); |
171 |
}); |
| 170 |
}, |
172 |
}, |
| 171 |
delete: (id) => |
173 |
delete: id => |
| 172 |
this.delete({ |
174 |
this.delete({ |
| 173 |
endpoint: "waiting-list/items/" + id, |
175 |
endpoint: "waiting-list/items/" + id, |
| 174 |
}), |
176 |
}), |
| 175 |
createAll: (items) => |
177 |
createAll: items => |
| 176 |
this.post({ |
178 |
this.post({ |
| 177 |
endpoint: "waiting-list/items", |
179 |
endpoint: "waiting-list/items", |
| 178 |
body: items, |
180 |
body: items, |
| 179 |
- |
|
|