venice-ai-sdk-apl
Version:
A comprehensive SDK for the Venice AI API with CLI support, programmatic CLI usage, CLI-style interface, and interactive demo
88 lines • 2.23 kB
JavaScript
;
/**
* Base Resource class
*
* This class serves as the base for all API resources.
* It provides common functionality for making API requests.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseResource = void 0;
/**
* Base Resource class
*/
class BaseResource {
/**
* Creates a new resource
*
* @param http - HTTP client
*/
constructor(http) {
this.http = http;
}
/**
* Makes a GET request to the API
*
* @param path - API path
* @param query - Query parameters
* @param options - Additional request options
* @returns Promise that resolves with the response data
*/
async get(path, query, options = {}) {
return this.http.request({
path,
method: 'GET',
query,
...options,
});
}
/**
* Makes a POST request to the API
*
* @param path - API path
* @param body - Request body
* @param options - Additional request options
* @returns Promise that resolves with the response data
*/
async post(path, body, options = {}) {
return this.http.request({
path,
method: 'POST',
body,
...options,
});
}
/**
* Makes a PUT request to the API
*
* @param path - API path
* @param body - Request body
* @param options - Additional request options
* @returns Promise that resolves with the response data
*/
async put(path, body, options = {}) {
return this.http.request({
path,
method: 'PUT',
body,
...options,
});
}
/**
* Makes a DELETE request to the API
*
* @param path - API path
* @param query - Query parameters
* @param options - Additional request options
* @returns Promise that resolves with the response data
*/
async delete(path, query, options = {}) {
return this.http.request({
path,
method: 'DELETE',
query,
...options,
});
}
}
exports.BaseResource = BaseResource;
//# sourceMappingURL=base-resource.js.map