/// declare module CSCoreSDK { /** * @export * @class CSSDKError */ export class CSSDKError { constructor(message?: any, payload?: any); } /** * @export * @class WebApiError * @extends {CSSDKError} */ export class WebApiError extends CSSDKError { constructor(message?: any, payload?: any); getStatusCode(): number; } /** * @export * @class ConfigurationError * @extends {CSSDKError} */ export class ConfigurationError extends CSSDKError { constructor(message?: any, payload?: any); } } declare module CSCoreSDK { /** * Environment object that specifies communication endpoints for the SDK * @export * @class Environment */ export class Environment { /** * Sandbox environment. This is the default one. Use it for development. */ static Sandbox: Environment; /** * Production environment of CSAS. Use it in production with production API Key. */ static Production: Environment; /** * Base URL path. Start of API context */ apiContextBaseUrl: string; /** Base URL path for OAuth2 authentication. */ oAuth2ContextBaseUrl: string; /** * Creates new Environment instance * * @param apiContextBaseUrl Base URL path. Start of API context * @param oAuth2ContextBaseUrl Base URL path for OAuth2 authentication. */ constructor(apiContextBaseUrl: string, oAuth2ContextBaseUrl: string); } } declare module CSCoreSDK { /** * Configuration of SDK * @export * @class WebApiConfiguration */ export class WebApiConfiguration { /** * WebApi key to use */ webApiKey: string; /** * Language to use. Defaults to 'cs-CZ' */ language: string; /** * Signing key for request signing. It is not set by default. */ signingKey: string; /** * Environment to use. Default is Sandbox environment */ environment: Environment; /** * Oath2 configuration. It is not set by default. */ oauth2: Oauth2Config; /** * Copies the configuration. * @returns {WebApiConfiguration} * * @memberOf WebApiConfiguration */ copy(): WebApiConfiguration; } /** * Configuration of oAuth2 * @export * @interface Oauth2Config */ export interface Oauth2Config { /** * ID of the client */ clientId: string; /** * secret of the client */ clientSecret?: string; /** * URI where client will be redirected upon logging in */ redirectUri?: string; } } declare module CSCoreSDK { /** * @export * @class Signer */ export class Signer { private _apiKey; private _privateKey; /** * Creates an instance of Signer. * @param {string} apiKey * @param {string} privateKey * * @memberOf Signer */ constructor(apiKey: string, privateKey: string); /** * @returns {string} * * @memberOf Signer */ generateNonce(): string; /** * @param {string} url * @param {string} data * @param {string} nonce * @returns {string} * * @memberOf Signer */ generateSignatureForRequest(url: string, data: string, nonce: string): string; /** * @param {string} url * @param {string} data * @param {object} headers * * @memberOf Signer */ signRequest(url: string, data: string, headers: any): void; /** * @param {any} url * @returns {string} * * @memberOf Signer */ stripServer(url: any): string; } } declare module CSCoreSDK { /** * @export * @interface CallOptions */ export interface CallOptions { url: string; method?: string; params?: any; data?: any; } /** * @export * @interface Response */ export interface Response { data?: any; status?: number; headers?: any; config?: any; } /** * @export * @abstract * @class WebApiClient * @implements {PathSegment} */ export abstract class WebApiClient implements PathSegment { config: WebApiConfiguration; sharedContext: WebApiContext; private apiBasePath; static GlobalRequestHeaders: any; /** * Creates an instance of WebApiClient. * @param {WebApiConfiguration} config * @param {string} basePath * * @memberOf WebApiClient */ constructor(config: WebApiConfiguration, basePath: string); /** * Returns Base URL for all resources in this client. * @returns {string} * * @memberOf WebApiClient */ getPath(): string; /** * Prepares request for API call * @param {string} url * @param {string} method * @param {any=} params * @param {any=} data * @param {any=} headers * @param {string} [responseType] * @returns {Promise} * * @memberOf WebApiClient */ callApi(url: string, method: string, params?: any, data?: any, headers?: any, responseType?: string): Promise; /** * @private * @param {string} url * @param {string} method * @param {any=} params * @param {any=} data * @param {any=} headers * @param {string=} responseType * @returns {any} * * @memberOf WebApiClient */ private makeCall(url, method, params?, data?, headers?, responseType?); private _ensureRightConfiguration; } /** * @export * @interface PathSegment */ export interface PathSegment { /** * @returns {string} * * @memberOf PathSegment */ getPath(): string; } } declare module CSCoreSDK { /** * @export * @class AccessTokenProvider * @implements {AccessTokenProviderInterface} */ export class AccessTokenProvider implements AccessTokenProviderInterface { private token; private client; private code; private secret; /** * Set access token given in initialization * @param {WebApiConfiguration} config */ constructor(config: WebApiConfiguration); /** * Set token and expiration properties of a given tokeng * @param {AccessToken|string} token * @returns {void} */ useAccessToken(token: AccessToken | string): void; /** * @param {string} code */ useCode(code: string): void; /** * @returns {string} */ getCode(): string; /** * @returns {Promise} */ getAccessToken(): Promise; /** * Refresh access token and return it in promise * @returns {Promise} */ refreshAccessToken(): Promise; /** * Helper method to join and encode data * @private * @param {any} data * @returns {string} */ private joinAndEncodeData(data); } /** * @export * @interface AccessTokenProviderInterface */ export interface AccessTokenProviderInterface { /** * Returns access token */ getAccessToken(): Promise; /** * Calls the API in order to refresh token and returns */ refreshAccessToken(): Promise; /** * Sets access token on */ useAccessToken(token: AccessToken | string): void; useCode(string: any): void; getCode(): string; } /** * @export * @interface AccessToken */ export interface AccessToken { token: string; expiresIn: number; tokenType: string; refreshToken?: string; } /** * @export * @class AccessTokenProviderClient * @extends {WebApiClient} */ export class AccessTokenProviderClient extends WebApiClient { constructor(config: any); } } declare module CSCoreSDK { /** * @export * @class OauthProvider * @implements {OathInterface} */ export class OauthProvider implements OathInterface { accessTokenProvider: AccessTokenProvider; config: WebApiConfiguration; /** * Creates an instance of OauthProvider. * @param {AccessTokenProvider} accessTokenProvider * @param {WebApiConfiguration} config * * @memberOf OauthProvider */ constructor(accessTokenProvider: AccessTokenProvider, config: WebApiConfiguration); /** * Returns url for authentication based on provided config * @returns {string} * * @memberOf OauthProvider */ getOauth2Url(): string; /** * Parses callback uri and extracts information that is used for requesting access token * * @param {string} url * @returns {Promise} * * @memberOf OauthProvider */ processRedirect(url: string): Promise; } /** * @export * @interface OathInterface */ export interface OathInterface { getOauth2Url(): string; processRedirect(url: string): any; } } declare module CSCoreSDK { /** * @export * @class WebApiContext * @implements {AccessTokenProviderInterface} * @implements {OathInterface} */ export class WebApiContext implements AccessTokenProviderInterface, OathInterface { accessTokenProvider: AccessTokenProvider; oauthProvider: OauthProvider; /** * Delegate getAccessToken call to accessTokenProvider if there is any * @returns {Promise} * * @memberOf WebApiContext */ getAccessToken(): Promise; /** * Delegate refreshAccessToken call to accessTokenProvider if there is any * @returns {Promise} * * @memberOf WebApiContext */ refreshAccessToken(): Promise; /** * Returns login url to CSAS MEP in string * @returns {string} * * @memberOf WebApiContext */ getOauth2Url(): string; /** * Extracts access token from redirect url and sets it on AccessTokenProvider * @param {string} url * @returns {Promise} * * @memberOf WebApiContext */ processRedirect(url: string): Promise; /** * Set AccessToken on AccessTokenProvider * @param {(AccessToken | string)} token * @returns {void} * * @memberOf WebApiContext */ useAccessToken(token: AccessToken | string): void; /** * Set code on accessTokenProvider that is used for retrieving access token if you are using Authorization Code grant type * @param {string} code * @returns {void} * * @memberOf WebApiContext */ useCode(code: string): void; /** * Returns code on accessTokenProvider that is used for retrieving access token if you are using Authorization Code grant type * @returns {string} * * @memberOf WebApiContext */ getCode(): string; /** * Ensure that accessTokenProvider is set * @private * @returns {void} * * @memberOf WebApiContext */ private _ensureRightConfiguration(); } } declare module CSCoreSDK { } declare module CSCoreSDK { /** * @export * @class ListResponseStructure * @implements {ListResponse} * @template T */ export class ListResponseStructure implements ListResponse { /** * @type {T[]} * @memberOf ListResponseStructure */ items: T[]; } export class PaginatedListResponseStructure implements PaginatedListResponse { /** * Information about pagination * @type {Pagination} * @memberOf PaginatedListResponseStructure */ pagination: Pagination; /** * Items in list * * @type {T[]} * @memberOf PaginatedListResponseStructure */ items: T[]; /** * Returns a promise that resolves into next page of results * @returns {Promise>} * * @memberOf PaginatedListResponseStructure */ nextPage: () => Promise>; /** * Returns a promise that resolves into previous page of results * @returns {Promise>} * * @memberOf PaginatedListResponseStructure */ prevPage: () => Promise>; } /** * @export * @interface Pagination */ export interface Pagination { /** * Current page number * @type {number} * @memberOf Pagination */ pageNumber: number; /** * Number of items per page * @type {number} * @memberOf Pagination */ pageSize: number; /** * Number of pages * @type {number} * @memberOf Pagination */ pageCount: number; /** * Next page number * @type {number} * @memberOf Pagination */ nextPage: number; /** * Previous page number * @type {number} * @memberOf Pagination */ prevPage: number; /** * Whether there is next page available * @type {boolean} * @memberOf Pagination */ hasNextPage: boolean; /** * Whether there is previous page available * @type {boolean} * @memberOf Pagination */ hasPrevPage: boolean; } /** * List of non-paginated items. * @export * @interface ListResponse * @template T */ export interface ListResponse { /** * Items in list * @type {T[]} * @memberOf ListResponse */ items: T[]; } /** * List of paginated items * @export * @interface PaginatedListResponse * @extends {ListResponse} * @template T */ export interface PaginatedListResponse extends ListResponse { /** * Information about pagination * * @type {ResponsePagination} * @memberOf PaginatedListResponse */ pagination: ResponsePagination; /** * Returns a promise that resolves into next page of results * @returns {Promise>} * * @memberOf PaginatedListResponse */ nextPage: () => Promise>; /** * Returns a promise that resolves into previous page of results * @returns {Promise>} * * @memberOf PaginatedListResponse */ prevPage: () => Promise>; } export enum Order { ASCENDING = "asc", DESCENDING = "desc", } /** * @export * @interface Sortable */ export interface Sortable { sort?: T | T[] | string | string[]; order?: Order | Order[] | string | string[]; } export interface Paginated { pageNumber: number; pageSize: number; } export interface ResponsePagination { /** * Current page number */ pageNumber: number; /** * Number of items per page */ pageSize: number; /** * Number of pages */ pageCount: number; /** * Next page number */ nextPage: number; /** * Prev page number */ prevPage: number; /** * Whether there is next page available */ hasNextPage: boolean; /** * Whether there is previous page available */ hasPrevPage: boolean; } } declare module CSCoreSDK { /** * @export * @abstract * @class Resource * @implements {PathSegment} */ export abstract class Resource implements PathSegment { protected _client: WebApiClient; protected _path: string; /** * Creates an instance of Resource. * @param {string} basePath * @param {WebApiClient} client * * @memberOf Resource */ constructor(basePath: string, client: WebApiClient); /** * Returns the associated WebApiClient * @returns {WebApiClient} * * @memberOf Resource */ getClient(): WebApiClient; /** * Returns current URL path * @returns {string} * * @memberOf Resource */ getPath(): string; /** * @protected * @param {string} appendix * @returns {string} * * @memberOf Resource */ protected pathAppendedWith(appendix: string): string; /** * @protected * @param {any=} params * @returns {Promise} * * @memberOf Resource */ protected _get(params?: any): Promise; /** * @protected * @param {string} pathSuffix * @param {any=} params * @returns {Promise} * * @memberOf Resource */ protected _getWithSuffix(pathSuffix: string, params?: any): Promise; } } declare module CSCoreSDK { /** * @export * @abstract * @class InstanceResource * @extends {Resource} */ export abstract class InstanceResource extends Resource { protected _id: any; /** * Creates an instance of InstanceResource. * @param {any} id * @param {string} basePath * @param {WebApiClient} client * * @memberOf InstanceResource */ constructor(id: any, basePath: string, client: WebApiClient); /** * Returns id of the WebApi entity this instance resource represents * @readonly * @type {any} * @memberOf InstanceResource */ readonly id: any; /** * Returns utl path of this instance resource * @returns {string} * * @memberOf InstanceResource */ getPath(): string; } } declare module CSCoreSDK { /** * @export * @class FilledSigningObject * @extends {SigningObject} */ export class FilledSigningObject extends SigningObject { authorizationType: string; scenarios: [[string]]; /** * Creates an instance of FilledSigningObject. * @param {GetInfoResponse} response * @param {WebApiClient} client * @param {string} url * @param {any} order * * @memberOf FilledSigningObject */ constructor(response: GetInfoResponse, client: WebApiClient, url: string, order: any); /** * Returns itself in Promise. * @returns {Promise} * * @memberOf FilledSigningObject */ getInfo: () => Promise; /** * Starts signing process with TAC (that usually means signing using OneTimePassword from SMS) * This method will inform the API that the client will sign using TAC. * Returned 'TACSigningProcess' is used to finish the signing or throws Error if the call fails * @returns {Promise} * * @memberOf FilledSigningObject */ startSigningWithTac: () => Promise; /** * Starts signing process with CASE_MOBILE (that usually means signing using OneTimePassword from SMS) * This method will inform the API that the client will sign using CASE_MOBILE. * Returned 'CaseMobileSigningProcess' is used to finish the signing or throws Error if the call fails * @returns {Promise} * * @memberOf FilledSigningObject */ startSigningWithCaseMobile: () => Promise; /** * Starts signing process with NO_AUTHORIZATION (that usually means signing the order just by clicking some button in UI) * This method signalizes the intent to the API that this order will be signed using NO_AUTHORIZATION method * Returned 'NoAuthSigningProcess' is used to finish the signing or throws Error if the call fails * @returns {Promise} * * @memberOf FilledSigningObject */ startSigningWithNoAuthorization: () => Promise; /** * Determines whether the signing can be currently done with the given AuthorizationType. * @param {string} authorizationType * @returns {boolean} * * @memberOf FilledSigningObject */ canBeSignedWith: (authorizationType: string) => boolean; /** * List all current possible authorization types. The list will be empty if the entity is not in a signable state. * @returns {string[]} * * @memberOf FilledSigningObject */ getPossibleAuthorizationTypes: () => string[]; } /** * @export * @interface GetInfoResponse */ export interface GetInfoResponse { authorizationType: string; scenarios: [[string]]; signInfo: { state: string; signId: string; }; } } declare module CSCoreSDK { /** * * * @export * @class SigningProcess */ export class SigningProcess { signingObject: SigningObject; protected requestSigner: RequestSigner; /** * Creates an instance of SigningProcess. * @param {RequestSigner} requestSigner * @param {SigningObject} signingObject * * @memberOf SigningProcess */ constructor(requestSigner: RequestSigner, signingObject: SigningObject); } /** * @export * @class TacSigningProcess * @extends {SigningProcess} */ export class TacSigningProcess extends SigningProcess { /** * Creates an instance of TacSigningProcess. * @param {RequestSigner} requestSigner * @param {SigningObject} signingObject * * @memberOf TacSigningProcess */ constructor(requestSigner: RequestSigner, signingObject: SigningObject); /** * Finishes signing process with TAC (that usually means signing using OneTimePassword from SMS) * You can call this method only if you successfully called `startSigningWithTac` before. * @param {string} oneTimePassword * @returns {Promise} * * @memberOf TacSigningProcess */ finishSigning: (oneTimePassword: string) => Promise; } /** * @export * @class CaseMobileSigningProcess * @extends {SigningProcess} */ export class CaseMobileSigningProcess extends SigningProcess { /** * Creates an instance of CaseMobileSigningProcess. * @param {RequestSigner} requestSigner * @param {SigningObject} signingObject * * @memberOf CaseMobileSigningProcess */ constructor(requestSigner: RequestSigner, signingObject: SigningObject); /** * Finishes signing process with CASE_MOBILE (that usually means signing using OneTimePassword from SMS) * You can call this method only if you successfully called `startSigningWithCaseMobile` before. * @param {string} oneTimePassword * @returns {Promise} * * @memberOf CaseMobileSigningProcess */ finishSigning: (oneTimePassword: string) => Promise; } /** * @export * @class NoAuthSigningProcess * @extends {SigningProcess} */ export class NoAuthSigningProcess extends SigningProcess { /** * Creates an instance of NoAuthSigningProcess. * @param {RequestSigner} requestSigner * @param {SigningObject} signingObject * * @memberOf NoAuthSigningProcess */ constructor(requestSigner: RequestSigner, signingObject: SigningObject); /** * Finishes signing process using NO_AUTHORIZATION method * You can call this method only if you successfully called `startSigningWithNoAuthorization` before. * @returns {Promise} * * @memberOf NoAuthSigningProcess */ finishSigning: () => Promise; } } declare module CSCoreSDK { /** * @export * @class RequestSigner */ export class RequestSigner { private client; private url; /** * Creates an instance of RequestSigner. * @param {WebApiClient} client * @param {string} url * * @memberOf RequestSigner */ constructor(client: WebApiClient, url: string); /** * Obtains current signing info with full details from the API. * @param {string} signId * @param {Signable} order * * @memberOf RequestSigner */ getSigningInfo: (signId: string, order: Signable) => Promise; /** * Starts signing process with TAC (that usually means signing using OneTimePassword from SMS) * This method will inform the API that the client will sign using TAC. * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ startSigningWithTac: (signId: string) => Promise; /** * Starts signing process with CASE_MOBILE (that usually means signing using OneTimePassword from SMS) * This method will inform the API that the client will sign using CASE_MOBILE. * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ startSigningWithCaseMobile: (signId: string) => Promise; /** * Starts signing process with NO_AUTHORIZATION (that usually means signing the order just by clicking some button in UI) * This method signalizes the intent to the API that this order will be signed using NO_AUTHORIZATION method * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ startSigningWithNoAuthorization: (signId: string) => Promise; /** * Finishes signing process with TAC (that usually means signing using OneTimePassword from SMS) * You can call this method only if you successfully called `startSigningWithTAC` before. * @param {string} oneTimePassword * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ finishSigningWithTac: (oneTimePassword: string, signId: string) => Promise; /** * Finishes signing process with CASE_MOBILE (that usually means signing using OneTimePassword from SMS) * You can call this method only if you successfully called `startSigningWithCaseMobile` before. * @param {string} oneTimePassword * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ finishSigningWithCaseMobile: (oneTimePassword: string, signId: string) => Promise; /** * This method signalizes the API that the user confirmed signing the order by consent (usually by clicking some button in the UI). * You can call this method only if you successfully called `startSigningWithNoAuthorization` before. * @param {string} signId * @returns {Promise} * * @memberOf RequestSigner */ finishSigningWithNoAuth: (signId: string) => Promise; } } declare module CSCoreSDK { /** * @export * @class SigningObject */ export class SigningObject { state: string; signId: string; order: Signable; protected requestSigner: RequestSigner; /** * Creates an instance of SigningObject. * @param {any} order * @param {WebApiClient} client * @param {string} url * * @memberOf SigningObject */ constructor(order: any, client: WebApiClient, url: string); /** * Obtains current signing info with full details from the API. This method always fetches fresh `FilledSigningObject` from the API. * @returns {Promise} * * @memberOf SigningObject */ refreshSigningInfo: () => Promise; /** * Obtains current signing info with full details from the API OR it returns itself if this signing object is already a `FilledSigningObject` * @returns {Promise} * * * @memberOf SigningObject */ getInfo: () => Promise; /** * Returns true or false based on state property * @returns {boolean} * * @memberOf SigningObject */ isDone: () => boolean; /** * Returns true or false based on state property * @returns {boolean} * * @memberOf SigningObject */ isOpen: () => boolean; /** * Returns true or false based on state property * @returns {boolean} * * @memberOf SigningObject */ isCanceled: () => boolean; } } declare module CSCoreSDK { /** * Marks Resource or Entity that supports .get Verb. * @export * @interface GetEnabled * @template TResponse */ export interface GetEnabled { /** * Makes a GET call to WebApi and returns a `TResponse` back. * @returns {Promise} * * @memberOf GetEnabled */ get: () => Promise; } /** * Marks Resource or Entity that supports .get verb with parameters. * @export * @interface ParametrizedGetEnabled * @template TParameters * @template TResponse */ export interface ParametrizedGetEnabled { /** * Makes a GET call to WebApi and returns a `TResponse` back. * @param {TParameters} parameters * @returns {Promise} * * @memberOf ParametrizedGetEnabled */ get: (parameters: TParameters) => Promise; } /** * Marks Resource or Entity that returns InstanceResource through .withId call * @export * @interface HasInstanceResource * @template T */ export interface HasInstanceResource { /** * Get an instance resource with a given id. * note: This method does not make any calls to the WebApi by itself. * Use other methods, such as `.get()` on the returned `InstanceResource` to make the call. * @param {any} id * @returns {T} * * @memberOf HasInstanceResource */ withId: (id: any) => T; } /** * Marks Resource or Entity that supports .create verb * @export * @interface CreateEnabled * @template TRequest * @template TResponse */ export interface CreateEnabled { /** * Makes a POST call to WebApi and returns a `TResponse` returned from server. * @param {TRequest} request * @returns {Promise} * * @memberOf CreateEnabled */ create: (request: TRequest) => Promise; } /** * Marks Resource or Entity that supports .create verb without body payload * @export * @interface EmptyCreateEnabled * @template TResponse */ export interface EmptyCreateEnabled { /** * Makes a POST call to WebApi and returns a `TResponse` returned from server. * @returns {Promise} * * @memberOf EmptyCreateEnabled */ create: () => Promise; } /** * Marks Resource or Entity that supports .update verb * @export * @interface UpdateEnabled * @template TRequest * @template TResponse */ export interface UpdateEnabled { /** * @param {TRequest} request * @returns {Promise} * * @memberOf UpdateEnabled */ update: (request: TRequest) => Promise; } /** * Marks Resource or Entity that supports .update verb without any parameters * @export * @interface EmptyUpdateEnabled * @template TResponse */ export interface EmptyUpdateEnabled { /** * @param {TResponse} request * @returns {Promise} * * @memberOf EmptyUpdateEnabled */ update: (request: TResponse) => Promise; } /** * Marks Resource or Entity that supports .delete verb * @export * @interface DeleteEnabled * @template TResponse */ export interface DeleteEnabled { /** * @returns {Promise} * * @memberOf DeleteEnabled */ delete: () => Promise; } /** * Marks Resource or Entity that supports .delete with query parameters * @export * @interface ParametrizedDeleteEnabled * @template TParameters * @template TResponse */ export interface ParametrizedDeleteEnabled { /** * @param {TParameters} * @returns {Promise} * * @memberOf ParametrizedDeleteEnabled */ delete: (parameters: TParameters) => Promise; } /** * Marks Resource or Entity that supports .list verb * @export * @interface ListEnabled * @template TItem */ export interface ListEnabled { /** * @returns {Promise>} * * @memberOf ListEnabled */ list: () => Promise>; } /** * Marks Resource or Entity that supports .list verb with parameters * @export * @interface ParametrizedListEnabled * @template TParameters * @template TItem */ export interface ParametrizedListEnabled { /** * @param {TParameters} parameters * @returns {Promise>} * * @memberOf ParametrizedListEnabled */ list: (parameters: TParameters) => Promise>; } /** * Marks Resource or Entity that supports .list verb with parameters and pagination * @export * @interface PaginatedListEnabled * @template TItem */ export interface PaginatedListEnabled { list: (parameters: Paginated) => Promise>; } /** * Marks Resource or Entity that supports .url verb * @export * @interface HasUrl */ export interface HasUrl { /** * @returns {string} * * @memberOf HasUrl */ url: () => string; } /** * Marks Resource or Entity that supports .url verb with parameters * @export * @interface HasParametrizedUrl * @template TParameters */ export interface HasParametrizedUrl { /** * @param {TParameters} parameters * @returns {string} * * @memberOf HasParametrizedUrl */ url: (parameters: TParameters) => string; } /** * Response with no body. * * @export * @interface EmptyResponse */ export interface EmptyResponse { } /** * Marks response that is signable. It has SigningObject with key signing available. * @export * @interface Signable */ export interface Signable { signing: SigningObject; } /** * Marks Resource or Entity that supports .download verb. * @interface DownloadEnabled */ export interface DownloadEnabled { /** * @returns {Promise} */ download: () => Promise; } /** * Marks Resource or Entity that supports .download verb with parameters. * @interface ParametrizedDownloadEnabled */ export interface ParametrizedDownloadEnabled { /** * @param {TParameters} parameters * @returns {Promise} */ download: (parameters: TParameters) => Promise; } /** * Marks Resource or Entity that supports .export verb. * @interface ExportEnabled */ export interface ExportEnabled { /** * @returns {Promise} */ export: () => Promise; } /** * Marks Resource or Entity that supports .export verb with parameters. * @interface ParametrizedExportEnabled */ export interface ParametrizedExportEnabled { /** * @param {TParameters} parameters * @returns {Promise} */ export: (parameters: TParameters) => Promise; } } declare module CSCoreSDK { /** * @export * @class EntityUtils */ export class EntityUtils { /** * @static * @param {any} obj * @param {any} f * @param {any} [ctx=null] * @returns * * @memberOf EntityUtils */ static deepMap(obj: any, f: any, ctx?: any): any; /** * Marks response that is signable. It has SigningObject with key signing available. * @static * @param {any} object * @param {string} idKey * * @memberOf EntityUtils */ static addIdProperty(object: any, idKey: string): void; /** * @static * @param {any} object * @returns {*} * * @memberOf EntityUtils */ static copyData(object: any): any; /** * @static * @param {any} object * @param {string} oldName * @param {string} newName * * @memberOf EntityUtils */ static renameProperty(object: any, oldName: string, newName: string): void; /** * @static * @param {function} accessFunction * @param {any} key * @param {function} transformFunction * * @memberOf EntityUtils */ static tryTransform(accessFunction: () => any, key: any, transformFunction: (val: any) => any): void; /** * @static * @param {function} accessFunction * @param {any} key * * @memberOf EntityUtils */ static tryStringToDateTransform(accessFunction: () => any, key: any): void; /** * @static * @param {function} accessFunction * @param {any} key * * @memberOf EntityUtils */ static tryStringify(accessFunction: () => any, key: any): void; /** * Date.parse with progressive enhancement for ISO 8601 * NON-CONFORMANT EDITION. * © 2011 Colin Snover * Released under MIT license. * * @param {any} date * @returns {number} */ static parseISODate(date: any): number; /** * Copy all of the properties in the source objects over to the destination object, * and return the destination object. It's in-order, so the last source will override * properties of the same name in previous arguments. * * @param {object} originalParams * @param {object} additionalParams * @returns {void} */ static extend(originalParams: object, additionalParams: object): void; /** * @static * @param {string|string[]} dates * @param {any} obj * @returns {void} * * @memberOf EntityUtils */ static addDatesFromISO(dates: string | [string], obj: any): void; /** * @static * @param {any} dates * @param {any} obj * @param {string} [items] itemsKey * @returns {void} * * @memberOf EntityUtils */ static addDatesToItems(dates: any, obj: any, itemsKey?: string): void; /** * @static * @param {any} dates * @param {object} obj * @returns {void} * * @memberOf EntityUtils */ static transformDatesToISO(dates: any, obj: object): void; /** * @static * @param {any} dates * @param {object} obj * @returns {void} * * @memberOf EntityUtils */ static transformDatesToSimpleISO(dates: any, obj: object): void; /** * @static * @param {any} params * @param {any} paramKey * @returns {void} * * @memberOf EntityUtils */ static transformArrayParamsToString(params: any, paramKey: any): void; /** * @static * @param {string} path * @param {any} params * @returns {string} * * @memberOf EntityUtils */ static addParamsToPath(path: string, params: any): string; /** * @private * @static * @param {any} params * @param {any} paramKey * @returns {void} * * @memberOf EntityUtils */ private static transformParamsToString(params, paramKey); /** * @private * @static * @param {any} date * @param {any} obj * @returns {void} * * @memberOf EntityUtils */ private static addISODate(date, obj); } } declare module CSCoreSDK { /** * @export * @class ResourceUtils */ export class ResourceUtils { /** * @static * @template TResponse * @param {Resource} resource * @param {any} params * @returns {Promise} * * @memberOf ResourceUtils */ static CallGet(resource: Resource, params: any): Promise; /** * @static * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {any} params * @returns {Promise} * * @memberOf ResourceUtils */ static CallGetWithSuffix(resource: Resource, pathSuffix: string, params: any): Promise; /** * @static * @template TRequest * @template TResponse * @param {Resource} resource * @param {TRequest=} payload * @returns {Promise} * * @memberOf ResourceUtils */ static CallCreate(resource: Resource, payload?: TRequest): Promise; /** * @static * @template TRequest * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {TRequest=} payload * @returns {Promise} * * @memberOf ResourceUtils */ static CallCreateWithSuffix(resource: Resource, pathSuffix: string, payload?: TRequest): Promise; /** * @static * @template TRequest * @template TResponse * @param {Resource} resource * @param {TRequest=} payload * @returns {Promise} * * @memberOf ResourceUtils */ static CallUpdate(resource: Resource, payload?: TRequest): Promise; /** * @static * @template TRequest * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {TRequest=} payload * @returns {Promise} * * @memberOf ResourceUtils */ static CallUpdateWithSuffix(resource: Resource, pathSuffix: string, payload?: TRequest): Promise; /** * @static * @template TResponse * @param {Resource} resource * @param {any} params * @returns {Promise} * * @memberOf ResourceUtils */ static CallDelete(resource: Resource, params: any): Promise; /** * @static * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {any} params * @returns {Promise} * * @memberOf ResourceUtils */ static CallDeleteWithSuffix(resource: Resource, pathSuffix: string, params: any): Promise; /** * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {string} method * @param {any=} params * @param {Uint8Array} data * @param {any=} headers * @returns {Promise} * * @memberOf ResourceUtils */ UploadDataWithSuffix(resource: Resource, pathSuffix: string, method: string, params: any, data: Uint8Array, headers?: any): Promise; /** * @static * @template TData * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {string} method * @param {any=} params * @param {TData=} data * @param {any=} headers * @returns {Promise} * * @memberOf ResourceUtils */ static CallDownload(resource: Resource, pathSuffix: string, method: string, params?: any, data?: TData, headers?: any): Promise; /** * @static * @template TData * @template TResponse * @param {Resource} resource * @param {string} pathSuffix * @param {string} method * @param {any=} params * @param {TData=} data * @param {any=} headers * @param {string=} responseType * @returns {Promise} * * @memberOf ResourceUtils */ static CallApiWithSuffix(resource: Resource, pathSuffix: string, method: string, params?: any, data?: TData, headers?: any, responseType?: string): Promise; /** * @static * @template TItem * @param {Resource} resource * @param {string} pathSuffix * @param {string=} itemsKey * @param {any=} params * @param {function=} responseTransform * @returns {Promise>} * * @memberOf ResourceUtils */ static CallPaginatedListWithSuffix(resource: Resource, pathSuffix: string, itemsKey?: string, params?: any, responseTransform?: (response: PaginatedListResponse) => PaginatedListResponse): Promise>; /** * @static * @template TItem * @param {Resource} resource * @param {string} pathSuffix * @param {string=} itemsKey * @param {any=} params * @returns {Promise>} * * @memberOf ResourceUtils */ static CallListWithSuffix(resource: Resource, pathSuffix: string, itemsKey?: string, params?: any): Promise>; } } declare module CSCoreSDK { } declare module CSCoreSDK { /** * @export * @class JudgeSession */ export class JudgeSession { sessionId: string; private baseUrl; /** * Creates an instance of JudgeSession. * @param {string} sessionId * @param {string} [baseUrl] * * @memberOf JudgeSession */ constructor(sessionId: string, baseUrl?: string); /** * @param {string} nextCase * @returns {Promise} * * @memberOf JudgeSession */ setNextCase(nextCase: string): Promise; } /** * @export * @class Judge */ export class Judge { static JudgeSessionHeaderName: string; static JudgeCaseHeaderName: string; static DefaultBaseURL: string; static DefaultTestEnvironment: Environment; private baseUrl; /** * Creates an instance of Judge. * @param {string=} baseUrl * * @memberOf Judge */ constructor(baseUrl?: string); /** * @readonly * @returns {Environment} * * @memberOf Judge */ readonly testEnvironment: Environment; /** * @private * @static * @type {string} * @memberOf Judge */ private static CurrentSessionId; /** * @returns {JudgeSession} * * @memberOf Judge */ startNewSession(): JudgeSession; } } declare module CSCoreSDK { /** * @export * @class TestUtils */ export class TestUtils { /** * @static * @param {any} obj * @param {any} props * * @memberOf TestUtils */ static expectToBe(obj: any, props: any): void; /** * @static * @param {any} e * * @memberOf TestUtils */ static logJudgeError(e: any): void; /** * @static * @param {object} target * @param {object} dates * * @memberOf TestUtils */ static expectDate(target: object, dates: object): void; /** * @static * @param {string} url * @param {string} toBeUrl * @returns {void} * * @memberOf TestUtils */ static expectUrl(url: string, toBeUrl: string): void; } } declare module CSCoreSDK { /** * @export * @class SigningUtils */ export class SigningUtils { /** * Replaces order's signInfo property with new SigningObject with passed parameters * * @static * @param {any} order * @param {WebApiClient} client * @param {string} url * @returns {void} * * @memberOf SigningUtils */ static createSigningObject(order: any, client: WebApiClient, url: string): void; } } declare module CSCoreSDK { } declare module CSCoreSDK { /** * Allows configuration of CoreSDK * @export * @class CoreSDKConfigurator */ export class CoreSDKConfigurator { /** * Set the WebAPI key. * @param {string} webApiKey * @returns {CoreSDKConfigurator} * * @memberOf CoreSDKConfigurator */ useWebApiKey(webApiKey: string): CoreSDKConfigurator; /** * Specifies the private key for CSCoreSDK request signing. * @param {string} signingKey * @returns {CoreSDKConfigurator} * * @memberOf CoreSDKConfigurator */ useRequestSigning(signingKey: string): CoreSDKConfigurator; /** * Set other then the default language cs-CZ. * @param {string} language a language to be set * @returns {CoreSDKConfigurator} reference for configuration chaining * * @memberOf CoreSDKConfigurator */ useLanguage(language: string): CoreSDKConfigurator; /** * Sets the environment which the SDK should use. * * @param {Environment} environment environment to use * @returns {CoreSDKConfigurator} reference for configuration chaining * * @memberOf CoreSDKConfigurator */ useEnvironment(environment: Environment): CoreSDKConfigurator; /** * Sets the config for oAuth 2 * * @param {Oauth2Config} oauth2 Oauth2Config to use * @returns {CoreSDKConfigurator} reference for configuration chaining * * @memberOf CoreSDKConfigurator */ useOauth2(oauth2: Oauth2Config): CoreSDKConfigurator; } /** * Shared WebApiConfiguration */ export var config: WebApiConfiguration; /** * Internal structure to share information between different SDKs */ export var sharedContext: WebApiContext; /** * Set the WebAPI key. * @param {string} webApiKey * @returns {CoreSDKConfigurator} */ export var useWebApiKey: (webApiKey: string) => CoreSDKConfigurator; /** * Specifies the private key for CSCoreSDK request signing. * @param {string} signingKey The private key to sign reguests. * @returns {CoreSDKConfigurator} reference for configuration chaining. */ export var useRequestSigning: (signingKey: string) => CoreSDKConfigurator; /** * Set other then the default language cs-CZ. * @param {string} language a language to be set. * @returns {CoreSDKConfigurator} reference for configuration chaining. */ export var useLanguage: (language: string) => CoreSDKConfigurator; /** * Sets the environment which the SDK should use. * @param {Environment} environment environment to use * @returns {CoreSDKConfigurator} reference for configuration chaining. */ export var useEnvironment: (environment: Environment) => CoreSDKConfigurator; /** * Sets the config for oAuth 2 * @param {Oauth2Config} oauth2 Oauth2Config to use * @returns {CoreSDKConfigurator} reference for configuration chaining. */ export var useOauth2: (oauth2: Oauth2Config) => CoreSDKConfigurator; }