@@ -23,7 +23,7 @@ export type APIErrorDetails = {
2323export class APIError extends Error {
2424 /**
2525 * Creates a new APIError with error message and request details.
26- *
26+ *
2727 * @param message - The error message
2828 * @param details - Details about the failed API request
2929 */
@@ -34,7 +34,7 @@ export class APIError extends Error {
3434
3535/**
3636 * API client for making authenticated HTTP requests to the backend.
37- *
37+ *
3838 * This class handles authentication, request construction, and response parsing.
3939 * It automatically adds the necessary authentication headers to all requests.
4040 */
@@ -44,14 +44,14 @@ export class API {
4444
4545 /**
4646 * Creates a new API client instance.
47- *
47+ *
4848 * @param accessToken - The OAuth access token for authentication (optional)
4949 */
5050 constructor ( private accessToken ?: string ) { }
5151
5252 /**
5353 * Checks if the API client is ready to make authenticated requests.
54- *
54+ *
5555 * @returns True if the access token is available, false otherwise
5656 */
5757 isReady ( ) : boolean {
@@ -60,15 +60,13 @@ export class API {
6060
6161 /**
6262 * Constructs a full URL for an API endpoint with optional query parameters.
63- *
63+ *
6464 * @param endpoint - The API endpoint (without the prefix)
6565 * @param searchParams - Key-value pairs for query parameters
6666 * @returns A fully constructed URL object
6767 */
6868 getUrl ( endpoint : string , searchParams : Record < string , any > = { } ) {
69- console . log ( API . backendHost , endpoint , searchParams ) ;
7069 const url = new URL ( API . endpointPrefix + endpoint , API . backendHost ) ;
71- console . log ( "building url" , url , this . accessToken ) ;
7270
7371 Object . entries ( searchParams ) . map ( ( [ k , v ] ) => url . searchParams . set ( k , v ) ) ;
7472
@@ -77,7 +75,7 @@ export class API {
7775
7876 /**
7977 * Adds authentication headers to the request options if an access token is available.
80- *
78+ *
8179 * @param options - The fetch request options
8280 * @returns The modified request options with auth headers
8381 */
@@ -93,7 +91,7 @@ export class API {
9391
9492 /**
9593 * Makes an HTTP request to the specified URL.
96- *
94+ *
9795 * @param method - The HTTP method to use
9896 * @param url - The URL to request
9997 * @param options - Additional fetch options
@@ -108,7 +106,7 @@ export class API {
108106
109107 /**
110108 * Makes an HTTP request and parses the response as JSON.
111- *
109+ *
112110 * @template T - Type of the expected response data
113111 * @param method - The HTTP method to use
114112 * @param url - The URL to request
@@ -127,7 +125,7 @@ export class API {
127125
128126 /**
129127 * Convenience method for making GET requests.
130- *
128+ *
131129 * @param url - The URL to request
132130 * @param options - Additional fetch options
133131 * @returns A Promise resolving to the fetch Response
@@ -139,7 +137,7 @@ export class API {
139137
140138 /**
141139 * Convenience method for making POST requests.
142- *
140+ *
143141 * @param url - The URL to request
144142 * @param options - Additional fetch options
145143 * @returns A Promise resolving to the fetch Response
@@ -151,7 +149,7 @@ export class API {
151149
152150 /**
153151 * Convenience method for making PATCH requests.
154- *
152+ *
155153 * @param url - The URL to request
156154 * @param options - Additional fetch options
157155 * @returns A Promise resolving to the fetch Response
@@ -163,7 +161,7 @@ export class API {
163161
164162 /**
165163 * Convenience method for making DELETE requests.
166- *
164+ *
167165 * @param url - The URL to request
168166 * @param options - Additional fetch options
169167 * @returns A Promise resolving to the fetch Response
0 commit comments