Skip to content

Made ApiClient internal methods protected, exposed readonly databaseId and getBaseUri #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ApiClient {
this.databaseId = databaseId;
this.publicToken = publicToken;
this.options = options || {};
this.baseUri = this._getBaseUri();
this.baseUri = this.getBaseUri();
this.useHttps = 'useHttps' in this.options ? this.options.useHttps : true;
this.async = 'async' in this.options ? this.options.async : true;
this.future_v6_fetch = 'future_v6_fetch' in this.options ? this.options.future_v6_fetch : false;
Expand All @@ -40,7 +40,7 @@ class ApiClient {
return uri;
}

_getBaseUri() {
getBaseUri() {
let baseUri = this.options.baseUri;
if (this.options.region) {
if (baseUri) {
Expand Down
8 changes: 5 additions & 3 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ declare module 'recombee-js-api-client' {
* @param options - Other custom options.
*/
constructor(databaseId: string, publicToken: string, options?: ApiClientOptions);
public readonly databaseId: string
publicToken: string

_getRegionalBaseUri(region: string): string;
protected _getRegionalBaseUri(region: string): string;

_getBaseUri(): string;
getBaseUri(): string;

/**
* Send the request to Recombee
Expand All @@ -142,7 +144,7 @@ declare module 'recombee-js-api-client' {
) // @ts-expect-error private member
: Promise<TRequest['__response_type']>;

_signUrl(req_part: string): string;
protected _signUrl(req_part: string): string;
}

export type Recommendation = {
Expand Down