Add additional types, mainly for subscriptions

pull/218/head
Tiger Oakes 5 years ago
parent b667e1dc79
commit 62c79c267e

@ -184,14 +184,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_5' $ref: '#/components/schemas/SubscribeRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_6' $ref: '#/components/schemas/SubscribeResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/unsubscribe: /api/unsubscribe:
@ -205,14 +205,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_6' $ref: '#/components/schemas/UnsubscribeRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_7' $ref: '#/components/schemas/UnsubscribeResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/deleteSubscriptionFile: /api/deleteSubscriptionFile:
@ -226,14 +226,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_7' $ref: '#/components/schemas/DeleteSubscriptionFileRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_8' $ref: '#/components/schemas/SuccessObject'
'500': '500':
description: Internal Server Error description: Internal Server Error
security: security:
@ -249,14 +249,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_8' $ref: '#/components/schemas/GetSubscriptionRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_9' $ref: '#/components/schemas/GetSubscriptionResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/downloadVideosForSubscription: /api/downloadVideosForSubscription:
@ -270,14 +270,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_9' $ref: '#/components/schemas/DownloadVideosForSubscriptionRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_10' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/getAllSubscriptions: /api/getAllSubscriptions:
@ -297,7 +297,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_11' $ref: '#/components/schemas/GetAllSubscriptionsResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/createPlaylist: /api/createPlaylist:
@ -360,7 +360,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/deletePlaylist: /api/deletePlaylist:
@ -457,6 +457,8 @@ paths:
responses: responses:
'200': '200':
description: The archive text file is sent as a response description: The archive text file is sent as a response
'404':
description: If the archive dir is not found, 404 is sent as a response
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/updaterStatus: /api/updaterStatus:
@ -1094,16 +1096,11 @@ components:
$ref: '#/components/schemas/FileType' $ref: '#/components/schemas/FileType'
is_playlist: is_playlist:
type: boolean type: boolean
inline_response_200_5: SubscribeRequest:
required:
- success
type: object
properties:
success:
type: boolean
body_5:
required: required:
- name
- url - url
- streamingOnly
type: object type: object
properties: properties:
name: name:
@ -1114,46 +1111,32 @@ components:
type: string type: string
streamingOnly: streamingOnly:
type: boolean type: boolean
inline_response_200_6: audioOnly:
type: boolean
customArgs:
type: string
customFileOutput:
type: string
SubscribeResponse:
required: required:
- new_sub - new_sub
type: object type: object
properties: properties:
new_sub: new_sub:
$ref: '#/components/schemas/inline_response_200_6_new_sub' $ref: '#/components/schemas/Subscription'
error: error:
type: string type: string
apiunsubscribe_sub: UnsubscribeRequest:
required:
- id
- name
- url
- videos
type: object
properties:
name:
type: string
url:
type: string
id:
type: string
streamingOnly:
type: boolean
videos:
type: array
items:
type: object
body_6:
required: required:
- sub - sub
type: object type: object
properties: properties:
sub: sub:
$ref: '#/components/schemas/apiunsubscribe_sub' $ref: '#/components/schemas/SubscriptionRequestData'
deleteMode: deleteMode:
type: boolean type: boolean
description: Defaults to false description: Defaults to false
inline_response_200_7: UnsubscribeResponse:
required: required:
- success - success
type: object type: object
@ -1162,30 +1145,7 @@ components:
type: boolean type: boolean
error: error:
type: string type: string
apideleteSubscriptionFile_sub: DeleteSubscriptionFileRequest:
required:
- id
- isPlaylist
- name
- url
- videos
type: object
properties:
name:
type: string
url:
type: string
id:
type: string
streamingOnly:
type: boolean
isPlaylist:
type: boolean
videos:
type: array
items:
type: object
body_7:
required: required:
- file - file
- sub - sub
@ -1193,50 +1153,41 @@ components:
properties: properties:
file: file:
type: string type: string
file_uid:
type: string
sub: sub:
$ref: '#/components/schemas/apideleteSubscriptionFile_sub' $ref: '#/components/schemas/SubscriptionRequestData'
deleteForever: deleteForever:
type: boolean type: boolean
description: 'If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings.' description: 'If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings.'
inline_response_200_8: GetSubscriptionRequest:
type: object
properties:
success:
type: boolean
body_8:
required: required:
- subID - id
type: object type: object
properties: properties:
subID: id:
type: string type: string
inline_response_200_9: description: Subscription ID
GetSubscriptionResponse:
required: required:
- files - files
- subscription - subscription
type: object type: object
properties: properties:
subscription: subscription:
$ref: '#/components/schemas/inline_response_200_9_subscription' $ref: '#/components/schemas/Subscription'
files: files:
type: array type: array
items: items:
type: object type: object
body_9: DownloadVideosForSubscriptionRequest:
required: required:
- subID - subID
type: object type: object
properties: properties:
subID: subID:
type: string type: string
inline_response_200_10: GetAllSubscriptionsResponse:
required:
- success
type: object
properties:
success:
type: number
inline_response_200_11:
required: required:
- subscriptions - subscriptions
type: object type: object
@ -1244,7 +1195,7 @@ components:
subscriptions: subscriptions:
type: array type: array
items: items:
$ref: '#/components/schemas/inline_response_200_11_subscriptions' $ref: '#/components/schemas/Subscription'
body_10: body_10:
required: required:
- fileNames - fileNames
@ -1356,20 +1307,18 @@ components:
type: string type: string
type: type:
$ref: '#/components/schemas/FileType' $ref: '#/components/schemas/FileType'
apidownloadArchive_sub: DownloadArchiveRequest:
required:
- archive_dir
type: object
properties:
archive_dir:
type: string
body_17:
required: required:
- sub - sub
type: object type: object
properties: properties:
sub: sub:
$ref: '#/components/schemas/apidownloadArchive_sub' required:
- archive_dir
type: object
properties:
archive_dir:
type: string
inline_response_200_14: inline_response_200_14:
required: required:
- details - details
@ -1541,30 +1490,32 @@ components:
type: array type: array
items: items:
type: string type: string
inline_response_200_6_new_sub: SubscriptionRequestData:
required: required:
- id - id
- name - name
- url
type: object type: object
properties: properties:
name: name:
type: string type: string
url:
type: string
id: id:
type: string type: string
streamingOnly: type:
$ref: '#/components/schemas/FileType'
isPlaylist:
type: boolean type: boolean
timerange: archive:
type: string type: string
inline_response_200_9_subscription: Subscription:
required: required:
- archive
- id - id
- isPlaylist
- name - name
- url - url
- type
- user_uid
- streamingOnly
- isPlaylist
- videos
type: object type: object
properties: properties:
name: name:
@ -1573,34 +1524,27 @@ components:
type: string type: string
id: id:
type: string type: string
type:
$ref: '#/components/schemas/FileType'
user_uid:
type: string
nullable: true
streamingOnly: streamingOnly:
type: boolean type: boolean
isPlaylist: isPlaylist:
type: boolean type: boolean
archive: archive:
type: string type: string
inline_response_200_11_subscriptions: timerange:
required:
- archive
- id
- isPlaylist
- name
- streamingOnly
- url
type: object
properties:
name:
type: string
url:
type: string type: string
id: custom_args:
type: string type: string
streamingOnly: custom_output:
type: boolean
isPlaylist:
type: boolean
archive:
type: string type: string
videos:
type: array
items:
type: object
inline_response_200_12_new_playlist: inline_response_200_12_new_playlist:
required: required:
- fileNames - fileNames

