From 210b6f5a37ae646150506621f0ca3f70176d3782 Mon Sep 17 00:00:00 2001 From: Maxime Dantec Date: Mon, 13 Mar 2023 15:20:59 +0100 Subject: [PATCH] tmp --- src/nomalab.ts | 21 +++++++-------------- src/types.ts | 51 ++++++++++++++++---------------------------------- 2 files changed, 23 insertions(+), 49 deletions(-) diff --git a/src/nomalab.ts b/src/nomalab.ts index a4d2a50..bbdb771 100644 --- a/src/nomalab.ts +++ b/src/nomalab.ts @@ -442,25 +442,18 @@ export class Nomalab { }, ): Promise { const myHeaders = new Headers(); - myHeaders.append( - "Content-Type", - optionalArg.contentType ?? "application/json", - ); - myHeaders.append("Authorization", `Bearer ${this.#apiToken}`); - if (optionalArg.cookieHeader) { - myHeaders.append( - "Cookie", - `sessionJwt=${optionalArg.cookieHeader["sessionJwt"]}`, - ); - } + myHeaders.append("Content-Type", optionalArg.contentType ?? "application/json"); + myHeaders.append("Cookie", `sessionJwt=${this.#apiToken}`); + // myHeaders.append("Authorization", `Bearer ${this.#apiToken} `); + // if (optionalArg.cookieHeader) { + // myHeaders.append("Cookie", `sessionJwt=${optionalArg.cookieHeader["sessionJwt"]}`) + // } const request = new Request( `https://${this.#contextSubDomain()}.nomalab.com/v3/${partialUrl}`, { method: optionalArg.method ?? "GET", headers: myHeaders, - body: (optionalArg.bodyJsonObject === undefined) - ? null - : JSON.stringify(optionalArg.bodyJsonObject), + body: (optionalArg.bodyJsonObject === undefined) ? null : JSON.stringify(optionalArg.bodyJsonObject), credentials: "include", }, ); diff --git a/src/types.ts b/src/types.ts index 4d41f96..86ccc51 100644 --- a/src/types.ts +++ b/src/types.ts @@ -172,26 +172,6 @@ export interface Delivery { transcoding: Transcoding; } -export interface FileClass { - state: string; - stateExpireAt: null; - id: string; - createdAt: string; - name: string; - size: number; - mimeType: null | string; - bucket: string; - key: string; - kind: string; - uploaderId: null | string; - upload: Upload | null; - uploadedAt: null | string; - verification: Verification | null; - sourceId: null | string; - transcoding: Transcoding | null; - format: null; -} - export interface Verification { progress: number; error: null; @@ -761,36 +741,37 @@ export enum BroadcastableFileKind { Extra = "Extra", } -export interface File { + +export interface FileClass { + state: string; + stateExpireAt: string | null; id: string; createdAt: string; name: string; size: number; - mimeType?: string; + mimeType: null | string; bucket: string; key: string; - kind: Kind; - uploaderId?: string; + kind: string; + uploaderId: null | string; upload: Upload | null; - uploadedAt?: string; + uploadedAt: null | string; verification: Verification | null; - sourceId?: string; + sourceId: null | string; transcoding: Transcoding | null; - state: State; - stateExpireAt?: string; - format: Formats.Format | null; + format: Formats.Format; } export interface ExtraApi { - file: File; - proxy: File | null; + file: FileClass; + proxy: FileClass | null; segments: FileSegment[]; container: FileContainer | null; streams: FileStream[]; } export interface FileUploads { - uploads: File[]; + uploads: FileClass[]; parts: UploadPart[]; } @@ -817,12 +798,12 @@ export interface NewFile { } export interface BroadcastableApi { - file: File; + file: FileClass; container: FileContainer | null; streams: FileStream[]; proxies: Proxies; - reportXml: File | null; - reportPdf: File | null; + reportXml: FileClass | null; + reportPdf: FileClass | null; deliveries: Delivery[]; segments: FileSegment[]; subtitleWarnings: { name: string; timecode: string }[];