1 import { makeDeleteRequest, makeGetRequest, makePostBodyRequest } from '../requests/requests'
3 function addUserSubscription (url: string, token: string, targetUri: string, statusCodeExpected = 204) {
4 const path = '/api/v1/users/me/subscriptions'
6 return makePostBodyRequest({
11 fields: { uri: targetUri }
15 function listUserSubscriptions (parameters: {
20 statusCodeExpected?: number
22 const { url, token, sort = '-createdAt', search, statusCodeExpected = 200 } = parameters
23 const path = '/api/v1/users/me/subscriptions'
25 return makeGetRequest({
37 function listUserSubscriptionVideos (url: string, token: string, sort = '-createdAt', statusCodeExpected = 200) {
38 const path = '/api/v1/users/me/subscriptions/videos'
40 return makeGetRequest({
49 function getUserSubscription (url: string, token: string, uri: string, statusCodeExpected = 200) {
50 const path = '/api/v1/users/me/subscriptions/' + uri
52 return makeGetRequest({
60 function removeUserSubscription (url: string, token: string, uri: string, statusCodeExpected = 204) {
61 const path = '/api/v1/users/me/subscriptions/' + uri
63 return makeDeleteRequest({
71 function areSubscriptionsExist (url: string, token: string, uris: string[], statusCodeExpected = 200) {
72 const path = '/api/v1/users/me/subscriptions/exist'
74 return makeGetRequest({
77 query: { 'uris[]': uris },
83 // ---------------------------------------------------------------------------
86 areSubscriptionsExist,
88 listUserSubscriptions,
90 listUserSubscriptionVideos,
91 removeUserSubscription