mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
826364e803
This is part of a rewrite for Dimension to better support integrations. Only the bare minimum scalar APIs are implemented at this point - dimension is non-functional.
25 lines
656 B
TypeScript
25 lines
656 B
TypeScript
import * as Promise from "bluebird";
|
|
import { doFederatedApiCall } from "./helpers";
|
|
|
|
export interface MatrixUrlPreview {
|
|
// This is really the only parameter we care about
|
|
"og:title"?: string;
|
|
}
|
|
|
|
export class MatrixLiteClient {
|
|
|
|
constructor(private homeserverName: string, private accessToken: string) {
|
|
}
|
|
|
|
public getUrlPreview(url: string): Promise<MatrixUrlPreview> {
|
|
return doFederatedApiCall(
|
|
"GET",
|
|
this.homeserverName,
|
|
"/_matrix/media/r0/preview_url",
|
|
{access_token: this.accessToken, url: url}
|
|
).then(response => {
|
|
return response;
|
|
});
|
|
}
|
|
}
|