// Copyright © 2022-2026 Partium, Inc. DBA Partium import { BaseService } from '../base.service'; import { Observable } from 'rxjs'; import { AuthenticationConfig } from '../../models/auth-config'; import { ServiceProvider } from '../service-provider'; import { Organization } from '../organization/models/organization'; export declare enum BACKEND_SERVICE { PARTIUM = 0, DATA = 1, CSA = 2, LOG = 3, USER_DATA = 4, MANAGEMENT = 5, CATALOG = 6, DATACURATION = 7, DATA_V2 = 8, DATA_ENRICHMENT = 9, BACKOFFICE = 10 } export interface BaseUrls { partiumApiBaseUrl: string; dataBeBaseUrl: string; csaBeBaseUrl: string; logBeBaseUrl: string; userDataBeBaseUrl: string; managementBeBaseUrl: string; catalogBeBaseUrl: string; datacurationBeBaseUrl: string; dataV2BeBaseUrl: string; dataEnrichmentBeBaseUrl: string; backofficeBeBaseUrl: string; } /** * Defines the structure of a https-service implementation, which * is used for Partium-backend communication. * This sdk provides different https-services, based on the authentication- * method the user wants to use. * By inheriting from this class and using serviceProvider.useService, a * concrete implementation of a https-service can be chosen at runtime. * This could be useful if for example a custom http-client should be used. * * An implementation of this service is required and has to be configured during * the initialization phase of Partium. * * This class file is called interface, even though it is not an interface, * but we need it to be a concrete class for the serviceProvider. */ export declare class HttpsService extends BaseService { private httpsClientService; private baseUrls; protected config: AuthenticationConfig; private currentOrganization$; constructor(serviceProvider: ServiceProvider); onCreate(): void; /** * Initialize the https-service with configuration parameters. * * @param baseUrls: the base-urls for the different backends * @param config the https service configuration */ init(baseUrls: BaseUrls, config: AuthenticationConfig): Observable; /** * Send GET request to the Partium-backend with the given relative url. * * @param url the relative url * @param urlParams array of url parameters (as objects) which will be appended to the url, eg: [{ p1: x }, { p2: y }] will become ?p1=x&p2=y * @param beService to which backend-service should the request be sent (default PARTIUM) * @returns Observable that resolves with the request result */ get(url: string, urlParams?: Array, beService?: BACKEND_SERVICE): Observable; /** * Send POST request to the Partium-backend with the given relative url and content. * * @param url the relative 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, eg: [{ p1: x }, { p2: y }] will become ?p1=x&p2=y * @param beService to which backend-service should the request be sent (default PARTIUM) * @param headers object with custom headers to send with the request * @returns Observable that resolves with the request result */ post(url: string, data: Object, urlParams?: Array, beService?: BACKEND_SERVICE, headers?: Object): Observable; /** * Send PUT request to the Partium-backend with the given relative url and content. * * @param url the relative 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, eg: [{ p1: x }, { p2: y }] will become ?p1=x&p2=y * @param beService to which backend-service should the request be sent (default PARTIUM) * @param headers object with custom headers to send with the request * @returns Observable that resolves with the request result */ put(url: string, data: Object, urlParams?: Array, beService?: BACKEND_SERVICE, headers?: Object): Observable; /** * Send PATCH request to the Partium-backend with the given relative url and content. * * @param url the relative 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, eg: [{ p1: x }, { p2: y }] will become ?p1=x&p2=y * @param beService to which backend-service should the request be sent (default PARTIUM) * @param headers object with custom headers to send with the request * @returns Observable that resolves with the request result */ patch(url: string, data: Object, urlParams?: Array, beService?: BACKEND_SERVICE, headers?: Object): Observable; /** * Send DELETE request to the Partium-backend with the given relative url and content. * * @param url the relative url * @param data the data to be sent with the delete request * @param urlParams array of url parameters (as objects) which will be appended to the url, eg: [{ p1: x }, { p2: y }] will become ?p1=x&p2=y * @param beService to which backend-service should the request be sent (default PARTIUM) * @returns Observable that resolves with the request result */ delete(url: string, data?: Object, urlParams?: Array, beService?: BACKEND_SERVICE): Observable; /** * Set an observable that always holds the currently selected organization. * This is needed, for adding the X-Partium-Data-Organization header to all requests. * * @param currentOrganization$ Observable that holds the current organization */ setCurrentOrganization(currentOrganization$: Observable): void; /** * Return whether a failed request should be retried or not. * The default implementation here does not retry any requests. * Any child class of this service can override this function to provide * extended behavior. */ protected retryWhen(errors: Observable): Observable; /** * Process an error received from the an http-request, by the HttpsClientService * The default implementation here does nothing with the error, it only forwards * it. * Any child classes of this service can override this function to provide * extended behavior. */ protected processError(error: any): Observable; /** * Creates the headers object needed for the https-requests. * Since this parameters are different per authentication-method, * they need to be set in a child-class of this interface. * * Method should be overridden by child-class * * @param options object with given header-parameters that will be extended with more parameters * @returns the created headers object */ protected createHeaders(options?: Object): Object; /** * Combine the given relative url with the Backends Base-url. * * @param relUrl the relative url * @param beService to which backend-service should the request be sent (default PARTIUM) */ private createUrl; /** * This method calls the createHeaders method to generate the initial headers * and then adds additional headers based on specific conditions. * * If externalUserId is configured and the backend service is not the log service, * the X-Partium-ExternalUserId header is added to the headers object. * * @param options object with given header-parameters that will be extended with more parameters * @param beService to which backend-service should the request be sent * @returns the extended headers object */ private configureHeaders; }