Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabb-c authored Sep 16, 2024
1 parent 3fee70c commit 24d9060
Showing 1 changed file with 4 additions and 30 deletions.
34 changes: 4 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,13 @@ pnpm add axios axios-cache-interceptor pokenode-ts

## Basic Example

Using a client, like PokemonClient:

```ts
import { PokemonClient } from 'pokenode-ts';

(async () => {
const api = new PokemonClient();

try {
const pokemonData = await api.getPokemonByName('luxray');
console.log(pokemonData.name); // Outputs "Luxray"
} catch (error) {
console.error(error);
}
})();
import { PokemonClient } from 'pokenode-ts'; // Import the Client

```

Or, using the MainClient:
const pokemon = await api.getPokemonByName('luxray') // Make the request
.catch(() => console.log("Oops!"));

```ts
import { MainClient } from 'pokenode-ts';

(async () => {
const api = new MainClient();

try {
const pokemonData = await api.pokemon.getPokemonByName('luxray');
console.log(pokemonData.name); // Outputs "Luxray"
} catch (error) {
console.error(error);
}
})();
console.log(pokemon.name); // Typesafe response ✨ (Outputs "Luxray")
```

## Documentation
Expand Down

0 comments on commit 24d9060

Please sign in to comment.