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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js (-31 / +58 lines)
Lines 9-15 export class ERMAPIClient extends HttpClient { Link Here
9
9
10
    get agreements() {
10
    get agreements() {
11
        return {
11
        return {
12
            get: (id) =>
12
            get: id =>
13
                this.get({
13
                this.get({
14
                    endpoint: "agreements/" + id,
14
                    endpoint: "agreements/" + id,
15
                    headers: {
15
                    headers: {
Lines 17-31 export class ERMAPIClient extends HttpClient { Link Here
17
                            "periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents,agreement_packages,agreement_packages.package,vendor",
17
                            "periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents,agreement_packages,agreement_packages.package,vendor",
18
                    },
18
                    },
19
                }),
19
                }),
20
            getAll: (query) =>
20
            getAll: query =>
21
                this.get({
21
                this.get({
22
                    endpoint: "agreements?" + (query || "_per_page=-1"),
22
                    endpoint:
23
                        "agreements?" +
24
                        new URLSearchParams({
25
                            _per_page: -1,
26
                            ...(query && { q: JSON.stringify(query) }),
27
                        }),
23
                }),
28
                }),
24
            delete: (id) =>
29
            delete: id =>
25
                this.delete({
30
                this.delete({
26
                    endpoint: "agreements/" + id,
31
                    endpoint: "agreements/" + id,
27
                }),
32
                }),
28
            create: (agreement) =>
33
            create: agreement =>
29
                this.post({
34
                this.post({
30
                    endpoint: "agreements",
35
                    endpoint: "agreements",
31
                    body: agreement,
36
                    body: agreement,
Lines 50-56 export class ERMAPIClient extends HttpClient { Link Here
50
55
51
    get licenses() {
56
    get licenses() {
52
        return {
57
        return {
53
            get: (id) =>
58
            get: id =>
54
                this.get({
59
                this.get({
55
                    endpoint: "licenses/" + id,
60
                    endpoint: "licenses/" + id,
56
                    headers: {
61
                    headers: {
Lines 58-75 export class ERMAPIClient extends HttpClient { Link Here
58
                            "user_roles,user_roles.patron,vendor,documents",
63
                            "user_roles,user_roles.patron,vendor,documents",
59
                    },
64
                    },
60
                }),
65
                }),
61
            getAll: (query) =>
66
            getAll: query =>
62
                this.get({
67
                this.get({
63
                    endpoint: "licenses?" + (query || "_per_page=-1"),
68
                    endpoint:
69
                        "licenses?" +
70
                        new URLSearchParams({
71
                            _per_page: -1,
72
                            ...(query && { q: JSON.stringify(query) }),
73
                        }),
64
                    headers: {
74
                    headers: {
65
                        "x-koha-embed": "vendor",
75
                        "x-koha-embed": "vendor",
66
                    },
76
                    },
67
                }),
77
                }),
68
            delete: (id) =>
78
            delete: id =>
69
                this.delete({
79
                this.delete({
70
                    endpoint: "licenses/" + id,
80
                    endpoint: "licenses/" + id,
71
                }),
81
                }),
72
            create: (license) =>
82
            create: license =>
73
                this.post({
83
                this.post({
74
                    endpoint: "licenses",
84
                    endpoint: "licenses",
75
                    body: license,
85
                    body: license,
Lines 79-85 export class ERMAPIClient extends HttpClient { Link Here
79
                    endpoint: "licenses/" + id,
89
                    endpoint: "licenses/" + id,
80
                    body: license,
90
                    body: license,
81
                }),
91
                }),
82
                count: (query = {}) =>
92
            count: (query = {}) =>
83
                this.count({
93
                this.count({
84
                    endpoint:
94
                    endpoint:
85
                        "licenses?" +
95
                        "licenses?" +
Lines 94-100 export class ERMAPIClient extends HttpClient { Link Here
94
104
95
    get localPackages() {
105
    get localPackages() {
96
        return {
106
        return {
97
            get: (id) =>
107
            get: id =>
98
                this.get({
108
                this.get({
99
                    endpoint: "eholdings/local/packages/" + id,
109
                    endpoint: "eholdings/local/packages/" + id,
100
                    headers: {
110
                    headers: {
Lines 102-120 export class ERMAPIClient extends HttpClient { Link Here
102
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
112
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
103
                    },
113
                    },
104
                }),
114
                }),
105
            getAll: (query) =>
115
            getAll: query =>
106
                this.get({
116
                this.get({
107
                    endpoint:
117
                    endpoint:
108
                        "eholdings/local/packages?" + (query || "_per_page=-1"),
118
                        "eholdings/local/packages?" +
119
                        new URLSearchParams({
120
                            _per_page: -1,
121
                            ...(query && { q: JSON.stringify(query) }),
122
                        }),
109
                    headers: {
123
                    headers: {
110
                        "x-koha-embed": "resources+count,vendor.name",
124
                        "x-koha-embed": "resources+count,vendor.name",
111
                    },
125
                    },
112
                }),
126
                }),
113
            delete: (id) =>
127
            delete: id =>
114
                this.delete({
128
                this.delete({
115
                    endpoint: "eholdings/local/packages/" + id,
129
                    endpoint: "eholdings/local/packages/" + id,
116
                }),
130
                }),
117
            create: (local_package) =>
131
            create: local_package =>
118
                this.post({
132
                this.post({
119
                    endpoint: "eholdings/local/packages",
133
                    endpoint: "eholdings/local/packages",
120
                    body: local_package,
134
                    body: local_package,
Lines 139-160 export class ERMAPIClient extends HttpClient { Link Here
139
153
140
    get localTitles() {
154
    get localTitles() {
141
        return {
155
        return {
142
            get: (id) =>
156
            get: id =>
143
                this.get({
157
                this.get({
144
                    endpoint: "eholdings/local/titles/" + id,
158
                    endpoint: "eholdings/local/titles/" + id,
145
                    headers: {
159
                    headers: {
146
                        "x-koha-embed": "resources,resources.package",
160
                        "x-koha-embed": "resources,resources.package",
147
                    },
161
                    },
148
                }),
162
                }),
149
            getAll: (query) =>
163
            getAll: query =>
150
                this.get({
164
                this.get({
151
                    endpoint: "eholdings/local/titles?" + (query || "_per_page=-1"),
165
                    endpoint:
166
                        "eholdings/local/titles?" +
167
                        new URLSearchParams({
168
                            _per_page: -1,
169
                            ...(query && { q: JSON.stringify(query) }),
170
                        }),
152
                }),
171
                }),
153
            delete: (id) =>
172
            delete: id =>
154
                this.delete({
173
                this.delete({
155
                    endpoint: "eholdings/local/titles/" + id,
174
                    endpoint: "eholdings/local/titles/" + id,
156
                }),
175
                }),
157
            create: (local_package) =>
176
            create: local_package =>
158
                this.post({
177
                this.post({
159
                    endpoint: "eholdings/local/titles",
178
                    endpoint: "eholdings/local/titles",
160
                    body: local_package,
179
                    body: local_package,
Lines 174-180 export class ERMAPIClient extends HttpClient { Link Here
174
                            ...(query && { q: JSON.stringify(query) }),
193
                            ...(query && { q: JSON.stringify(query) }),
175
                        }),
194
                        }),
176
                }),
195
                }),
177
            import: (body) =>
196
            import: body =>
178
                this.post({
197
                this.post({
179
                    endpoint: "eholdings/local/titles/import",
198
                    endpoint: "eholdings/local/titles/import",
180
                    body,
199
                    body,
Lines 184-190 export class ERMAPIClient extends HttpClient { Link Here
184
203
185
    get localResources() {
204
    get localResources() {
186
        return {
205
        return {
187
            get: (id) =>
206
            get: id =>
188
                this.get({
207
                this.get({
189
                    endpoint: "eholdings/local/resources/" + id,
208
                    endpoint: "eholdings/local/resources/" + id,
190
                    headers: {
209
                    headers: {
Lines 196-202 export class ERMAPIClient extends HttpClient { Link Here
196
215
197
    get EBSCOPackages() {
216
    get EBSCOPackages() {
198
        return {
217
        return {
199
            get: (id) =>
218
            get: id =>
200
                this.get({
219
                this.get({
201
                    endpoint: "eholdings/ebsco/packages/" + id,
220
                    endpoint: "eholdings/ebsco/packages/" + id,
202
                    headers: {
221
                    headers: {
Lines 204-215 export class ERMAPIClient extends HttpClient { Link Here
204
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
223
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
205
                    },
224
                    },
206
                }),
225
                }),
207
            getAll: (query) =>
226
            getAll: query =>
208
                this.get({
227
                this.get({
209
                    endpoint:
228
                    endpoint:
210
                        "eholdings/ebsco/packages/" +
229
                        "eholdings/ebsco/packages/" +
211
                        id +
230
                        id +
212
                        (query || "_per_page=-1"),
231
                        "?" +
232
                        new URLSearchParams({
233
                            _per_page: -1,
234
                            ...(query && { q: JSON.stringify(query) }),
235
                        }),
213
                    headers: {
236
                    headers: {
214
                        "x-koha-embed": "resources+count,vendor.name",
237
                        "x-koha-embed": "resources+count,vendor.name",
215
                    },
238
                    },
Lines 224-247 export class ERMAPIClient extends HttpClient { Link Here
224
247
225
    get EBSCOTitles() {
248
    get EBSCOTitles() {
226
        return {
249
        return {
227
            get: (id) =>
250
            get: id =>
228
                this.get({
251
                this.get({
229
                    endpoint: "eholdings/ebsco/titles/" + id,
252
                    endpoint: "eholdings/ebsco/titles/" + id,
230
                    headers: {
253
                    headers: {
231
                        "x-koha-embed": "resources,resources.package",
254
                        "x-koha-embed": "resources,resources.package",
232
                    },
255
                    },
233
                }),
256
                }),
234
            getAll: (query) =>
257
            getAll: query =>
235
                this.get({
258
                this.get({
236
                    endpoint:
259
                    endpoint:
237
                        "eholdings/local/ebsco/titles" + (query || "_per_page=-1"),
260
                        "eholdings/local/ebsco/titles" +
261
                        "?" +
262
                        new URLSearchParams({
263
                            _per_page: -1,
264
                            ...(query && { q: JSON.stringify(query) }),
265
                        }),
238
                }),
266
                }),
239
        };
267
        };
240
    }
268
    }
241
269
242
    get EBSCOResources() {
270
    get EBSCOResources() {
243
        return {
271
        return {
244
            get: (id) =>
272
            get: id =>
245
                this.get({
273
                this.get({
246
                    endpoint: "eholdings/ebsco/resources/" + id,
274
                    endpoint: "eholdings/ebsco/resources/" + id,
247
                    headers: {
275
                    headers: {
248
- 

Return to bug 33623