// Copyright © 2022-2026 Partium, Inc. DBA Partium import { Observable } from 'rxjs'; import { BaseService } from '../../base.service'; import { ServiceProvider } from '../../service-provider'; /** * Options for the request. */ export interface RequestOptions { withCredentials: boolean; } /** * Https-Client-Service is an interface that should be implemented by the platform/framework * that uses the JS-SDK. It should provide functions to do basic https-calls (like GET, POST, ...) * to any web-service. * Currently only GET, PATCH, POST are supported, but it could be extended * easily. * * If you implement this service, make sure to throw the correct errors, if the request * fails. (eg: SDK_ERROR_CODES.NO_INTERNET) * * An implementation of this service is required and has to be configured during * the initialization phase of Partium. * * Note; We didn't implement this class as a real javascript interface to allow it to have * some functionality already implemented. We could also not use an abstract class, because * of the Service-Provider implementation that we use. */ export declare class HttpsClientService extends BaseService { private readonly knownBaseUrls; constructor(serviceProvider: ServiceProvider, knownBaseUrls: string[]); protected validateIsKnownUrlOrCry(url: string): void; /** * Send GET request to a server. * * @param url the full server url * @param urlParams array of url parameters (as objects) which will be appended to the url ?p1=x&p2=y * @param headers object with the request headers * @returns Observable that resolves with the request result */ get(url: string, urlParams?: Array, headers?: Object, requestOptions?: RequestOptions): Observable; /** * Send POST request to the server with the given url and content. * * @param url the full server url * @param data the data to be sent with the post request * @param urlParams array of url parameters (as objects) which will be appended to the url ?p1=x&p2=y * @param headers object with the request headers * @param requestOptions options for the request * @returns Observable that resolves with the request result */ post(url: string, data: Object, urlParams?: Array, headers?: Object, requestOptions?: RequestOptions): Observable; /** * Send PUT request to the server with the given url and content. * * @param url the full server url * @param data the data to be sent with the post request * @param urlParams array of url parameters (as objects) which will be appended to the url ?p1=x&p2=y * @param headers object with the request headers * @returns Observable that resolves with the request result */ put(url: string, data: Object, urlParams?: Array, headers?: Object, requestOptions?: RequestOptions): Observable; /** * Send PATCH request to the server with the given url and content. * * @param url the full server url * @param data the data to be sent with the patch request * @param urlParams array of url parameters (as objects) which will be appended to the url ?p1=x&p2=y * @param headers object with the request headers * @param requestOptions options for the request * @returns Observable that resolves with the request result */ patch(url: string, data: Object, urlParams?: Array, headers?: Object, requestOptions?: RequestOptions): Observable; /** * Send DELETE request to the server with the given url and content. * * @param url the full server url * @param urlParams array of url parameters (as objects) which will be appended to the url ?p1=x&p2=y * @param headers object with the request headers * @param requestOptions options for the request * @returns Observable that resolves with the request result */ delete(url: string, data?: Object, urlParams?: Array, headers?: Object, requestOptions?: RequestOptions): Observable; /** * Add url parameters to the given url and return it as string. * If one of the parameter already exists, it will be replaced with * the new value. * If an object of the array contains multiple params, all are added. * * @param url the url to add the parameters to * @param paramObjects array of objects with parameters that should be appended, eg: [{ pageNumber: 4 }] * @returns the given url with the appended parameters */ protected addUrlParameters(url: string, paramObjects: Array): string; /** * Add an url parameter to the given url and return it as string. * If the same parameter already exists, it will be replaced with * the new value. * If an object of the array contains multiple params, all are added. * * @param url the url to add the parameter to * @param paramObject the object with one or more params to append, eg: { pageNumber: 4 } * @returns the given url with the appended parameter */ protected addUrlParameter(url: string, paramObject: Object): string; }