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: update the default baseURL to the new kitsu domain #1051

Merged
merged 3 commits into from
Jan 3, 2025
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<a href=https://github.com/sponsors/wopian><img alt=sponsor src='https://flat.badgen.net/badge/sponsor/%E2%9D%A4/pink?icon=github'></a>
</p>

<p align=center>A simple, lightweight & framework agnostic <a href=http://jsonapi.org>JSON:API</a> client for <a href=https://kitsu.io>Kitsu.io</a> & other APIs</p>
<p align=center>A simple, lightweight & framework agnostic <a href=http://jsonapi.org>JSON:API</a> client for <a href=https://kitsu.app>kitsu.app</a> & other APIs</p>

#

Expand Down
48 changes: 24 additions & 24 deletions packages/kitsu-core/src/deserialise/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ describe('kitsu-core', () => {
relationships: {
follower: {
links: {
self: 'https://kitsu.io/follows/1/relationships/follower',
related: 'https://kitsu.io/follows/1/follower'
self: 'https://kitsu.app/follows/1/relationships/follower',
related: 'https://kitsu.app/follows/1/follower'
}
},
followed: {
links: {
self: 'https://kitsu.io/follows/1/relationships/followed',
related: 'https://kitsu.io/follows/1/followed'
self: 'https://kitsu.app/follows/1/relationships/followed',
related: 'https://kitsu.app/follows/1/followed'
}
}
}
Expand All @@ -269,14 +269,14 @@ describe('kitsu-core', () => {
relationships: {
follower: {
links: {
self: 'https://kitsu.io/follows/2/relationships/follower',
related: 'https://kitsu.io/follows/2/follower'
self: 'https://kitsu.app/follows/2/relationships/follower',
related: 'https://kitsu.app/follows/2/follower'
}
},
followed: {
links: {
self: 'https://kitsu.io/follows/2/relationships/followed',
related: 'https://kitsu.io/follows/2/followed'
self: 'https://kitsu.app/follows/2/relationships/followed',
related: 'https://kitsu.app/follows/2/followed'
}
}
}
Expand All @@ -302,14 +302,14 @@ describe('kitsu-core', () => {
},
follower: {
links: {
self: 'https://kitsu.io/follows/1/relationships/follower',
related: 'https://kitsu.io/follows/1/follower'
self: 'https://kitsu.app/follows/1/relationships/follower',
related: 'https://kitsu.app/follows/1/follower'
}
},
followed: {
links: {
self: 'https://kitsu.io/follows/1/relationships/followed',
related: 'https://kitsu.io/follows/1/followed'
self: 'https://kitsu.app/follows/1/relationships/followed',
related: 'https://kitsu.app/follows/1/followed'
}
}
},
Expand All @@ -321,14 +321,14 @@ describe('kitsu-core', () => {
},
follower: {
links: {
self: 'https://kitsu.io/follows/2/relationships/follower',
related: 'https://kitsu.io/follows/2/follower'
self: 'https://kitsu.app/follows/2/relationships/follower',
related: 'https://kitsu.app/follows/2/follower'
}
},
followed: {
links: {
self: 'https://kitsu.io/follows/2/relationships/followed',
related: 'https://kitsu.io/follows/2/followed'
self: 'https://kitsu.app/follows/2/relationships/followed',
related: 'https://kitsu.app/follows/2/followed'
}
}
}
Expand Down Expand Up @@ -370,8 +370,8 @@ describe('kitsu-core', () => {
relationships: {
primaryMedia: {
links: {
self: 'https://kitsu.io/characters/1/relationships/primary-media',
related: 'https://kitsu.io/characters/1/primary-media'
self: 'https://kitsu.app/characters/1/relationships/primary-media',
related: 'https://kitsu.app/characters/1/primary-media'
}
}
}
Expand All @@ -396,8 +396,8 @@ describe('kitsu-core', () => {
},
primaryMedia: {
links: {
self: 'https://kitsu.io/characters/1/relationships/primary-media',
related: 'https://kitsu.io/characters/1/primary-media'
self: 'https://kitsu.app/characters/1/relationships/primary-media',
related: 'https://kitsu.app/characters/1/primary-media'
}
}
}
Expand Down Expand Up @@ -1036,8 +1036,8 @@ describe('kitsu-core', () => {
relationships: {
follower: {
links: {
self: 'https://kitsu.io/follows/1/relationships/follower',
related: 'https://kitsu.io/follows/1/follower'
self: 'https://kitsu.app/follows/1/relationships/follower',
related: 'https://kitsu.app/follows/1/follower'
}
}
}
Expand Down Expand Up @@ -1067,8 +1067,8 @@ describe('kitsu-core', () => {
},
follower: {
links: {
self: 'https://kitsu.io/follows/1/relationships/follower',
related: 'https://kitsu.io/follows/1/follower'
self: 'https://kitsu.app/follows/1/relationships/follower',
related: 'https://kitsu.app/follows/1/follower'
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions packages/kitsu/MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,16 @@ data: {
id: '1',
type: 'libraryEntries'
links: {
self: 'https://kitsu.io/api/edge/library-entries/1'
self: 'https://kitsu.app/api/edge/library-entries/1'
},
attributes: {
ratingTwenty: 10
},
relationships: {
user: {
links: {
self: 'https://kitsu.io/api/edge/library-entries/1/relationships/user',
related: 'https://kitsu.io/api/edge/library-entries/1/user'
self: 'https://kitsu.app/api/edge/library-entries/1/relationships/user',
related: 'https://kitsu.app/api/edge/library-entries/1/user'
},
data: {
id: '2',
Expand All @@ -258,7 +258,7 @@ included: [
id: '2',
type: 'users',
links: {
self: 'https://kitsu.io/api/edge/users/2'
self: 'https://kitsu.app/api/edge/users/2'
},
attributes: {
name: 'Example'
Expand Down Expand Up @@ -291,19 +291,19 @@ data: {
id: '1',
type: 'libraryEntries',
links: {
self: 'https://kitsu.io/api/edge/library-entries/1'
self: 'https://kitsu.app/api/edge/library-entries/1'
},
ratingTwenty: 10,
user: {
links: {
self: 'https://kitsu.io/api/edge/library-entries/1/relationships/user',
related: 'https://kitsu.io/api/edge/library-entries/1/user'
self: 'https://kitsu.app/api/edge/library-entries/1/relationships/user',
related: 'https://kitsu.app/api/edge/library-entries/1/user'
}
data: {
id: '2',
type: 'users',
links: {
self: 'https://kitsu.io/api/edge/users/2'
self: 'https://kitsu.app/api/edge/users/2'
},
name: 'Example'
}
Expand Down
24 changes: 12 additions & 12 deletions packages/kitsu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const Kitsu = require("kitsu"); // CommonJS & Browserify
## Quick Start

```javascript
// Kitsu.io's API
// kitsu.app's API
const api = new Kitsu()

// Other JSON:API servers
Expand Down Expand Up @@ -173,7 +173,7 @@ api.get('users', {

[More Examples]

If you're working with [Kitsu.io]'s API, their [API docs][kitsu.io api docs] lists all available resources with their attributes & relationships
If you're working with [kitsu.app]'s API, their [API docs][kitsu.app api docs] lists all available resources with their attributes & relationships

## Contributing

Expand All @@ -187,15 +187,15 @@ See [CHANGELOG]

All code released under [MIT]

[kitsu.io]: https://kitsu.io
[kitsu.app]: https://kitsu.app

[json:api]: http://jsonapi.org

[promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises

[more examples]: https://github.com/wopian/kitsu/tree/master/packages/kitsu/example

[kitsu.io api docs]: https://kitsu.docs.apiary.io
[kitsu.app api docs]: https://kitsu.docs.apiary.io

[migration guide]: https://github.com/wopian/kitsu/blob/master/packages/kitsu/MIGRATING.md

Expand Down Expand Up @@ -249,7 +249,7 @@ Creates a new `kitsu` instance

* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`)

* `options.baseURL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Set the API endpoint (optional, default `https://kitsu.io/api/edge`)
* `options.baseURL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Set the API endpoint (optional, default `https://kitsu.app/api/edge`)
* `options.headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Additional headers to send with the requests
* `options.query` **(`"traditional"` | `"modern"` | [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function))** Query serializer function to use. This will impact the way keys are serialized when passing arrays as query parameters. 'modern' is recommended for new projects. (optional, default `traditional`)
* `options.camelCaseTypes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If enabled, `type` will be converted to camelCase from kebab-casae or snake\_case (optional, default `true`)
Expand All @@ -260,7 +260,7 @@ Creates a new `kitsu` instance

#### Examples

Using with Kitsu.io's API
Using with kitsu.app's API

```javascript
const api = new Kitsu()
Expand Down Expand Up @@ -399,12 +399,12 @@ Fetch resources (alias `fetch`)
* `config.params.sort` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Sort dataset by one or more comma separated attributes (prepend `-` for descending order) - [JSON:API Sorting](http://jsonapi.org/format/#fetching-sorting)
* `config.params.page` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** [JSON:API Pagination](http://jsonapi.org/format/#fetching-pagination). All pagination strategies are supported, even if they are not listed below.

* `config.params.page.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Number of resources to return in request (Offset-based) - **Note:** For Kitsu.io, max is `20` except on `libraryEntries` which has a max of `500`
* `config.params.page.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Number of resources to return in request (Offset-based) - **Note:** For kitsu.app, max is `20` except on `libraryEntries` which has a max of `500`
* `config.params.page.offset` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Number of resources to offset the dataset by (Offset-based)
* `config.params.page.number` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Page of resources to return in request (Page-based) - **Note:** Not supported on Kitsu.io
* `config.params.page.size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Number of resources to return in request (Page-based and cursor-based) - **Note:** Not supported on Kitsu.io
* `config.params.page.before` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Get the previous page of resources (Cursor-based) - **Note:** Not Supported on Kitsu.io
* `config.params.page.after` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Get the next page of resources (Cursor-based) - **Note:** Not Supported on Kitsu.io
* `config.params.page.number` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Page of resources to return in request (Page-based) - **Note:** Not supported on kitsu.app
* `config.params.page.size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Number of resources to return in request (Page-based and cursor-based) - **Note:** Not supported on kitsu.app
* `config.params.page.before` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Get the previous page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
* `config.params.page.after` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Get the next page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
* `config.axiosOptions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)

##### Examples
Expand Down Expand Up @@ -461,7 +461,7 @@ Getting a resource's relationship data only
api.get('anime/2/categories')
```

Getting a resource with nested JSON:API filters (not supported by Kitsu.io's API)
Getting a resource with nested JSON:API filters (not supported by kitsu.app's API)

```javascript
// resource?filter[x][y]=value
Expand Down
2 changes: 1 addition & 1 deletion packages/kitsu/example/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const app = async () => {
const { owner } = new OAuth2({
clientId: '',
clientSecret: '',
accessTokenUri: 'https://kitsu.io/api/oauth/token'
accessTokenUri: 'https://kitsu.app/api/oauth/token'
})

const { accessToken } = await owner.getToken('username', 'password')
Expand Down
2 changes: 1 addition & 1 deletion packages/kitsu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"keywords": [
"kitsu",
"kitsu.io",
"kitsu.app",
"anime",
"manga",
"drama",
Expand Down
18 changes: 9 additions & 9 deletions packages/kitsu/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import pluralise from 'pluralize'
* Creates a new `kitsu` instance
*
* @param {Object} [options] Options
* @param {string} [options.baseURL=https://kitsu.io/api/edge] Set the API endpoint
* @param {string} [options.baseURL=https://kitsu.app/api/edge] Set the API endpoint
* @param {Object} [options.headers] Additional headers to send with the requests
* @param {'traditional'|'modern'|Function} [options.query=traditional] Query serializer function to use. This will impact the way keys are serialized when passing arrays as query parameters. 'modern' is recommended for new projects.
* @param {boolean} [options.camelCaseTypes=true] If enabled, `type` will be converted to camelCase from kebab-casae or snake_case
* @param {'kebab'|'snake'|'none'} [options.resourceCase=kebab] Case to convert camelCase to. `kebab` - `/library-entries`; `snake` - /library_entries`; `none` - `/libraryEntries`
* @param {boolean} [options.pluralize=true] If enabled, `/user` will become `/users` in the URL request and `type` will be pluralized in POST, PATCH and DELETE requests
* @param {number} [options.timeout=30000] Set the request timeout in milliseconds
* @param {Object} [options.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
* @example <caption>Using with Kitsu.io's API</caption>
* @example <caption>Using with kitsu.app's API</caption>
* const api = new Kitsu()
* @example <caption>Using another API server</caption>
* const api = new Kitsu({
Expand Down Expand Up @@ -74,7 +74,7 @@ export default class Kitsu {

this.axios = axios.create({
...{
baseURL: options.baseURL || 'https://kitsu.io/api/edge',
baseURL: options.baseURL || 'https://kitsu.app/api/edge',
timeout: options.timeout || 30000
},
paramsSerializer: { serialize: /* istanbul ignore next */ p => this.query(p) },
Expand Down Expand Up @@ -133,12 +133,12 @@ export default class Kitsu {
* @param {string} [config.params.include] Include relationship data - [JSON:API Includes](http://jsonapi.org/format/#fetching-includes)
* @param {string} [config.params.sort] Sort dataset by one or more comma separated attributes (prepend `-` for descending order) - [JSON:API Sorting](http://jsonapi.org/format/#fetching-sorting)
* @param {Object} [config.params.page] [JSON:API Pagination](http://jsonapi.org/format/#fetching-pagination). All pagination strategies are supported, even if they are not listed below.
* @param {number} [config.params.page.limit] Number of resources to return in request (Offset-based) - **Note:** For Kitsu.io, max is `20` except on `libraryEntries` which has a max of `500`
* @param {number} [config.params.page.limit] Number of resources to return in request (Offset-based) - **Note:** For kitsu.app, max is `20` except on `libraryEntries` which has a max of `500`
* @param {number} [config.params.page.offset] Number of resources to offset the dataset by (Offset-based)
* @param {number} [config.params.page.number] Page of resources to return in request (Page-based) - **Note:** Not supported on Kitsu.io
* @param {number} [config.params.page.size] Number of resources to return in request (Page-based and cursor-based) - **Note:** Not supported on Kitsu.io
* @param {string} [config.params.page.before] Get the previous page of resources (Cursor-based) - **Note:** Not Supported on Kitsu.io
* @param {string} [config.params.page.after] Get the next page of resources (Cursor-based) - **Note:** Not Supported on Kitsu.io
* @param {number} [config.params.page.number] Page of resources to return in request (Page-based) - **Note:** Not supported on kitsu.app
* @param {number} [config.params.page.size] Number of resources to return in request (Page-based and cursor-based) - **Note:** Not supported on kitsu.app
* @param {string} [config.params.page.before] Get the previous page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
* @param {string} [config.params.page.after] Get the next page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
* @returns {Object} JSON-parsed response
* @example <caption>Getting a resource with JSON:API parameters</caption>
Expand Down Expand Up @@ -173,7 +173,7 @@ export default class Kitsu {
* })
* @example <caption>Getting a resource's relationship data only</caption>
* api.get('anime/2/categories')
* @example <caption>Getting a resource with nested JSON:API filters (not supported by Kitsu.io's API)</caption>
* @example <caption>Getting a resource with nested JSON:API filters (not supported by kitsu.app's API)</caption>
* // resource?filter[x][y]=value
* api.get('resource', {
* params: {
Expand Down
4 changes: 2 additions & 2 deletions packages/kitsu/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ describe('kitsu', () => {
expect(api.plural('apple')).toBe('apple')
})

it('uses Kitsu.io\'s API by default', () => {
it('uses kitsu.app\'s API by default', () => {
expect.assertions(1)
const api = new Kitsu()
expect(api.axios.defaults.baseURL).toBe('https://kitsu.io/api/edge')
expect(api.axios.defaults.baseURL).toBe('https://kitsu.app/api/edge')
})

it('uses the API provided in constructor', () => {
Expand Down
Loading
Loading