Move from browser-request
to fetch
(#9345)
This commit is contained in:
parent
ae883bb94b
commit
8b54be6f48
50 changed files with 1474 additions and 607 deletions
|
@ -151,7 +151,7 @@ export class Media {
|
|||
* @param {MatrixClient} client? Optional client to use.
|
||||
* @returns {Media} The media object.
|
||||
*/
|
||||
export function mediaFromContent(content: IMediaEventContent, client?: MatrixClient): Media {
|
||||
export function mediaFromContent(content: Partial<IMediaEventContent>, client?: MatrixClient): Media {
|
||||
return new Media(prepEventContentAsMedia(content), client);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ export interface IMediaEventInfo {
|
|||
}
|
||||
|
||||
export interface IMediaEventContent {
|
||||
msgtype: string;
|
||||
body?: string;
|
||||
filename?: string; // `m.file` optional field
|
||||
url?: string; // required on unencrypted media
|
||||
|
@ -69,7 +70,7 @@ export interface IMediaObject {
|
|||
* @returns {IPreparedMedia} A prepared media object.
|
||||
* @throws Throws if the given content cannot be packaged into a prepared media object.
|
||||
*/
|
||||
export function prepEventContentAsMedia(content: IMediaEventContent): IPreparedMedia {
|
||||
export function prepEventContentAsMedia(content: Partial<IMediaEventContent>): IPreparedMedia {
|
||||
let thumbnail: IMediaObject = null;
|
||||
if (content?.info?.thumbnail_url) {
|
||||
thumbnail = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue