]>
Commit | Line | Data |
---|---|---|
590fb506 | 1 | import { VideoImportCreate } from '../../../../shared/models/videos' |
3e17515e | 2 | import { makeGetRequest, makeUploadRequest } from '..' |
590fb506 C |
3 | |
4 | function getYoutubeVideoUrl () { | |
5 | return 'https://youtu.be/msX3jv1XdvM' | |
6 | } | |
7 | ||
187501f8 C |
8 | function getMagnetURI () { |
9 | // tslint:disable:max-line-length | |
3e17515e | 10 | return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4' |
187501f8 C |
11 | } |
12 | ||
590fb506 C |
13 | function importVideo (url: string, token: string, attributes: VideoImportCreate) { |
14 | const path = '/api/v1/videos/imports' | |
15 | ||
187501f8 C |
16 | let attaches: any = {} |
17 | if (attributes.torrentfile) attaches = { torrentfile: attributes.torrentfile } | |
18 | ||
19 | return makeUploadRequest({ | |
590fb506 C |
20 | url, |
21 | path, | |
22 | token, | |
187501f8 | 23 | attaches, |
590fb506 C |
24 | fields: attributes, |
25 | statusCodeExpected: 200 | |
26 | }) | |
27 | } | |
28 | ||
3e17515e | 29 | function getMyVideoImports (url: string, token: string, sort?: string) { |
590fb506 C |
30 | const path = '/api/v1/users/me/videos/imports' |
31 | ||
3e17515e C |
32 | const query = {} |
33 | if (sort) query['sort'] = sort | |
34 | ||
590fb506 C |
35 | return makeGetRequest({ |
36 | url, | |
3e17515e | 37 | query, |
590fb506 C |
38 | path, |
39 | token, | |
40 | statusCodeExpected: 200 | |
41 | }) | |
42 | } | |
43 | ||
44 | // --------------------------------------------------------------------------- | |
45 | ||
46 | export { | |
47 | getYoutubeVideoUrl, | |
48 | importVideo, | |
187501f8 | 49 | getMagnetURI, |
590fb506 C |
50 | getMyVideoImports |
51 | } |