Skip to content

Commit

Permalink
chore(release): 0.3.0 [skip ci]
Browse files Browse the repository at this point in the history
# [0.3.0](v0.2.0...v0.3.0) (2025-01-19)

### Bug Fixes

* **Pagination:** Improve nullish checks for resultsPerPage and totalResults in Pagination class ([aaeae08](aaeae08))

### Features

* Implement Result-based error handling ([6e1aaf0](6e1aaf0))
  • Loading branch information
semantic-release-bot committed Jan 19, 2025
1 parent 642cba0 commit 6c5cb2d
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 39 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# [0.3.0](https://github.com/suzuki3jp/youtubes.js/compare/v0.2.0...v0.3.0) (2025-01-19)


### Bug Fixes

* **Pagination:** Improve nullish checks for resultsPerPage and totalResults in Pagination class ([aaeae08](https://github.com/suzuki3jp/youtubes.js/commit/aaeae082364668e1d721c1594315eed3851858f0))


### Features

* Implement Result-based error handling ([6e1aaf0](https://github.com/suzuki3jp/youtubes.js/commit/6e1aaf0f15750833ddc273b55519cb2893ef482a))

# [0.2.0](https://github.com/suzuki3jp/youtubes.js/compare/v0.1.2...v0.2.0) (2025-01-18)


Expand Down
4 changes: 2 additions & 2 deletions docs/api/youtubes.js.pagination.all.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Fetches all pages data. - \*\*NOTE\*\*: This method may consume unnecessary quot
**Signature:**

```typescript
all(): Promise<T[]>;
all(): Promise<Result<T[], YouTubesJsErrors>>;
```
**Returns:**

Promise&lt;T\[\]&gt;
Promise&lt;Result&lt;T\[\], YouTubesJsErrors&gt;&gt;

All pages data in an array. If several items are in a page, this method will return a 2D array. Use `flat()` to convert it to a 1D array.

Expand Down
4 changes: 2 additions & 2 deletions docs/api/youtubes.js.pagination.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Fetches the next page. - \*\*NOTE\*\*: This method will use the same quotas as t
**Signature:**

```typescript
next(): Promise<Pagination<T> | null>;
next(): Promise<Result<Pagination<T>, YouTubesJsErrors> | null>;
```
**Returns:**

Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt; \| null&gt;
Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt;, YouTubesJsErrors&gt; \| null&gt;

The next page. If there is no next page, returns `null`<!-- -->.

Expand Down
4 changes: 2 additions & 2 deletions docs/api/youtubes.js.pagination.prev.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Fetches the previous page. - \*\*NOTE\*\*: This method will use the same quotas
**Signature:**

```typescript
prev(): Promise<Pagination<T> | null>;
prev(): Promise<Result<Pagination<T>, YouTubesJsErrors> | null>;
```
**Returns:**

Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt; \| null&gt;
Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt;, YouTubesJsErrors&gt; \| null&gt;

The previous page. If there is no previous page, returns `null`<!-- -->.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/youtubes.js.paginationoptions.getwithtoken.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
**Signature:**

```typescript
getWithToken: (token: string) => Promise<Pagination<T>>;
getWithToken: (token: string) => Promise<Result<Pagination<T>, YouTubesJsErrors>>;
```
2 changes: 1 addition & 1 deletion docs/api/youtubes.js.paginationoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ T

</td><td>

(token: string) =&gt; Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt;&gt;
(token: string) =&gt; Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;T&gt;, YouTubesJsErrors&gt;&gt;


</td><td>
Expand Down
4 changes: 2 additions & 2 deletions docs/api/youtubes.js.playlist.from.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**Signature:**

```typescript
static from(data: youtube_v3.Schema$Playlist, logger: Logger): Result<Playlist, string>;
static from(data: youtube_v3.Schema$Playlist, logger: Logger): Result<Playlist, LikelyBugError>;
```

## Parameters
Expand Down Expand Up @@ -59,5 +59,5 @@ Logger
</tbody></table>
**Returns:**

Result&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->, string&gt;
Result&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->, LikelyBugError&gt;

63 changes: 63 additions & 0 deletions docs/api/youtubes.js.playlist.frommany.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [youtubes.js](./youtubes.js.md) &gt; [Playlist](./youtubes.js.playlist.md) &gt; [fromMany](./youtubes.js.playlist.frommany.md)

## Playlist.fromMany() method

**Signature:**

```typescript
static fromMany(data: youtube_v3.Schema$Playlist[], logger: Logger): Result<Playlist[], LikelyBugError>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

data


</td><td>

youtube\_v3.Schema$Playlist\[\]


</td><td>


</td></tr>
<tr><td>

logger


</td><td>

Logger


</td><td>


</td></tr>
</tbody></table>
**Returns:**

Result&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\], LikelyBugError&gt;

14 changes: 14 additions & 0 deletions docs/api/youtubes.js.playlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,19 @@ Description
</td><td>


</td></tr>
<tr><td>

[fromMany(data, logger)](./youtubes.js.playlist.frommany.md)


</td><td>

`static`


</td><td>


</td></tr>
</tbody></table>
8 changes: 5 additions & 3 deletions docs/api/youtubes.js.playlistmanager.create.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

## PlaylistManager.create() method

Creates a playlist. - This operation uses 50 quota units. - There is a limit of approximately 10 playlists per day for creation. - For more details, see the issue: https://issuetracker.google.com/issues/255216949
Creates a playlist.

- This operation uses 50 quota units. - There is a limit of approximately 10 playlists per day for creation. - For more details, see the issue: https://issuetracker.google.com/issues/255216949

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/insert)

**Signature:**

```typescript
create(options: CreatePlaylistOptions): Promise<Playlist>;
create(options: CreatePlaylistOptions): Promise<Result<Playlist, YouTubesJsErrors>>;
```

## Parameters
Expand Down Expand Up @@ -51,5 +53,5 @@ Options for creating a playlist.
</tbody></table>
**Returns:**

Promise&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->&gt;
Promise&lt;Result&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->, YouTubesJsErrors&gt;&gt;

4 changes: 3 additions & 1 deletion docs/api/youtubes.js.playlistmanager.deletebyid.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

## PlaylistManager.deleteById() method

Deletes a playlist by its ID. - This operation uses 50 quota units.
Deletes a playlist by its ID.

- This operation uses 50 quota units.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/delete)

Expand Down
12 changes: 7 additions & 5 deletions docs/api/youtubes.js.playlistmanager.getbychannelid.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

## PlaylistManager.getByChannelId() method

Fetches the playlists of a channel by its ID. - This operation uses 1 quota unit. - Retrieves all playlists when given an authenticated user's channel ID. Otherwise, only public playlists are accessible.
Fetches the playlists of a channel by its ID.

- This operation uses 1 quota unit. - Retrieves all playlists when given an authenticated user's channel ID. Otherwise, only public playlists are accessible.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

**Signature:**

```typescript
getByChannelId(id: string, pageToken?: string): Promise<Pagination<Playlist[]>>;
getByChannelId(id: string, pageToken?: string): Promise<Result<Pagination<Playlist[]>, YouTubesJsErrors>>;
```

## Parameters
Expand Down Expand Up @@ -67,7 +69,7 @@ _(Optional)_ The token for pagination.
</tbody></table>
**Returns:**

Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;&gt;
Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;, YouTubesJsErrors&gt;&gt;

## Example

Expand All @@ -80,7 +82,7 @@ const oauth = new StaticOAuthProvider({
});
const client = new ApiClient({ oauth });

const playlists = await client.playlists.getByChannelId("CHANNEL_ID");
console.log(playlists.data); // Playlist[]
// THIS IS UNSAFE ERROR HANDLING. See the safe error handling in the README.md Introduction.
const playlists = (await client.playlists.getByChannelId("CHANNEL_ID")).throw(); // Pagination<Playlist[]>
```

12 changes: 7 additions & 5 deletions docs/api/youtubes.js.playlistmanager.getbyids.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

## PlaylistManager.getByIds() method

Fetches a playlist by its ID. - This operation uses 1 quota unit.
Fetches a playlist by its ID.

- This operation uses 1 quota unit. - Note: The YouTube API returns empty data instead of an error when a playlist with the specified ID is not found.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

**Signature:**

```typescript
getByIds(ids: string[], pageToken?: string): Promise<Pagination<Playlist[]>>;
getByIds(ids: string[], pageToken?: string): Promise<Result<Pagination<Playlist[]>, YouTubesJsErrors>>;
```

## Parameters
Expand Down Expand Up @@ -67,7 +69,7 @@ _(Optional)_ The token for pagination.
</tbody></table>
**Returns:**

Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;&gt;
Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;, YouTubesJsErrors&gt;&gt;

## Example

Expand All @@ -80,7 +82,7 @@ const oauth = new StaticOAuthProvider({
});
const client = new ApiClient({ oauth });

const playlists = await client.playlists.getByIds(["ID1", "ID2"]);
console.log(playlists.data); // [Playlist, Playlist]
// THIS IS UNSAFE ERROR HANDLING. See the safe error handling in the README.md Introduction.
const playlists = (await client.playlists.getByIds(["ID1", "ID2"])).throw(); // Pagination<Playlist[]>
```

12 changes: 7 additions & 5 deletions docs/api/youtubes.js.playlistmanager.getmine.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

## PlaylistManager.getMine() method

Fetches the playlists owned by the authenticated user. - This operation uses 1 quota unit.
Fetches the playlists owned by the authenticated user.

- This operation uses 1 quota unit.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

**Signature:**

```typescript
getMine(pageToken?: string): Promise<Pagination<Playlist[]>>;
getMine(pageToken?: string): Promise<Result<Pagination<Playlist[]>, YouTubesJsErrors>>;
```

## Parameters
Expand Down Expand Up @@ -51,7 +53,7 @@ _(Optional)_ The token for pagination.
</tbody></table>
**Returns:**

Promise&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;&gt;
Promise&lt;Result&lt;[Pagination](./youtubes.js.pagination.md)<!-- -->&lt;[Playlist](./youtubes.js.playlist.md)<!-- -->\[\]&gt;, YouTubesJsErrors&gt;&gt;

## Example

Expand All @@ -64,7 +66,7 @@ const oauth = new StaticOAuthProvider({
});

const client = new ApiClient({ oauth });
const playlists = await client.playlists.getMine();
console.log(playlists.data); // Playlist[]
// THIS IS UNSAFE ERROR HANDLING. See the safe error handling in the README.md Introduction.
const playlists = (await client.playlists.getMine()).throw(); // Pagination<Playlist[]>
```

20 changes: 15 additions & 5 deletions docs/api/youtubes.js.playlistmanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ Description

</td><td>

Creates a playlist. - This operation uses 50 quota units. - There is a limit of approximately 10 playlists per day for creation. - For more details, see the issue: https://issuetracker.google.com/issues/255216949
Creates a playlist.

- This operation uses 50 quota units. - There is a limit of approximately 10 playlists per day for creation. - For more details, see the issue: https://issuetracker.google.com/issues/255216949

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/insert)

Expand All @@ -92,7 +94,9 @@ Creates a playlist. - This operation uses 50 quota units. - There is a limit of

</td><td>

Deletes a playlist by its ID. - This operation uses 50 quota units.
Deletes a playlist by its ID.

- This operation uses 50 quota units.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/delete)

Expand All @@ -108,7 +112,9 @@ Deletes a playlist by its ID. - This operation uses 50 quota units.

</td><td>

Fetches the playlists of a channel by its ID. - This operation uses 1 quota unit. - Retrieves all playlists when given an authenticated user's channel ID. Otherwise, only public playlists are accessible.
Fetches the playlists of a channel by its ID.

- This operation uses 1 quota unit. - Retrieves all playlists when given an authenticated user's channel ID. Otherwise, only public playlists are accessible.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

Expand All @@ -124,7 +130,9 @@ Fetches the playlists of a channel by its ID. - This operation uses 1 quota unit

</td><td>

Fetches a playlist by its ID. - This operation uses 1 quota unit.
Fetches a playlist by its ID.

- This operation uses 1 quota unit. - Note: The YouTube API returns empty data instead of an error when a playlist with the specified ID is not found.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

Expand All @@ -140,7 +148,9 @@ Fetches a playlist by its ID. - This operation uses 1 quota unit.

</td><td>

Fetches the playlists owned by the authenticated user. - This operation uses 1 quota unit.
Fetches the playlists owned by the authenticated user.

- This operation uses 1 quota unit.

\[YouTube Data API Reference\](https://developers.google.com/youtube/v3/docs/playlists/list)

Expand Down
4 changes: 2 additions & 2 deletions docs/api/youtubes.js.thumbnails.from.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generates a `Thumbnails` instance from the YouTube API raw data.
**Signature:**

```typescript
static from(data: youtube_v3.Schema$ThumbnailDetails, logger: Logger): Result<Thumbnails, string>;
static from(data: youtube_v3.Schema$ThumbnailDetails, logger: Logger): Result<Thumbnails, LikelyBugError>;
```

## Parameters
Expand Down Expand Up @@ -63,5 +63,5 @@ Logger
</tbody></table>
**Returns:**

Result&lt;[Thumbnails](./youtubes.js.thumbnails.md)<!-- -->, string&gt;
Result&lt;[Thumbnails](./youtubes.js.thumbnails.md)<!-- -->, LikelyBugError&gt;

Loading

0 comments on commit 6c5cb2d

Please sign in to comment.