Skip to content

Commit

Permalink
Added typings for MediaApi (#376)
Browse files Browse the repository at this point in the history
* Added typings for MediaApi

Fixes #361

* Added media to default class export
  • Loading branch information
EricSmekens authored Oct 12, 2020
1 parent 6146237 commit d17aed4
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit d17aed4

Please sign in to comment.