Skip to content

Commit

Permalink
Add package readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
darthmaim committed Nov 10, 2023
1 parent d9691df commit d2f139d
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# gw2api

TypeScript first packages to work with the Guild Wars 2 API

- [`@gw2api/types`](./packages/types/): Strong types for all data structures used by the Guild Wars 2 API
- [`@gw2api/fetch`](./packages/fetch/): Tiny wrapper around fetch that returns type-safe responses.
- [`@gw2api/client`](./packages/client/): High level abstraction to access the Guild Wars 2 API with support for automatic batching, middlewares, caching, rate-limiting and more.


## Contributing

1. Clone this repository or [make a fork](https://docs.github.com/en/github/getting-started-with-github/quickstart/fork-a-repo) if you plan to submit your changes.
2. Run `npm install` to install the required dependencies.
3. Make your changes.
4. Run `npm run test` to test your changes (make sure to include new tests if you add new functionality).
4. Commit the changes to a new branch and push them to your fork.
5. Create a new [Pull Request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).


## License

Licensed under the [MIT License](./LICENSE).
21 changes: 21 additions & 0 deletions packages/client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 darthmaim

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions packages/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `@gw2api/client`

This package provies a high level abstraction to access the Guild Wars 2 API in a typesafe way.

## Usage

> [!WARNING]
> This package is still highly Work In Progress and the API might change drastically in the first few versions.

```ts
import { Gw2ApiClient } from '@gw2api/client';

const client = new Gw2ApiClient();

// get the first 10 items in german
const items = await client.items.lang('de').page(0, 10);
// -> Array<{ id: number, name: string, ... }>
```

## Installation

```sh
npm i @gw2api/client
```

## Contributing

See [parent readme](../../README.md#contributing).

## License

Licensed under the [MIT License](./LICENSE).
21 changes: 21 additions & 0 deletions packages/fetch/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 darthmaim

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions packages/fetch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# `@gw2api/fetch`

This package provides a tiny wrapper around native fetch to call the Guild Wars 2 API that returns typesafe responses.

## Usage

```ts
import { fetchGw2Api } from '@gw2api/fetch';

const item = await fetchGw2Api('/v2/items/1234');
// -> { id: number, name: string, ... }
```

## Installation

```sh
npm i @gw2api/fetch
```

## Contributing

See [parent readme](../../README.md#contributing).

## License

Licensed under the [MIT License](./LICENSE).
21 changes: 21 additions & 0 deletions packages/types/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 darthmaim

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions packages/types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# `@gw2api/types`

TypeScript types for all datastructures used by the Guild Wars 2 API.

## Usage

You can use this library to add strong types when working with the Guild Wars 2 API and not using `@gw2api/fetch` or `@gw2api/client`, for example when using your own api client, working with data from a database, or writing helper functions.

```ts
import type { Gw2Api, EndpointType } from '@gw2api/types';

function getItemName(item: Gw2Api.V2.Item) {
return item.name;
}

type ItemEndpointResponse = EndpointType<'/v2/items?ids=1,2,3'>;
// -> Array<{ id: number, name: string, ... }>
```

## Installation

```sh
npm i @gw2api/types
```

## Contributing

See [parent readme](../../README.md#contributing).

## License

Licensed under the [MIT License](./LICENSE).

0 comments on commit d2f139d

Please sign in to comment.