Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added typings for MediaApi #376

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}