@ -10,10 +10,32 @@ import { DOCUMENT } from '@angular/common';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import * as Fingerprint2 from 'fingerprintjs2'; import * as Fingerprint2 from 'fingerprintjs2';
import type { DeleteMp3Mp4Request, FileType, GetAllFilesResponse, GetFileRequest, GetFileResponse, GetMp3sResponse, GetMp4sResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse } from 'api-types'; import {
import { GetAllDownloadsResponse } from 'api-types/models/GetAllDownloadsResponse'; DeleteMp3Mp4Request,
import { GetDownloadResponse } from 'api-types/models/GetDownloadResponse'; DeleteSubscriptionFileRequest,
import { GetDownloadRequest } from 'api-types/models/GetDownloadRequest'; FileType,
GetAllDownloadsResponse,
GetAllFilesResponse,
GetAllSubscriptionsResponse,
GetDownloadResponse,
GetDownloadRequest,
GetFileRequest,
GetFileResponse,
GetMp3sResponse,
GetMp4sResponse,
GetSubscriptionRequest,
GetSubscriptionResponse,
Mp3DownloadRequest,
Mp3DownloadResponse,
Mp4DownloadRequest,
Mp4DownloadResponse,
SubscribeRequest,
SubscribeResponse,
SubscriptionRequestData,
SuccessObject,
UnsubscribeRequest,
UnsubscribeResponse
} from 'api-types';
@Injectable() @Injectable()
export class PostsService implements CanActivate { export class PostsService implements CanActivate {
@ -306,30 +328,34 @@ export class PostsService implements CanActivate {
return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type}, this.httpOptions); return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type}, this.httpOptions);
} }
createSubscription(url, name, timerange = null, streamingOnly = false, audioOnly = false, customArgs = null, customFileOutput = null) { createSubscription(url: string, name: string, timerange: string = null, streamingOnly = false, audioOnly = false, customArgs: string = null, customFileOutput: string = null) {
return this.http.post(this.path + 'subscribe', {url: url, name: name, timerange: timerange, streamingOnly: streamingOnly, const body: SubscribeRequest = {url: url, name: name, timerange: timerange, streamingOnly: streamingOnly,
audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput}, this.httpOptions); audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput};
return this.http.post<SubscribeResponse>(this.path + 'subscribe', body, this.httpOptions);
} }
updateSubscription(subscription) { updateSubscription(subscription) {
return this.http.post(this.path + 'updateSubscription', {subscription: subscription}, this.httpOptions); return this.http.post(this.path + 'updateSubscription', {subscription: subscription}, this.httpOptions);
} }
unsubscribe(sub, deleteMode = false) { unsubscribe(sub: SubscriptionRequestData, deleteMode = false) {
return this.http.post(this.path + 'unsubscribe', {sub: sub, deleteMode: deleteMode}, this.httpOptions) const body: UnsubscribeRequest = {sub: sub, deleteMode: deleteMode};
return this.http.post<UnsubscribeResponse>(this.path + 'unsubscribe', body, this.httpOptions)
} }
deleteSubscriptionFile(sub, file, deleteForever, file_uid) { deleteSubscriptionFile(sub: SubscriptionRequestData, file: string, deleteForever: boolean, file_uid: string) {
return this.http.post(this.path + 'deleteSubscriptionFile', {sub: sub, file: file, deleteForever: deleteForever, const body: DeleteSubscriptionFileRequest = {sub: sub, file: file, deleteForever: deleteForever,
file_uid: file_uid}, this.httpOptions) file_uid: file_uid};
return this.http.post<SuccessObject>(this.path + 'deleteSubscriptionFile', body, this.httpOptions)
} }
getSubscription(id) { getSubscription(id: string) {
return this.http.post(this.path + 'getSubscription', {id: id}, this.httpOptions); const body: GetSubscriptionRequest = {id: id};
return this.http.post<GetSubscriptionResponse>(this.path + 'getSubscription', body, this.httpOptions);
} }
getAllSubscriptions() { getAllSubscriptions() {
return this.http.post(this.path + 'getAllSubscriptions', {}, this.httpOptions); return this.http.post<GetAllSubscriptionsResponse>(this.path + 'getAllSubscriptions', {}, this.httpOptions);
} }
// current downloads // current downloads

Loading…
Cancel
Save