Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Warry committed Mar 13, 2023
1 parent 047f9dd commit 210b6f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 49 deletions.
21 changes: 7 additions & 14 deletions src/nomalab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,25 +442,18 @@ export class Nomalab {
},
): Promise<Response> {
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",
},
);
Expand Down
51 changes: 16 additions & 35 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[];
}

Expand All @@ -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 }[];
Expand Down

0 comments on commit 210b6f5

Please sign in to comment.