///
import * as Decode from '../Utils/Json';
import { Question } from '../Utils/WdkModel';
/**
* Header added to service requests to indicate the version of the model
* current stored in cache.
*/
export declare const CLIENT_WDK_VERSION_HEADER = "x-client-wdk-timestamp";
/**
* Response text returned by service that indicates the version of the cached
* model is stale, based on CLIENT_WDK_VERSION_HEADER.
*/
export declare const CLIENT_OUT_OF_SYNC_TEXT = "WDK-TIMESTAMP-MISMATCH";
/**
* Response returned by service that indicates that the requested
* resource is not yet available.
*/
export declare type DelayedResult = Decode.Unpack;
declare const delayedResult: Decode.Decoder<{
status: "accepted";
message: "WDK-DELAYED-RESULT";
}>;
export interface StandardWdkPostResponse {
id: number;
}
declare type RequestOptions = {
/** Request method */
method: string;
/** Path to the resource, relative to the base url */
path: string;
/** Query params to include with request */
params?: {
[key: string]: any;
};
/** Request body */
body?: string;
/** Fetch from cache, if available */
useCache?: boolean;
/**
* Optional identity for cache. If useCache is true, and this is omitted, then
* a combination of the resource path and any provided params will be used as
* the cache key. If this is also included, this value will be appended to the
* generated cache key.
*/
cacheId?: string;
/** If using cache and a value is present, this is a check for the cached value */
checkCachedValue?: (resource: Resource) => boolean;
};
export interface ServiceConfig {
authentication: {
method: 'OAUTH2' | 'USER_DB';
oauthUrl: string;
oauthClientUrl: string;
oauthClientId: string;
};
buildNumber: string;
categoriesOntologyName: string;
description: string;
displayName: string;
projectId: string;
releaseDate: string;
startupTime: number;
userProfileProperties: Array<{
name: string;
displayName: string;
isRequired: boolean;
isMultiLine: boolean;
isPublic: boolean;
}>;
}
export declare type ServiceBase = ReturnType;
/**
* A helper to request resources from a Wdk REST Service.
* @param {string} serviceUrl Base url for Wdk REST Service.
*/
export declare const ServiceBase: (serviceUrl: string) => {
_version: number | undefined;
_fetchJson: (method: string, url: string, body?: string | undefined, isBaseUrl?: boolean | undefined) => Promise;
_getFromCache: (key: string, onCacheMiss: () => Promise, checkCachedValue?: (cachedValue: T_1) => boolean) => Promise;
_clearCache: () => Promise;
serviceUrl: string;
sendRequest: (decoder: Decode.Decoder, options: RequestOptions) => Promise;
submitError: (error: Error, extra?: any) => Promise;
submitErrorIfNot500: (error: Error, extra?: any) => Promise;
submitErrorIfUndelayedAndNot500: (error: Error, extra?: any) => Promise;
getConfig: () => Promise;
getVersion: () => Promise;
getRecordClasses: (() => Promise<(Pick & {
attributesMap: import("lodash").Dictionary;
tablesMap: import("lodash").Dictionary;
})[]>) & import("lodash").MemoizedFunction;
findRecordClass: (urlSegment: string) => Promise & {
attributesMap: import("lodash").Dictionary;
tablesMap: import("lodash").Dictionary;
}>;
getQuestions: () => Promise>;
findQuestion: (urlSegment: string) => Promise;
getRecordTypePath: (recordClassUrlSegment: string) => string;
getRecordTypesPath: () => string;
getReportsEndpoint: (recordClassUrlSegment: string, questionUrlSegment: string) => string;
getReportsPath: (recordClassUrlSegment: string, questionUrlSegment: string) => string;
getSearchesPath: (recordClassUrlSegment: string) => string;
getSearchPath: (recordClassUrlSegment: string, questionUrlSegment: string) => string;
getStandardSearchReportEndpoint: (recordClassUrlSegment: string, questionUrlSegment: string) => string;
getCustomSearchReportEndpoint: (recordClassUrlSegment: string, questionUrlSegment: string, reportName: string) => string;
};
export {};
//# sourceMappingURL=ServiceBase.d.ts.map