diff --git a/javascript/lib/api/src/client/builder-steps.ts b/javascript/lib/api/src/client/builder-steps.ts index 17d03c9a..ff27212d 100644 --- a/javascript/lib/api/src/client/builder-steps.ts +++ b/javascript/lib/api/src/client/builder-steps.ts @@ -68,6 +68,14 @@ interface ProtocolStep extends BuildSt * @param - type of API 2 Build steps. */ interface EnvironmentStep extends BuildStep { + + /** + * Sets a custom path for the api endpoint (optional step) + * + * @param path custom ditto api path, e.g. /custom - will be used instead of the default /api + */ + withCustomPath(path: string): EnvironmentStep; + /** * Sets a custom domain to use for requests. * @@ -212,6 +220,7 @@ interface CustomSearchHandleStep extends BuildStep { abstract class AbstractBuilder implements ProtocolStep, EnvironmentStep, AuthenticationStep, ApiVersionStep { protected domain!: string; + protected customPath?: string; protected apiVersion!: ApiVersion; protected authProviders!: AuthProvider[]; protected tls!: boolean; @@ -227,6 +236,11 @@ abstract class AbstractBuilder impleme return this; } + withCustomPath(path: string): EnvironmentStep { + this.customPath = path; + return this; + } + withDomain(url: string): AuthenticationStep { this.domain = url; return this; diff --git a/javascript/lib/api/src/client/http-client-builder.ts b/javascript/lib/api/src/client/http-client-builder.ts index 5347b7c1..b78c4928 100644 --- a/javascript/lib/api/src/client/http-client-builder.ts +++ b/javascript/lib/api/src/client/http-client-builder.ts @@ -13,7 +13,13 @@ import { HttpThingsHandle, HttpThingsHandleV1, HttpThingsHandleV2 } from './handles/things.interfaces'; import { HttpRequester, HttpRequestSenderBuilder } from './request-factory/http-request-sender'; -import { AllDittoHttpHandles, DefaultDittoHttpClient, DittoHttpClient, DittoHttpClientV1, DittoHttpClientV2 } from './ditto-client-http'; +import { + AllDittoHttpHandles, + DefaultDittoHttpClient, + DittoHttpClient, + DittoHttpClientV1, + DittoHttpClientV2 +} from './ditto-client-http'; import { HttpMessagesHandle } from './handles/messages-http'; import { PoliciesHandle } from './handles/policies'; import { SearchHandle } from './handles/search'; @@ -122,7 +128,8 @@ export class HttpClientBuilder extends AbstractBuilder