Skip to content

Commit

Permalink
Fix custom http client & update desc
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-lando committed Apr 19, 2021
1 parent 8fa49f6 commit 53e6749
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 26 deletions.
29 changes: 22 additions & 7 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ paths:
- description: A tag is a category you create and apply to videos. You can search
for videos with particular tags by listing one or more here. Only videos
that have all the tags you list will be returned.
example: '"tags": ["captions", "dialogue"]'
example: '["captions", "dialogue"]'
explode: true
in: query
name: tags
Expand Down Expand Up @@ -229,7 +229,7 @@ paths:
- key: Format
value: Tutorial
publishedAt: 2019-12-16T08:25:51+00:00
updateddAt: 2019-12-16T08:48:49+00:00
updatedAt: 2019-12-16T08:48:49+00:00
source:
uri: /videos/c188ed58-3403-46a2-b91b-44603d10b2c9/source
assets:
Expand Down Expand Up @@ -257,7 +257,7 @@ paths:
- key: Technology
value: Computers
publishedAt: 2019-12-16T08:25:51+00:00
updateddAt: 2019-12-16T08:48:49+00:00
updatedAt: 2019-12-16T08:48:49+00:00
source:
uri: /videos/1b9d6ae8-8f57-4b6d-8552-d636926b4f5f/source
assets:
Expand All @@ -281,7 +281,7 @@ paths:
- key: Length
value: Short
publishedAt: 2019-12-16T08:25:51+00:00
updateddAt: 2019-12-16T08:48:49+00:00
updatedAt: 2019-12-16T08:48:49+00:00
source:
uri: /videos/73129412-e320-4b93-99f6-59a85e3cedcd/source
assets:
Expand Down Expand Up @@ -686,7 +686,6 @@ paths:
value: John Doe
- key: Format
value: Tutorial
scheduledAt: 2020-03-03T12:52:03.085Z
publishedAt: 2020-07-14T23:36:18.598Z
source:
uri: /videos/vi4k0jvEUuaTdRAEjQ4Jfrgz/source
Expand Down Expand Up @@ -809,7 +808,7 @@ paths:
- key: Format
value: Tutorial
publishedAt: 2019-12-16T08:25:51+00:00
updateddAt: 2019-12-16T08:48:49+00:00
updatedAt: 2019-12-16T08:48:49+00:00
source:
uri: /videos/vi4k0jvEUuaTdRAEjQ4Jfrgz/source
assets:
Expand Down Expand Up @@ -3771,6 +3770,7 @@ components:
live-stream:
example:
streamKey: cc1b4df0-d1c5-4064-a8f9-9f0368385135
createdAt: 2020-01-31T10:17:47Z
assets:
thumbnail: https://cdn.api.video/live/li400mYKSgQ6xs7taUeSaEKr/thumbnail.jpg
iframe: <iframe src=\"https://embed.api.video/live/li4pqNqGUkhKfWcBGpZVLRY5\"
Expand All @@ -3783,6 +3783,7 @@ components:
name: My Live Stream
playerId: pl45d5vFFGrfdsdsd156dGhh
broadcasting: true
updatedAt: 2020-01-31T10:18:47Z
properties:
liveStreamId:
description: The unique identifier for the live stream. Live stream IDs
Expand Down Expand Up @@ -3820,6 +3821,16 @@ components:
you are not.
example: true
type: boolean
createdAt:
description: When the player was created, presented in ISO-8601 format.
example: 2020-01-31T10:17:47Z
format: date-time
type: string
updatedAt:
description: When the player was last updated, presented in ISO-8601 format.
example: 2020-01-31T10:18:47Z
format: date-time
type: string
title: LiveStream
type: object
live-stream-session:
Expand Down Expand Up @@ -4260,7 +4271,7 @@ components:
Valid Patterns: \n\"hh:mm:ss.ms\"\n\"hh:mm:ss:frameNumber\"\n\"124\" (integer\
\ value is reported as seconds) \nIf selection is out of range, \"00:00:00.00\"\
\ will be chosen."
pattern: 00:00:00.00
pattern: \d{2}:\d{2}:\d{2}(\.\d{2})?
type: string
required:
- timecode
Expand Down Expand Up @@ -4432,6 +4443,7 @@ components:
uri: /videos/search?currentPage=6&pageSize=20
data:
- streamKey: cc1b4df0-d1c5-4064-a8f9-9f0368385135
createdAt: 2020-01-31T10:17:47Z
assets:
thumbnail: https://cdn.api.video/live/li400mYKSgQ6xs7taUeSaEKr/thumbnail.jpg
iframe: <iframe src=\"https://embed.api.video/live/li4pqNqGUkhKfWcBGpZVLRY5\"
Expand All @@ -4444,7 +4456,9 @@ components:
name: My Live Stream
playerId: pl45d5vFFGrfdsdsd156dGhh
broadcasting: true
updatedAt: 2020-01-31T10:18:47Z
- streamKey: cc1b4df0-d1c5-4064-a8f9-9f0368385135
createdAt: 2020-01-31T10:17:47Z
assets:
thumbnail: https://cdn.api.video/live/li400mYKSgQ6xs7taUeSaEKr/thumbnail.jpg
iframe: <iframe src=\"https://embed.api.video/live/li4pqNqGUkhKfWcBGpZVLRY5\"
Expand All @@ -4457,6 +4471,7 @@ components:
name: My Live Stream
playerId: pl45d5vFFGrfdsdsd156dGhh
broadcasting: true
updatedAt: 2020-01-31T10:18:47Z
properties:
data:
items:
Expand Down
42 changes: 25 additions & 17 deletions api_videos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ func TestVideos_Get(t *testing.T) {
fmt.Fprint(w, videoJSONResponses[0])
})

