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 (url: string, token: string, sort = '-createdAt', statusCodeExpected = 200) {
16 const path = '/api/v1/users/me/subscriptions'
18 return makeGetRequest({
27 function listUserSubscriptionVideos (url: string, token: string, sort = '-createdAt', statusCodeExpected = 200) {
28 const path = '/api/v1/users/me/subscriptions/videos'
30 return makeGetRequest({
39 function getUserSubscription (url: string, token: string, uri: string, statusCodeExpected = 200) {
40 const path = '/api/v1/users/me/subscriptions/' + uri
42 return makeGetRequest({
50 function removeUserSubscription (url: string, token: string, uri: string, statusCodeExpected = 204) {
51 const path = '/api/v1/users/me/subscriptions/' + uri
53 return makeDeleteRequest({
61 function areSubscriptionsExist (url: string, token: string, uris: string[], statusCodeExpected = 200) {
62 const path = '/api/v1/users/me/subscriptions/exist'
64 return makeGetRequest({
67 query: { 'uris[]': uris },
73 // ---------------------------------------------------------------------------
76 areSubscriptionsExist,
78 listUserSubscriptions,
80 listUserSubscriptionVideos,
81 removeUserSubscription