UNPKG

@inweb/client

Version:

JavaScript REST API client for the Open Cloud Server

105 lines (104 loc) 3.46 kB
import { IHttpClient } from "./IHttpClient"; import { Endpoint } from "./Endpoint"; /** * Provides properties and methods for obtaining information about a OAuth 2.0 client that have access * the Open Cloud Server API. */ export declare class OAuthClient extends Endpoint { private _data; /** * @param data - Raw client data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}. * @param httpClient - HTTP client instance used to send requests to the REST API server. */ constructor(data: any, httpClient: IHttpClient); /** * OAuth 2.0 server authorization endpoint. */ get authUrl(): string; /** * OAuth 2.0 server token endpoint. */ get accessTokenUrl(): string; /** * Unique client ID. * * @readonly */ get clientId(): string; /** * Client creation time (UTC) in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. */ get createdAt(): string; /** * Client application description. */ get description(): string; set description(value: string); /** * Client data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}. * * @readonly */ get data(): any; set data(value: any); /** * Client application name. */ get name(): string; set name(value: string); /** * The endpoint to which the OAuth 2.0 server sends the response. */ get redirectUrl(): string; set redirectUrl(value: string); /** * Client secret. * * @readonly */ get secret(): string; /** * Client last update time (UTC) in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. */ get updatedAt(): string; /** * Reloads clien data from the server. */ checkout(): Promise<this>; /** * Updates client data on the server. * * Only administrators can update OAuth clients. If the current logged in user is not an administrator, * an exception will be thrown. * * @param data - Raw client data. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}. */ update(data: any): Promise<this>; /** * Deletes a client from the server. * * Only administrators can delete OAuth clients. If the current logged in user is not an administrator, * an exception will be thrown. * * @returns Returns the raw data of a deleted client. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}. */ delete(): Promise<any>; /** * Saves client properties changes to the server. Call this method to update client data on the server * after any property changes. * * Only administrators can update OAuth clients. If the current logged in user is not an administrator, * an exception will be thrown. */ save(): Promise<this>; /** * Revokes the access tokens for all users of the client application. */ revoke(): Promise<this>; }