Skip to content

Commit 09d78b0

Browse files
committed
Add jsdoc
1 parent 715f9a9 commit 09d78b0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/service.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
import Client from "./client";
2121
import Config from "./config";
2222

23-
23+
/**
24+
* Base Service class for all API services.
25+
* Handles the setup of the endpoint URL for the API requests.
26+
*/
2427
class Service {
2528
public apiKeyRequired = false;
2629
public client: Client;
@@ -29,6 +32,15 @@ class Service {
2932
this.client = client;
3033
}
3134

35+
/**
36+
* Constructs the base URL for API requests based on environment and endpoint type.
37+
* - For non-LIVE environments, replaces '-live' with '-test'.
38+
* - For LIVE environment, requires a liveEndpointUrlPrefix.
39+
* - Handles special cases for 'pal-' and 'checkout-' endpoints.
40+
* @param url - The original endpoint URL.
41+
* @returns The formatted endpoint URL.
42+
* @throws Error if liveEndpointUrlPrefix is missing for LIVE environment.
43+
*/
3244
protected createBaseUrl(url: string): string {
3345
const config: Config = this.client.config;
3446

0 commit comments

Comments
 (0)