From d17aed434c46444e7d351606de79847fa7541822 Mon Sep 17 00:00:00 2001 From: Eric Smekens Date: Mon, 12 Oct 2020 16:06:52 +0200 Subject: [PATCH] Added typings for MediaApi (#376) * Added typings for MediaApi Fixes #361 * Added media to default class export --- typings/index.d.ts | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/typings/index.d.ts b/typings/index.d.ts index f937a880..d1bee091 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -205,11 +205,80 @@ declare module '@vonage/server-sdk' { [key: string]: any; } + /* Media API */ + export interface MediaSearchRequestObject { + order: string; + page_index: number; + page_size: number; + start_time: string; + end_time: string; + } + + export interface MediaLinkObject { + self: { + href: string; + }; + first: { + href: string; + }; + last: { + href: string; + }; + } + + export interface MediaSearchResponseObject { + page_size: number; + page_index: number; + _links: MediaLinkObject; + count: number; + _embedded: { + media: [MediaResponseObject] + }; + } + + + export interface MediaResponseObject { + id: string; + original_file_name: string; + mime_type: string; + account_id: string; + store_id: string; + max_downloads_allowed: number; + times_downloaded: number; + etag: string; + media_size: number; + time_created: string; + time_last_updated: string; + public: boolean; + metadata_primary: string; + metadata_secondary: string; + } + + export interface MediaUpdateRequest { + public: boolean; + metadata_primary: string; + metadata_secondary: string; + title: string; + description: string; + mime_type: string; + max_downloads_allowed: number; + } + + export class Media { + constructor(credentials: CredentialsObject, options: { [key: string]: any }); + search(request: MediaSearchRequestObject, callback: (err: VonageApiError, data: MediaSearchResponseObject) => void): void; + delete(id: string, callback: (err: VonageApiError) => void): void; + get(id: string, callback: (err: VonageApiError, data: MediaResponseObject) => void): void; + update(id: string, request: MediaUpdateRequest, callback: (err: VonageApiError) => void): void; + __proto__: any; + [key: string]: any; + } /* Vonage */ export default class Vonage { constructor(credentials: CredentialsObject, options?: { [key: string]: any }); public readonly verify: Verify; public readonly message: Message; + public readonly media: Media; } }