platzi-sdks
v1.0.1
Published
TypeScript SDK for the Platzi Fake Store API (EscuelaJS)
Maintainers
Readme
platzi-sdks
TypeScript SDK for the Platzi Fake Store API (EscuelaJS), based on the official docs: https://fakeapi.platzi.com/en/about/introduction/
Install
npm install platzi-sdksFor local development in this repo:
npm install
npm run buildQuick Start
import { PlatziSdk } from 'platzi-sdks';
const sdk = new PlatziSdk();
async function main() {
const products = await sdk.products.list({ limit: 5, offset: 0 });
console.log(products);
const tokens = await sdk.auth.login({
email: '[email protected]',
password: 'admin123',
});
sdk.setAccessToken(tokens.access_token);
const profile = await sdk.auth.profile();
console.log(profile);
}
main().catch(console.error);What Is Included
- Products (
/products) - Categories (
/categories) - Users (
/users) - Auth (
/auth/login,/auth/profile,/auth/refresh-token) - Files (
/files/upload,/files/{fileName}) - Locations (
/locations)
Publish To npm
Before publishing, update these fields in package.json:
name(must be unique on npm, or use your own scope like@your-scope/platzi-sdk)authorlicense(if needed)repository(optional but recommended)
Then publish:
npm login
npm run build
npm publish --access publicNotes
- Requires Node.js 18+ (uses native
fetch,FormData, andBlob) - Pass a custom
fetchFnin the constructor if you need another runtime/client