video, err := client.Videos.Get("vi4k0jvEUuaTdRAEjQ4Jfagz")
video, err := client.Videos.Get(
"vi4k0jvEUuaTdRAEjQ4Jfagz")
if err != nil {
t.Errorf("Videos.Get error: %v", err)
}
Expand Down Expand Up @@ -366,14 +367,13 @@ func TestVideos_List(t *testing.T) {
fmt.Fprint(w, JSONResp)
})

videos, err := client.Videos.List(
new(VideosApiListRequest).
CurrentPage(1).
PageSize(25).
SortBy("publishedAt").
SortOrder("desc").
Tags([]string{"tag1", "tag2"}).
Metadata(map[string]string{"key": "value", "key2": "value2"}))
videos, err := client.Videos.List(new(VideosApiListRequest).
CurrentPage(1).
PageSize(25).
SortBy("publishedAt").
SortOrder("desc").
Tags([]string{"tag1", "tag2"}).
Metadata(map[string]string{"key": "value", "key2": "value2"}))

if err != nil {
t.Errorf("Videos.List error: %v", err)
Expand Down Expand Up @@ -414,7 +414,8 @@ func TestVideos_ListUpdatedAt(t *testing.T) {
fmt.Fprint(w, JSONResp)
})

videos, err := client.Videos.List(new(VideosApiListRequest).
videos, err := client.Videos.List(
new(VideosApiListRequest).
CurrentPage(1).
PageSize(25).
SortBy("updatedAt").
Expand Down Expand Up @@ -506,7 +507,8 @@ func TestVideos_Update(t *testing.T) {
fmt.Fprint(w, videoJSONResponses[0])
})

video, err := client.Videos.Update("vi4k0jvEUuaTdRAEjQ4Jfagz", videoUpdateStruct)
video, err := client.Videos.Update(
"vi4k0jvEUuaTdRAEjQ4Jfagz", videoUpdateStruct)
if err != nil {
t.Errorf("Videos.Update error: %v", err)
}
Expand All @@ -525,7 +527,8 @@ func TestVideos_Delete(t *testing.T) {
testMethod(t, r, http.MethodDelete)
})

