@lomi./sdk
Version:
Official TypeScript SDK for the lomi. API
108 lines • 3.24 kB
JavaScript
import { OpenAPI } from '../core/OpenAPI.js';
import { request as __request } from '../core/request.js';
export class ProductService {
/**
* List products
* Retrieve a paginated list of products
* @returns any Successful response
* @throws ApiError
*/
static getProducts({ limit = 20, offset, sort, }) {
return __request(OpenAPI, {
method: 'GET',
url: '/products',
query: {
'limit': limit,
'offset': offset,
'sort': sort,
},
errors: {
401: `Unauthorized - Invalid or missing API key`,
500: `Internal server error`,
},
});
}
/**
* Create product
* Create a new product
* @returns products Successfully created
* @throws ApiError
*/
static postProducts({ requestBody, }) {
return __request(OpenAPI, {
method: 'POST',
url: '/products',
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Bad request - Invalid input`,
401: `Unauthorized - Invalid or missing API key`,
500: `Internal server error`,
},
});
}
/**
* Get product
* Retrieve a specific product by ID
* @returns products Successful response
* @throws ApiError
*/
static getProducts1({ productId, }) {
return __request(OpenAPI, {
method: 'GET',
url: '/products/{product_id}',
path: {
'product_id': productId,
},
errors: {
401: `Unauthorized - Invalid or missing API key`,
404: `Not found - Resource does not exist`,
500: `Internal server error`,
},
});
}
/**
* Update product
* Update a specific product
* @returns products Successfully updated
* @throws ApiError
*/
static patchProducts({ productId, requestBody, }) {
return __request(OpenAPI, {
method: 'PATCH',
url: '/products/{product_id}',
path: {
'product_id': productId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Bad request - Invalid input`,
401: `Unauthorized - Invalid or missing API key`,
404: `Not found - Resource does not exist`,
500: `Internal server error`,
},
});
}
/**
* Delete product
* Delete a specific product
* @returns void
* @throws ApiError
*/
static deleteProducts({ productId, }) {
return __request(OpenAPI, {
method: 'DELETE',
url: '/products/{product_id}',
path: {
'product_id': productId,
},
errors: {
401: `Unauthorized - Invalid or missing API key`,
404: `Not found - Resource does not exist`,
500: `Internal server error`,
},
});
}
}
//# sourceMappingURL=ProductService.js.map