mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-17 11:32:27 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { YTNode } from '../../helpers.js';
|
|
import type { CreatePlaylistServiceRequest, IEndpoint, RawNode } from '../../index.js';
|
|
|
|
export default class CreatePlaylistServiceEndpoint extends YTNode implements IEndpoint<CreatePlaylistServiceRequest> {
|
|
static type = 'CreatePlaylistServiceEndpoint';
|
|
|
|
#API_PATH = 'playlist/create';
|
|
#data: RawNode;
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
this.#data = data;
|
|
}
|
|
|
|
public getApiPath(): string {
|
|
return this.#API_PATH;
|
|
}
|
|
|
|
public buildRequest(): CreatePlaylistServiceRequest {
|
|
const request: CreatePlaylistServiceRequest = {};
|
|
|
|
if (this.#data.title)
|
|
request.title = this.#data.title;
|
|
|
|
if (this.#data.privacyStatus)
|
|
request.privacyStatus = this.#data.privacyStatus;
|
|
|
|
if (this.#data.description)
|
|
request.description = this.#data.description;
|
|
|
|
if (this.#data.videoIds)
|
|
request.videoIds = this.#data.videoIds;
|
|
|
|
if (this.#data.params)
|
|
request.params = this.#data.params;
|
|
|
|
if (this.#data.sourcePlaylistId)
|
|
request.sourcePlaylistId = this.#data.sourcePlaylistId;
|
|
|
|
return request;
|
|
}
|
|
} |