err := client.Videos.Delete("vi4k0jvEUuaTdRAEjQ4Jfagz")
err := client.Videos.Delete(
"vi4k0jvEUuaTdRAEjQ4Jfagz")
if err != nil {
t.Errorf("Videos.Delete error: %v", err)
}
Expand All @@ -547,7 +550,8 @@ func TestVideos_Upload(t *testing.T) {
file := createTempFile("test.video", 8*1024*1024)
defer os.Remove(file.Name())

video, err := client.Videos.UploadFile("vi4k0jvEUuaTdRAEjQ4Jfagz", file)
video, err := client.Videos.UploadFile(
"vi4k0jvEUuaTdRAEjQ4Jfagz", file)
if err != nil {
t.Errorf("Videos.Upload error: %v", err)
}
Expand Down Expand Up @@ -591,7 +595,8 @@ func TestVideos_ChunkedUpload(t *testing.T) {
defer os.Remove(file.Name())

client.ChunkSize(chunksize)
video, err := client.Videos.UploadFile("vi4k0jvEUuaTdRAEjQ4Jfagz", file)
video, err := client.Videos.UploadFile(
"vi4k0jvEUuaTdRAEjQ4Jfagz", file)
if err != nil {
t.Errorf("Videos.ChunkedUpload error: %v", err)
}
Expand All @@ -614,7 +619,8 @@ func TestVideos_Status(t *testing.T) {
fmt.Fprint(w, videoStatusJSONResponse)
})

status, err := client.Videos.GetStatus("vi4k0jvEUuaTdRAEjQ4Jfagz")
status, err := client.Videos.GetStatus(
"vi4k0jvEUuaTdRAEjQ4Jfagz")
if err != nil {
t.Errorf("Videos.Status error: %v", err)
}
Expand All @@ -634,7 +640,8 @@ func TestVideos_PickThumbnail(t *testing.T) {
fmt.Fprint(w, videoJSONResponses[0])
})

video, err := client.Videos.PickThumbnail("vi4k0jvEUuaTdRAEjQ4Jfagz", VideoThumbnailPickPayload{Timecode: "00:00:01:02"})
video, err := client.Videos.PickThumbnail(
"vi4k0jvEUuaTdRAEjQ4Jfagz", VideoThumbnailPickPayload{Timecode: "00:00:01:02"})
if err != nil {
t.Errorf("Videos.PickThumbnail error: %v", err)
}
Expand All @@ -658,7 +665,8 @@ func TestVideos_UploadThumbnail(t *testing.T) {
file := createTempFile("test.thumbnail", 1024*1024)
defer os.Remove(file.Name())

video, err := client.Videos.UploadThumbnailFile("vi4k0jvEUuaTdRAEjQ4Jfagz", file)
video, err := client.Videos.UploadThumbnailFile(
"vi4k0jvEUuaTdRAEjQ4Jfagz", file)
if err != nil {
t.Errorf("Videos.UploadThumbnail error: %v", err)
}
Expand Down
7 changes: 5 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ func (cb *clientBuilder) Build() *Client {

baseURL, _ := url.Parse(cb.baseURL)

httpClient := *cb.httpClient
if httpClient == nil {
var httpClient Doer

if cb.httpClient == nil {
httpClient = http.DefaultClient
} else {
httpClient = *cb.httpClient
}

c := &Client{
Expand Down
52 changes: 52 additions & 0 deletions docs/LiveStream.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Name | Type | Description | Notes
**Assets** | Pointer to [**LiveStreamAssets**](live_stream_assets.md) | | [optional]
**PlayerId** | Pointer to **string** | The unique identifier for the player. | [optional]
**Broadcasting** | Pointer to **bool** | Whether or not you are broadcasting the live video you recorded for others to see. True means you are broadcasting to viewers, false means you are not. | [optional]
**CreatedAt** | Pointer to **string** | When the player was created, presented in ISO-8601 format. | [optional]
**UpdatedAt** | Pointer to **string** | When the player was last updated, presented in ISO-8601 format. | [optional]

## Methods

Expand Down Expand Up @@ -232,6 +234,56 @@ SetBroadcasting sets Broadcasting field to given value.

HasBroadcasting returns a boolean if a field has been set.

### GetCreatedAt

`func (o *LiveStream) GetCreatedAt() string`

GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.

### GetCreatedAtOk

`func (o *LiveStream) GetCreatedAtOk() (*string, bool)`

GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetCreatedAt

`func (o *LiveStream) SetCreatedAt(v string)`

SetCreatedAt sets CreatedAt field to given value.

### HasCreatedAt

`func (o *LiveStream) HasCreatedAt() bool`

HasCreatedAt returns a boolean if a field has been set.

### GetUpdatedAt

`func (o *LiveStream) GetUpdatedAt() string`

GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise.

### GetUpdatedAtOk

`func (o *LiveStream) GetUpdatedAtOk() (*string, bool)`

GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetUpdatedAt

`func (o *LiveStream) SetUpdatedAt(v string)`

SetUpdatedAt sets UpdatedAt field to given value.

### HasUpdatedAt

`func (o *LiveStream) HasUpdatedAt() bool`

HasUpdatedAt returns a boolean if a field has been set.


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
68 changes: 68 additions & 0 deletions model_live_stream.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 53e6749

Please sign in to comment.