@knora/api
Version:
JavaScript library that handles API requests to Knora
31 lines (30 loc) • 1.35 kB
TypeScript
import { Observable } from "rxjs";
import { ApiResponseData } from "../../../models/api-response-data";
import { ApiResponseError } from "../../../models/api-response-error";
import { CredentialsResponse } from "../../../models/v2/authentication/credentials-response";
import { LoginResponse } from "../../../models/v2/authentication/login-response";
import { LogoutResponse } from "../../../models/v2/authentication/logout-response";
import { Endpoint } from "../../endpoint";
/**
* Handles requests to the authentication route of the Knora API.
*/
export declare class AuthenticationEndpoint extends Endpoint {
/**
* Logs in a user.
*
* @param property The name of the property by which the user is identified.
* @param id the given user.
* @param password the user's password.
*/
login(property: "iri" | "email" | "username", id: string, password: string): Observable<ApiResponseData<LoginResponse> | ApiResponseError>;
/**
* Logs out the user and destroys the session on the server- and client-side.
*/
logout(): Observable<ApiResponseData<LogoutResponse> | ApiResponseError>;
/**
* Checks credentials.
*
* Returns a `ApiResponseError` if the client is not authorized.
*/
checkCredentials(): Observable<ApiResponseData<CredentialsResponse> | ApiResponseError>;
}