import * as url from 'url'; declare namespace com.edsancha.survey.models.v0.enums { type Component = 'label' | 'image' | 'nps' | 'textArea' | 'textInput' | 'radio' | 'checkbox' | 'grading' | 'grading0to10' | 'grading1to10'; } declare namespace com.edsancha.medallia.api.v0.enums { type CompareString = 'greaterThan' | 'equals' | 'smallerThan'; type FormType = 'mobileInvitation' | 'code'; type RatingViewType = 'slide' | 'numbersSquare' | 'gradingSlider' | 'gradingDropdown' | 'stars' | 'emoticons' | 'numbers' | 'smilies' | 'bars'; } declare namespace com.edsancha.medallia.api.v0.models { interface AccessTokenWrapper { readonly 'accessToken': string; } interface ComponentCheckbox { readonly 'component': 'checkbox'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'options': string[]; readonly 'description'?: string; } interface ComponentDropdown { readonly 'component': 'select'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'placeholder': string; readonly 'label': string; readonly 'options': string[]; readonly 'description'?: string; } interface ComponentGrading { readonly 'component': 'grading'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'ratingViewType': com.edsancha.medallia.api.v0.enums.RatingViewType; readonly 'description'?: string; } interface ComponentGrading0To10 { readonly 'component': 'grading0to10'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'ratingViewType': com.edsancha.medallia.api.v0.enums.RatingViewType; readonly 'description'?: string; } interface ComponentGrading1To10 { readonly 'component': 'grading1to10'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'ratingViewType': com.edsancha.medallia.api.v0.enums.RatingViewType; readonly 'description'?: string; } interface ComponentImage { readonly 'component': 'image'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'imageObject'?: com.edsancha.medallia.api.v0.models.Image; readonly 'uploadedResource'?: com.edsancha.medallia.api.v0.models.Image; } interface ComponentLabel { readonly 'component': 'label'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'labelContent'?: string; readonly 'num_of_lines': number; } interface ComponentNps { readonly 'component': 'nps'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'description'?: string; readonly 'ratingViewType': com.edsancha.medallia.api.v0.enums.RatingViewType; } interface ComponentRadioSelector { readonly 'component': 'radio'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'label': string; readonly 'options': string[]; readonly 'description'?: string; } interface ComponentTextArea { readonly 'component': 'textArea'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'placeholder': string; readonly 'label': string; readonly 'num_of_lines': number; readonly 'description'?: string; } interface ComponentTextInput { readonly 'component': 'textInput'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'required': boolean; readonly 'placeholder': string; readonly 'label': string; readonly 'max_chars': number; readonly 'description'?: string; } interface Configuration { readonly 'propertyId': number; readonly 'feedbackSubmitUrl': string; readonly 'forms': com.edsancha.medallia.api.v0.models.Form[]; } interface DynamicData { readonly 'index': number; readonly 'id': number; readonly 'required': boolean; readonly 'component': string; readonly 'unique_name': string; readonly 'placeholder': string; readonly 'label': string; readonly 'description'?: string; readonly 'options'?: string[]; readonly 'imageObject'?: com.edsancha.medallia.api.v0.models.Image; } interface Feedback { readonly 'formId': number; readonly 'dynamicData': com.edsancha.medallia.api.v0.models.FeedbackData; } interface FeedbackCheckbox { readonly 'component': 'checkbox'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number[]; readonly 'type': string; } interface FeedbackData { readonly 'customParams'?: any/*json*/; readonly 'pages': com.edsancha.medallia.api.v0.models.FeedbackPage[]; } interface FeedbackDropdown { readonly 'component': 'select'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackGrading { readonly 'component': 'grading'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackGrading0To10 { readonly 'component': 'grading0to10'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackGrading1To10 { readonly 'component': 'grading1to10'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackNps { readonly 'component': 'nps'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackPage { readonly 'components': com.edsancha.medallia.api.v0.unions.FeedbackUnion[]; } interface FeedbackRadioSelector { readonly 'component': 'radio'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': number; readonly 'type': string; } interface FeedbackTextArea { readonly 'component': 'textArea'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': string; readonly 'type': string; } interface FeedbackTextInput { readonly 'component': 'textInput'; readonly 'index': number; readonly 'id': number; readonly 'unique_name': string; readonly 'value': string; readonly 'type': string; } interface Form { readonly 'formId': number; readonly 'name': string; readonly 'title': string; readonly 'formType': com.edsancha.medallia.api.v0.enums.FormType; readonly 'inviteData'?: com.edsancha.medallia.api.v0.models.InviteData; readonly 'triggerData'?: com.edsancha.medallia.api.v0.models.TriggerData; readonly 'formJson': com.edsancha.medallia.api.v0.models.FormJson; } interface FormJson { readonly 'pages': com.edsancha.medallia.api.v0.models.Page[]; } interface Image { readonly 'name': string; readonly 'url': string; } interface InviteData { readonly 'invitationHeadline': string; readonly 'invitationText': string; readonly 'provideButtonText': string; readonly 'declineButtonText': string; readonly 'laterButtonText': string; } interface NumberOfAppSession { readonly 'number': string; readonly 'compareString': com.edsancha.medallia.api.v0.enums.CompareString; } interface NumberOfDays { readonly 'days': string; } interface Page { readonly 'name': string; readonly 'index': number; readonly 'dynamicData': com.edsancha.medallia.api.v0.unions.ComponentUnion[]; } interface PercentageOfSessions { readonly 'prec': string; } interface TimeInForeground { readonly 'time': string; readonly 'compareString': com.edsancha.medallia.api.v0.enums.CompareString; } interface TriggerData { readonly 'numberOfAppSession'?: com.edsancha.medallia.api.v0.models.NumberOfAppSession; readonly 'timeInForeground'?: com.edsancha.medallia.api.v0.models.TimeInForeground; readonly 'mobileappVersion'?: string[]; readonly 'submitted'?: com.edsancha.medallia.api.v0.models.NumberOfDays; readonly 'declined'?: com.edsancha.medallia.api.v0.models.NumberOfDays; readonly 'mobileosVersion'?: string[]; readonly 'percentageOfSessions'?: com.edsancha.medallia.api.v0.models.PercentageOfSessions; readonly 'genericRule'?: string; } } declare namespace com.edsancha.medallia.api.v0.unions { type ComponentUnion = (com.edsancha.medallia.api.v0.models.ComponentLabel | com.edsancha.medallia.api.v0.models.ComponentImage | com.edsancha.medallia.api.v0.models.ComponentNps | com.edsancha.medallia.api.v0.models.ComponentTextArea | com.edsancha.medallia.api.v0.models.ComponentTextInput | com.edsancha.medallia.api.v0.models.ComponentRadioSelector | com.edsancha.medallia.api.v0.models.ComponentCheckbox | com.edsancha.medallia.api.v0.models.ComponentDropdown | com.edsancha.medallia.api.v0.models.ComponentGrading | com.edsancha.medallia.api.v0.models.ComponentGrading0To10 | com.edsancha.medallia.api.v0.models.ComponentGrading1To10); type FeedbackUnion = (com.edsancha.medallia.api.v0.models.FeedbackNps | com.edsancha.medallia.api.v0.models.FeedbackTextArea | com.edsancha.medallia.api.v0.models.FeedbackTextInput | com.edsancha.medallia.api.v0.models.FeedbackRadioSelector | com.edsancha.medallia.api.v0.models.FeedbackCheckbox | com.edsancha.medallia.api.v0.models.FeedbackDropdown | com.edsancha.medallia.api.v0.models.FeedbackGrading | com.edsancha.medallia.api.v0.models.FeedbackGrading0To10 | com.edsancha.medallia.api.v0.models.FeedbackGrading1To10); } export type AccessTokenWrapper = com.edsancha.medallia.api.v0.models.AccessTokenWrapper; export type CompareString = com.edsancha.medallia.api.v0.enums.CompareString; export type ComponentCheckbox = com.edsancha.medallia.api.v0.models.ComponentCheckbox; export type ComponentDropdown = com.edsancha.medallia.api.v0.models.ComponentDropdown; export type ComponentGrading = com.edsancha.medallia.api.v0.models.ComponentGrading; export type ComponentGrading0To10 = com.edsancha.medallia.api.v0.models.ComponentGrading0To10; export type ComponentGrading1To10 = com.edsancha.medallia.api.v0.models.ComponentGrading1To10; export type ComponentImage = com.edsancha.medallia.api.v0.models.ComponentImage; export type ComponentLabel = com.edsancha.medallia.api.v0.models.ComponentLabel; export type ComponentNps = com.edsancha.medallia.api.v0.models.ComponentNps; export type ComponentRadioSelector = com.edsancha.medallia.api.v0.models.ComponentRadioSelector; export type ComponentTextArea = com.edsancha.medallia.api.v0.models.ComponentTextArea; export type ComponentTextInput = com.edsancha.medallia.api.v0.models.ComponentTextInput; export type ComponentUnion = com.edsancha.medallia.api.v0.unions.ComponentUnion; export type Configuration = com.edsancha.medallia.api.v0.models.Configuration; export type DynamicData = com.edsancha.medallia.api.v0.models.DynamicData; export type Feedback = com.edsancha.medallia.api.v0.models.Feedback; export type FeedbackCheckbox = com.edsancha.medallia.api.v0.models.FeedbackCheckbox; export type FeedbackData = com.edsancha.medallia.api.v0.models.FeedbackData; export type FeedbackDropdown = com.edsancha.medallia.api.v0.models.FeedbackDropdown; export type FeedbackGrading = com.edsancha.medallia.api.v0.models.FeedbackGrading; export type FeedbackGrading0To10 = com.edsancha.medallia.api.v0.models.FeedbackGrading0To10; export type FeedbackGrading1To10 = com.edsancha.medallia.api.v0.models.FeedbackGrading1To10; export type FeedbackNps = com.edsancha.medallia.api.v0.models.FeedbackNps; export type FeedbackPage = com.edsancha.medallia.api.v0.models.FeedbackPage; export type FeedbackRadioSelector = com.edsancha.medallia.api.v0.models.FeedbackRadioSelector; export type FeedbackTextArea = com.edsancha.medallia.api.v0.models.FeedbackTextArea; export type FeedbackTextInput = com.edsancha.medallia.api.v0.models.FeedbackTextInput; export type FeedbackUnion = com.edsancha.medallia.api.v0.unions.FeedbackUnion; export type Form = com.edsancha.medallia.api.v0.models.Form; export type FormJson = com.edsancha.medallia.api.v0.models.FormJson; export type FormType = com.edsancha.medallia.api.v0.enums.FormType; export type Image = com.edsancha.medallia.api.v0.models.Image; export type InviteData = com.edsancha.medallia.api.v0.models.InviteData; export type NumberOfAppSession = com.edsancha.medallia.api.v0.models.NumberOfAppSession; export type NumberOfDays = com.edsancha.medallia.api.v0.models.NumberOfDays; export type Page = com.edsancha.medallia.api.v0.models.Page; export type PercentageOfSessions = com.edsancha.medallia.api.v0.models.PercentageOfSessions; export type RatingViewType = com.edsancha.medallia.api.v0.enums.RatingViewType; export type TimeInForeground = com.edsancha.medallia.api.v0.models.TimeInForeground; export type TriggerData = com.edsancha.medallia.api.v0.models.TriggerData; export interface $FetchOptions { body?: string; headers?: $HttpHeaders; method?: $HttpMethod; } export type $FetchFunction = (url: string, options?: $FetchOptions) => Promise; export interface $HttpHeaders { [key: string]: string; } export type $HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'CONNECT' | 'OPTIONS' | 'TRACE'; export interface $HttpQuery { [key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null; } export interface $HttpRequest { body?: any; url: string; headers: $HttpHeaders; method: $HttpMethod; } export interface $HttpRequestOptions { body?: any; endpoint: string; headers?: $HttpHeaders; method: $HttpMethod; query?: $HttpQuery; } export interface $HttpResponse { body: B; headers: $HttpHeaders; ok: O; request: $HttpRequest; status: S; statusText: string; } export type $HttpContinue = $HttpResponse; export type $HttpSwitchingProtocol = $HttpResponse; export type $HttpProcessing = $HttpResponse; export type $HttpOk = $HttpResponse; export type $HttpCreated = $HttpResponse; export type $HttpAccepted = $HttpResponse; export type $HttpNonAuthoritativeInformation = $HttpResponse; export type $HttpNoContent = $HttpResponse; export type $HttpResetContent = $HttpResponse; export type $HttpPartialContent = $HttpResponse; export type $HttpMultiStatus = $HttpResponse; export type $HttpAlreadyReported = $HttpResponse; export type $HttpImUsed = $HttpResponse; export type $HttpMultipleChoices = $HttpResponse; export type $HttpMovedPermanently = $HttpResponse; export type $HttpFound = $HttpResponse; export type $HttpSeeOther = $HttpResponse; export type $HttpNotModified = $HttpResponse; export type $HttpUseProxy = $HttpResponse; export type $HttpTemporaryRedirect = $HttpResponse; export type $HttpPermanentRedirect = $HttpResponse; export type $HttpBadRequest = $HttpResponse; export type $HttpUnauthorized = $HttpResponse; export type $HttpPaymentRequired = $HttpResponse; export type $HttpForbidden = $HttpResponse; export type $HttpNotFound = $HttpResponse; export type $HttpMethodNotAllowed = $HttpResponse; export type $HttpNotAcceptable = $HttpResponse; export type $HttpProxyAuthenticationRequired = $HttpResponse; export type $HttpRequestTimeout = $HttpResponse; export type $HttpConflict = $HttpResponse; export type $HttpGone = $HttpResponse; export type $HttpLengthRequired = $HttpResponse; export type $HttpPreconditionFailed = $HttpResponse; export type $HttpRequestEntityTooLarge = $HttpResponse; export type $HttpRequestUriTooLong = $HttpResponse; export type $HttpUnsupportedMediaType = $HttpResponse; export type $HttpRequestedRangeNotSatisfiable = $HttpResponse; export type $HttpExpectationFailed = $HttpResponse; export type $HttpMisdirectedRequest = $HttpResponse; export type $HttpUnprocessableEntity = $HttpResponse; export type $HttpLocked = $HttpResponse; export type $HttpFailedDependency = $HttpResponse; export type $HttpUpgradeRequired = $HttpResponse; export type $HttpPreconditionRequired = $HttpResponse; export type $HttpTooManyRequests = $HttpResponse; export type $HttpRequestHeaderFieldsTooLarge = $HttpResponse; export type $HttpNoResponse = $HttpResponse; export type $HttpRetryWith = $HttpResponse; export type $HttpBlockedByWindowsParentalControls = $HttpResponse; export type $HttpUnavailableForLegalReasons = $HttpResponse; export type $HttpClientClosedRequest = $HttpResponse; export type $HttpInternalServerError = $HttpResponse; export type $HttpNotImplemented = $HttpResponse; export type $HttpBadGateway = $HttpResponse; export type $HttpServiceUnavailable = $HttpResponse; export type $HttpGatewayTimeout = $HttpResponse; export type $HttpHttpVersionNotSupported = $HttpResponse; export type $HttpInsufficientStorage = $HttpResponse; export type $HttpLoopDetected = $HttpResponse; export type $HttpBandwidthLimitExceeded = $HttpResponse; export type $HttpNotExtended = $HttpResponse; export type $HttpNetworkAuthenticationRequired = $HttpResponse; export type $HttpNetworkReadTimeoutError = $HttpResponse; export type $HttpNetworkConnectTimeoutError = $HttpResponse; export interface $HttpClientOptions { fetch: $FetchFunction; } export function isResponseEmpty(response: Response): boolean { const contentLength = response.headers.get('Content-Length'); return response.status === 204 || contentLength != null && Number.parseInt(contentLength, 10) === 0; } export function isResponseJson(response: Response): boolean { const contentType = response.headers.get('Content-Type'); return contentType != null && contentType.indexOf('json') >= 0; } export function parseJson(response: Response): Promise { return !isResponseEmpty(response) && isResponseJson(response) ? response.json() : Promise.resolve(); } export function parseHeaders(response: Response): Record { const headers: Record = {}; response.headers.forEach((value, key) => { headers[key.toLowerCase()] = value; }); return headers; } export function stripQuery(query: $HttpQuery = {}): $HttpQuery { const initialValue: $HttpQuery = {}; return Object.keys(query).reduce((previousValue, key) => { const value = query[key]; if (value != null) previousValue[key] = value; return previousValue; }, initialValue); } export class $HttpClient { private options: $HttpClientOptions; constructor(options: $HttpClientOptions) { this.options = options; } public request(options: $HttpRequestOptions): Promise<$HttpResponse> { const finalUrl: string = url.format({ hostname: 'api-us.kampyle.com', pathname: '/api/v1' + options.endpoint, protocol: 'https:', query: stripQuery(options.query), }); const finalHeaders: $HttpHeaders = { accept: 'application/json', 'content-type': 'application/json', ...options.headers, }; const request: $HttpRequest = { body: options.body, headers: finalHeaders, method: options.method, url: finalUrl, }; return this.options.fetch(request.url, { body: JSON.stringify(request.body), headers: request.headers, method: request.method, }).then((response) => { return parseJson(response).then((json) => { return { body: json, headers: parseHeaders(response), ok: response.ok, request, status: response.status, statusText: response.statusText, }; }); }); } } export class $Resource { protected client: $HttpClient; constructor(options: $HttpClientOptions) { this.client = new $HttpClient(options); } } export interface AccessTokenWrappersPostAccessTokenParameters { headers?: $HttpHeaders; } export interface ConfigurationsGetConfigurationParameters { headers?: $HttpHeaders; } export interface FeedbacksPostFeedbackParameters { body: com.edsancha.medallia.api.v0.models.Feedback; headers?: $HttpHeaders; } export type AccessTokenWrappersPostAccessTokenResponse = $HttpOk | $HttpUnauthorized | $HttpInternalServerError; export type ConfigurationsGetConfigurationResponse = $HttpOk | $HttpBadRequest | $HttpUnauthorized | $HttpInternalServerError; export type FeedbacksPostFeedbackResponse = $HttpOk | $HttpBadRequest | $HttpUnauthorized | $HttpInternalServerError; export class AccessTokenWrappersResource extends $Resource { /*This API is used to retrieve the temporary access token that allows your app to access all other APIs*/ public postAccessToken(params: AccessTokenWrappersPostAccessTokenParameters = {}): Promise { return this.client.request({ endpoint: '/accessToken', headers: params.headers, method: 'POST', }); } } export class ConfigurationsResource extends $Resource { /*This API returns the full configuration as defined in the Medallia Digital command center. It returns the list of surveys, their content and business logic as well as targeting and segmentation rules.*/ public getConfiguration(params: ConfigurationsGetConfigurationParameters = {}): Promise { return this.client.request({ endpoint: '/configuration', headers: params.headers, method: 'GET', }); } } export class FeedbacksResource extends $Resource { /*This API allows the application to submit feedback collected in the app to the Medallia Digital*/ public postFeedback(params: FeedbacksPostFeedbackParameters): Promise { return this.client.request({ body: params.body, endpoint: '/feedback', headers: params.headers, method: 'POST', }); } } export interface ClientInstance { accessTokenWrappers: AccessTokenWrappersResource; configurations: ConfigurationsResource; feedbacks: FeedbacksResource; } export function createClient(options: $HttpClientOptions): ClientInstance { return { accessTokenWrappers: new AccessTokenWrappersResource(options), configurations: new ConfigurationsResource(options), feedbacks: new FeedbacksResource(options), }; }