matrix-dimension/src-ts/matrix/MatrixLiteClient.ts
Travis Ralston 826364e803 Re-implement the Scalar API in typescript
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.
2017-12-17 19:22:13 -07:00

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;
});
}
}