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

Feature/java rate limit #117

Merged
merged 1 commit into from
Apr 24, 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
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,25 @@ Method | HTTP request | Description
- [WebhooksListResponse](https://github.com/apivideo/api.video-java-client/blob/main/docs/WebhooksListResponse.md)


### Documentation for Authorization
### Rate Limiting

api.video implements rate limiting to ensure fair usage and stability of the service. The API provides the rate limit values in the response headers for any API requests you make. The /auth endpoint is the only route without rate limitation.

In this client, you can access these headers by using the `*WithHttpInfo()` or `*Async` versions of the methods. These methods return the `ApiResponse` that contains the response body and the headers, allowing you to check the `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Retry-After` headers to understand your current rate limit status.
Read more about these response headers in the [API reference](https://docs.api.video/reference#limitation).

Here is an example of how to use these methods:

```java
ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
ApiResponse<Video> response = client.videos().uploadWithUploadTokenWithHttpInfo("YOUR_UPLOAD_TOKEN", File("my-video.mp4"));
Map<String, List<String>> headers = response.getHeaders();
System.out.println("X-RateLimit-Limit: " + headers.get("X-RateLimit-Limit").get(0));
System.out.println("X-RateLimit-Remaining: " + headers.get("X-RateLimit-Remaining").get(0));
System.out.println("X-RateLimit-Retry-After: " + headers.get("X-RateLimit-Retry-After").get(0));
```

### Authorization

#### API key

Expand Down
4 changes: 4 additions & 0 deletions docs/AdvancedAuthenticationApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Method | HTTP request | Description
<a name="authenticate"></a>
# **authenticate**
> AccessToken authenticate(authenticatePayload)
> okhttp3.Call authenticateAsync(authenticatePayload, callback)
> ApiResponse<AccessToken> authenticateWithHttpInfo(authenticatePayload)

Get Bearer Token

Expand Down Expand Up @@ -80,6 +82,8 @@ No authorization required
<a name="refresh"></a>
# **refresh**
> AccessToken refresh(refreshTokenPayload)
> okhttp3.Call refreshAsync(refreshTokenPayload, callback)
> ApiResponse<AccessToken> refreshWithHttpInfo(refreshTokenPayload)

Refresh Bearer Token

Expand Down
8 changes: 6 additions & 2 deletions docs/AnalyticsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Method | HTTP request | Description

<a name="getLiveStreamsPlays"></a>
# **getLiveStreamsPlays**
> AnalyticsPlaysResponse getLiveStreamsPlays(from, dimension).to(to).filter(filter).currentPage(currentPage).pageSize(pageSize).execute();
> AnalyticsPlaysResponse getLiveStreamsPlays(from, dimension).to(to).filter(filter).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<AnalyticsPlaysResponse> executeWithHttpInfo()

Get play events for live stream

Expand Down Expand Up @@ -95,7 +97,9 @@ Name | Type | Description | Notes

<a name="getVideosPlays"></a>
# **getVideosPlays**
> AnalyticsPlaysResponse getVideosPlays(from, dimension).to(to).filter(filter).currentPage(currentPage).pageSize(pageSize).execute();
> AnalyticsPlaysResponse getVideosPlays(from, dimension).to(to).filter(filter).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<AnalyticsPlaysResponse> executeWithHttpInfo()

Get play events for video

Expand Down
12 changes: 11 additions & 1 deletion docs/CaptionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Method | HTTP request | Description
<a name="upload"></a>
# **upload**
> Caption upload(videoId, language, file)
> okhttp3.Call uploadAsync(videoId, language, file, callback)
> ApiResponse<Caption> uploadWithHttpInfo(videoId, language, file)

Upload a caption

Expand Down Expand Up @@ -87,6 +89,8 @@ Name | Type | Description | Notes
<a name="get"></a>
# **get**
> Caption get(videoId, language)
> okhttp3.Call getAsync(videoId, language, callback)
> ApiResponse<Caption> getWithHttpInfo(videoId, language)

Retrieve a caption

Expand Down Expand Up @@ -160,6 +164,8 @@ Name | Type | Description | Notes
<a name="update"></a>
# **update**
> Caption update(videoId, language, captionsUpdatePayload)
> okhttp3.Call updateAsync(videoId, language, captionsUpdatePayload, callback)
> ApiResponse<Caption> updateWithHttpInfo(videoId, language, captionsUpdatePayload)

Update a caption

Expand Down Expand Up @@ -235,6 +241,8 @@ Name | Type | Description | Notes
<a name="delete"></a>
# **delete**
> delete(videoId, language)
> okhttp3.Call deleteAsync(videoId, language, callback)
> ApiResponse<Void> deleteWithHttpInfo(videoId, language)

Delete a caption

Expand Down Expand Up @@ -304,7 +312,9 @@ null (empty response body)

<a name="list"></a>
# **list**
> CaptionsListResponse list(videoId).currentPage(currentPage).pageSize(pageSize).execute();
> CaptionsListResponse list(videoId).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<CaptionsListResponse> executeWithHttpInfo()

List video captions

Expand Down
10 changes: 9 additions & 1 deletion docs/ChaptersApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Method | HTTP request | Description
<a name="upload"></a>
# **upload**
> Chapter upload(videoId, language, file)
> okhttp3.Call uploadAsync(videoId, language, file, callback)
> ApiResponse<Chapter> uploadWithHttpInfo(videoId, language, file)

Upload a chapter

Expand Down Expand Up @@ -86,6 +88,8 @@ Name | Type | Description | Notes
<a name="get"></a>
# **get**
> Chapter get(videoId, language)
> okhttp3.Call getAsync(videoId, language, callback)
> ApiResponse<Chapter> getWithHttpInfo(videoId, language)

Retrieve a chapter

Expand Down Expand Up @@ -156,6 +160,8 @@ Name | Type | Description | Notes
<a name="delete"></a>
# **delete**
> delete(videoId, language)
> okhttp3.Call deleteAsync(videoId, language, callback)
> ApiResponse<Void> deleteWithHttpInfo(videoId, language)

Delete a chapter

Expand Down Expand Up @@ -224,7 +230,9 @@ null (empty response body)

<a name="list"></a>
# **list**
> ChaptersListResponse list(videoId).currentPage(currentPage).pageSize(pageSize).execute();
> ChaptersListResponse list(videoId).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<ChaptersListResponse> executeWithHttpInfo()

List video chapters

Expand Down
16 changes: 15 additions & 1 deletion docs/LiveStreamsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Method | HTTP request | Description
<a name="create"></a>
# **create**
> LiveStream create(liveStreamCreationPayload)
> okhttp3.Call createAsync(liveStreamCreationPayload, callback)
> ApiResponse<LiveStream> createWithHttpInfo(liveStreamCreationPayload)

Create live stream

Expand Down Expand Up @@ -89,6 +91,8 @@ Name | Type | Description | Notes
<a name="get"></a>
# **get**
> LiveStream get(liveStreamId)
> okhttp3.Call getAsync(liveStreamId, callback)
> ApiResponse<LiveStream> getWithHttpInfo(liveStreamId)

Retrieve live stream

Expand Down Expand Up @@ -156,6 +160,8 @@ Name | Type | Description | Notes
<a name="update"></a>
# **update**
> LiveStream update(liveStreamId, liveStreamUpdatePayload)
> okhttp3.Call updateAsync(liveStreamId, liveStreamUpdatePayload, callback)
> ApiResponse<LiveStream> updateWithHttpInfo(liveStreamId, liveStreamUpdatePayload)

Update a live stream

Expand Down Expand Up @@ -231,6 +237,8 @@ Name | Type | Description | Notes
<a name="delete"></a>
# **delete**
> delete(liveStreamId)
> okhttp3.Call deleteAsync(liveStreamId, callback)
> ApiResponse<Void> deleteWithHttpInfo(liveStreamId)

Delete a live stream

Expand Down Expand Up @@ -296,7 +304,9 @@ null (empty response body)

<a name="list"></a>
# **list**
> LiveStreamListResponse list().streamKey(streamKey).name(name).sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute();
> LiveStreamListResponse list().streamKey(streamKey).name(name).sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<LiveStreamListResponse> executeWithHttpInfo()

List all live streams

Expand Down Expand Up @@ -381,6 +391,8 @@ Name | Type | Description | Notes
<a name="uploadThumbnail"></a>
# **uploadThumbnail**
> LiveStream uploadThumbnail(liveStreamId, file)
> okhttp3.Call uploadThumbnailAsync(liveStreamId, file, callback)
> ApiResponse<LiveStream> uploadThumbnailWithHttpInfo(liveStreamId, file)

Upload a thumbnail

Expand Down Expand Up @@ -452,6 +464,8 @@ Name | Type | Description | Notes
<a name="deleteThumbnail"></a>
# **deleteThumbnail**
> LiveStream deleteThumbnail(liveStreamId)
> okhttp3.Call deleteThumbnailAsync(liveStreamId, callback)
> ApiResponse<LiveStream> deleteThumbnailWithHttpInfo(liveStreamId)

Delete a thumbnail

Expand Down
16 changes: 15 additions & 1 deletion docs/PlayerThemesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Method | HTTP request | Description
<a name="create"></a>
# **create**
> PlayerTheme create(playerThemeCreationPayload)
> okhttp3.Call createAsync(playerThemeCreationPayload, callback)
> ApiResponse<PlayerTheme> createWithHttpInfo(playerThemeCreationPayload)

Create a player

Expand Down Expand Up @@ -100,6 +102,8 @@ Name | Type | Description | Notes
<a name="get"></a>
# **get**
> PlayerTheme get(playerId)
> okhttp3.Call getAsync(playerId, callback)
> ApiResponse<PlayerTheme> getWithHttpInfo(playerId)

Retrieve a player

Expand Down Expand Up @@ -168,6 +172,8 @@ Name | Type | Description | Notes
<a name="update"></a>
# **update**
> PlayerTheme update(playerId, playerThemeUpdatePayload)
> okhttp3.Call updateAsync(playerId, playerThemeUpdatePayload, callback)
> ApiResponse<PlayerTheme> updateWithHttpInfo(playerId, playerThemeUpdatePayload)

Update a player

Expand Down Expand Up @@ -255,6 +261,8 @@ Name | Type | Description | Notes
<a name="delete"></a>
# **delete**
> delete(playerId)
> okhttp3.Call deleteAsync(playerId, callback)
> ApiResponse<Void> deleteWithHttpInfo(playerId)

Delete a player

Expand Down Expand Up @@ -321,7 +329,9 @@ null (empty response body)

<a name="list"></a>
# **list**
> PlayerThemesListResponse list().sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute();
> PlayerThemesListResponse list().sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<PlayerThemesListResponse> executeWithHttpInfo()

List all player themes

Expand Down Expand Up @@ -401,6 +411,8 @@ Name | Type | Description | Notes
<a name="uploadLogo"></a>
# **uploadLogo**
> PlayerTheme uploadLogo(playerId, file, link)
> okhttp3.Call uploadLogoAsync(playerId, file, link, callback)
> ApiResponse<PlayerTheme> uploadLogoWithHttpInfo(playerId, file, link)

Upload a logo

Expand Down Expand Up @@ -474,6 +486,8 @@ Name | Type | Description | Notes
<a name="deleteLogo"></a>
# **deleteLogo**
> deleteLogo(playerId)
> okhttp3.Call deleteLogoAsync(playerId, callback)
> ApiResponse<Void> deleteLogoWithHttpInfo(playerId)

Delete logo

Expand Down
10 changes: 9 additions & 1 deletion docs/UploadTokensApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Method | HTTP request | Description
<a name="createToken"></a>
# **createToken**
> UploadToken createToken(tokenCreationPayload)
> okhttp3.Call createTokenAsync(tokenCreationPayload, callback)
> ApiResponse<UploadToken> createTokenWithHttpInfo(tokenCreationPayload)

Generate an upload token

Expand Down Expand Up @@ -83,6 +85,8 @@ Name | Type | Description | Notes
<a name="getToken"></a>
# **getToken**
> UploadToken getToken(uploadToken)
> okhttp3.Call getTokenAsync(uploadToken, callback)
> ApiResponse<UploadToken> getTokenWithHttpInfo(uploadToken)

Retrieve upload token

Expand Down Expand Up @@ -151,6 +155,8 @@ Name | Type | Description | Notes
<a name="deleteToken"></a>
# **deleteToken**
> deleteToken(uploadToken)
> okhttp3.Call deleteTokenAsync(uploadToken, callback)
> ApiResponse<Void> deleteTokenWithHttpInfo(uploadToken)

Delete an upload token

Expand Down Expand Up @@ -217,7 +223,9 @@ null (empty response body)

<a name="list"></a>
# **list**
> TokenListResponse list().sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute();
> TokenListResponse list().sortBy(sortBy).sortOrder(sortOrder).currentPage(currentPage).pageSize(pageSize).execute()
> okhttp3.Call executeAsync(callback)
> ApiResponse<TokenListResponse> executeWithHttpInfo()

List all active upload tokens

Expand Down
Loading
Loading