Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/docs #3

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# sneakerdb-client
A TypeScript client for interacting with The Sneaker Database API on RapidAPI. This npm package provides easy-to-use functions to fetch and manipulate data from the sneaker database.
# SneakerDB Client


[![Maintainability](https://api.codeclimate.com/v1/badges/b6ea0145e62b94aec72f/maintainability)](https://codeclimate.com/github/angelxmoreno/sneakerdb-client/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/b6ea0145e62b94aec72f/test_coverage)](https://codeclimate.com/github/angelxmoreno/sneakerdb-client/test_coverage)
[![codecov](https://codecov.io/gh/angelxmoreno/sneakerdb-client/graph/badge.svg?token=vhU44wLf2A)](https://codecov.io/gh/angelxmoreno/sneakerdb-client)
[![Build on Main](https://github.com/angelxmoreno/sneakerdb-client/actions/workflows/manual-build.yml/badge.svg)](https://github.com/angelxmoreno/sneakerdb-client/actions/workflows/manual-build.yml)
[![License](https://img.shields.io/github/license/angelxmoreno/sneakerdb-client?label=License)](https://github.com/angelxmoreno/sneakerdb-client/blob/main/LICENSE)
[![Last Commit](https://img.shields.io/github/last-commit/angelxmoreno/sneakerdb-client?label=Last%20Commit)](https://github.com/angelxmoreno/sneakerdb-client/commits/main)
[![dependencies](https://img.shields.io/librariesio/release/npm/sneakerdb-client?color=%23007a1f&style=flat-square)](https://libraries.io/npm/sneakerdb-client)

Node.js client for interacting with the Sneaker Database API.

## Installation

```bash
npm install sneakerdb-client
```

## Usage

```ts
const { TheSneakerDatabaseClient } = require('sneakerdb-client');

// Create a client instance with your API key
const client = new TheSneakerDatabaseClient('your-api-key');

// Example: Get sneakers
client.getSneakers({ limit: 5 }).then(response => {
console.log(response);
});
```

## API
There are 4 methods available on the client instance:
- getSneakers: gets a list of sneakers based on the provided options.
- getSneakerById: gets a sneaker by its TheSneakerDatabase ID.
- getBrands: Gets the list of brands
- getGenders: get the list of genders
- search: search for sneakers based on the provided options.

For more information on the available options, please refer to the [API documentation](https://rapidapi.com/tg4-solutions-tg4-solutions-default/api/the-sneaker-database).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
4 changes: 2 additions & 2 deletions src/TheSneakerDatabaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { handleAxiosError } from './utils';
export class TheSneakerDatabaseClient {
protected client: AxiosInstance;

constructor(rapidApiKey: string, axiosParam: AxiosInstance | CreateAxiosDefaults) {
constructor(rapidApiKey: string, axiosParam?: AxiosInstance | CreateAxiosDefaults) {
this.client = this.configureAxiosInstance(rapidApiKey, axiosParam);
}

protected configureAxiosInstance(
rapidApiKey: string,
axiosParam: AxiosInstance | CreateAxiosDefaults,
axiosParam?: AxiosInstance | CreateAxiosDefaults,
): AxiosInstance {
const instance =
axiosParam instanceof axios
Expand Down
Loading