Skip to content

Commit

Permalink
Merge pull request #50 from apivideo/fix-python-nullables
Browse files Browse the repository at this point in the history
Fix nullable fields in status response
  • Loading branch information
bot-api-video authored Apr 1, 2022
2 parents 7de4e62 + 1e29cf7 commit 27791b9
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 109 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [1.2.4] - 2022-04-01
- Fix nullable fields in `status` endpoint result

## [1.2.3] - 2022-03-21
- Add `ingest.receivedParts` attribute in GET /videos/{video_id}/status

Expand Down
32 changes: 24 additions & 8 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2235,14 +2235,21 @@ paths:
\ Code: \"+ e.ErrorCode);\n Debug.Print(e.StackTrace);\n\
\ }\n }\n }\n} \n"
- language: php
code: "<?php\n// First install the api client: \"composer require api-video/php-api-client\"\
\n// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/VideosApi.md#getStatus\n\
\nrequire __DIR__ . '/vendor/autoload.php';\n\n$client = new \\ApiVideo\\\
Client\\Client(\n 'https://ws.api.video',\n 'YOUR_API_KEY',\n \
\ new \\Symfony\\Component\\HttpClient\\Psr18Client()\n);\n\n$videoId\
\ = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video\
\ you want the status for.\n$videoStatus = $client->videos()->getStatus($videoId);\
\ "
code: |-
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/VideosApi.md#get

require __DIR__ . '/vendor/autoload.php';

$client = new \ApiVideo\Client\Client(
'https://ws.api.video',
'YOUR_API_KEY',
new \Symfony\Component\HttpClient\Psr18Client()
);

$videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want details about.
$videoStatus = $client->videos()->get($videoId);
- language: swift
code: |+
// First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started
Expand Down Expand Up @@ -11624,6 +11631,7 @@ components:
filesize:
description: The size of your file in bytes.
example: 200000
nullable: true
type: integer
receivedBytes:
description: The total number of bytes received, listed for each chunk of
Expand All @@ -11639,34 +11647,42 @@ components:
properties:
width:
description: The width of the video in pixels.
nullable: true
type: integer
height:
description: The height of the video in pixels.
nullable: true
type: integer
bitrate:
description: The number of bits processed per second.
nullable: true
type: number
duration:
description: The length of the video.
nullable: true
type: integer
framerate:
description: The frequency with which consecutive images or frames appear
on a display. Shown in this API as frames per second (fps).
example: 60
nullable: true
type: integer
samplerate:
description: How many samples per second a digital audio system uses to
record an audio signal. The higher the rate, the higher the frequencies
that can be recorded. They are presented in this API using hertz.
example: 48000
nullable: true
type: integer
videoCodec:
description: 'The method used to compress and decompress digital video.
API Video supports all codecs in the libavcodec library. '
nullable: true
type: string
audioCodec:
description: The method used to compress and decompress digital audio for
your video.
nullable: true
type: string
aspectRatio:
nullable: true
Expand Down
18 changes: 9 additions & 9 deletions api_videos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ var videoStatusJSONResponse = `{
var videoStatusStruct = VideoStatus{
Ingest: &VideoStatusIngest{
Status: PtrString("uploaded"),
Filesize: PtrInt32(273579401),
Filesize: PtrNullableInt32(273579401),
ReceivedBytes: &[]BytesRange{
{
To: PtrInt32(134217727),
Expand Down Expand Up @@ -278,14 +278,14 @@ var videoStatusStruct = VideoStatus{
},
},
Metadata: &VideoStatusEncodingMetadata{
Width: PtrInt32(424),
Height: PtrInt32(240),
Bitrate: PtrFloat32(411),
Duration: PtrInt32(4176),
Framerate: PtrInt32(24),
Samplerate: PtrInt32(48000),
VideoCodec: PtrString("h264"),
AudioCodec: PtrString("aac"),
Width: PtrNullableInt32(424),
Height: PtrNullableInt32(240),
Bitrate: PtrNullableFloat32(411),
Duration: PtrNullableInt32(4176),
Framerate: PtrNullableInt32(24),
Samplerate: PtrNullableInt32(48000),
VideoCodec: PtrNullableString("h264"),
AudioCodec: PtrNullableString("aac"),
AspectRatio: PtrNullableString("16/9"),
},
},
Expand Down
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (c *Client) prepareRequest(
req.Header.Set("AV-Origin-App", originAppHeaderValue)
}

req.Header.Set("AV-Origin-Client", "go:1.2.3")
req.Header.Set("AV-Origin-Client", "go:1.2.4")

for headerName := range headerParams {
req.Header.Set(headerName, headerParams[headerName])
Expand Down Expand Up @@ -502,7 +502,7 @@ func (c *Client) auth(req *http.Request) (*http.Request, error) {
if originAppHeaderValue != "" {
req.Header.Set("AV-Origin-App", originAppHeaderValue)
}
req.Header.Set("AV-Origin-Client", "go:1.2.3")
req.Header.Set("AV-Origin-Client", "go:1.2.4")

resp, err := c.httpClient.Do(req)

Expand Down
96 changes: 88 additions & 8 deletions docs/VideoStatusEncodingMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Width** | Pointer to **int32** | The width of the video in pixels. | [optional]
**Height** | Pointer to **int32** | The height of the video in pixels. | [optional]
**Bitrate** | Pointer to **float32** | The number of bits processed per second. | [optional]
**Duration** | Pointer to **int32** | The length of the video. | [optional]
**Framerate** | Pointer to **int32** | The frequency with which consecutive images or frames appear on a display. Shown in this API as frames per second (fps). | [optional]
**Samplerate** | Pointer to **int32** | How many samples per second a digital audio system uses to record an audio signal. The higher the rate, the higher the frequencies that can be recorded. They are presented in this API using hertz. | [optional]
**VideoCodec** | Pointer to **string** | The method used to compress and decompress digital video. API Video supports all codecs in the libavcodec library. | [optional]
**AudioCodec** | Pointer to **string** | The method used to compress and decompress digital audio for your video. | [optional]
**Width** | Pointer to **NullableInt32** | The width of the video in pixels. | [optional]
**Height** | Pointer to **NullableInt32** | The height of the video in pixels. | [optional]
**Bitrate** | Pointer to **NullableFloat32** | The number of bits processed per second. | [optional]
**Duration** | Pointer to **NullableInt32** | The length of the video. | [optional]
**Framerate** | Pointer to **NullableInt32** | The frequency with which consecutive images or frames appear on a display. Shown in this API as frames per second (fps). | [optional]
**Samplerate** | Pointer to **NullableInt32** | How many samples per second a digital audio system uses to record an audio signal. The higher the rate, the higher the frequencies that can be recorded. They are presented in this API using hertz. | [optional]
**VideoCodec** | Pointer to **NullableString** | The method used to compress and decompress digital video. API Video supports all codecs in the libavcodec library. | [optional]
**AudioCodec** | Pointer to **NullableString** | The method used to compress and decompress digital audio for your video. | [optional]
**AspectRatio** | Pointer to **NullableString** | | [optional]

## Methods
Expand Down Expand Up @@ -58,6 +58,16 @@ SetWidth sets Width field to given value.

HasWidth returns a boolean if a field has been set.

### SetWidthNil

`func (o *VideoStatusEncodingMetadata) SetWidthNil(b bool)`

SetWidthNil sets the value for Width to be an explicit nil

### UnsetWidth
`func (o *VideoStatusEncodingMetadata) UnsetWidth()`

UnsetWidth ensures that no value is present for Width, not even an explicit nil
### GetHeight

`func (o *VideoStatusEncodingMetadata) GetHeight() int32`
Expand All @@ -83,6 +93,16 @@ SetHeight sets Height field to given value.

HasHeight returns a boolean if a field has been set.

### SetHeightNil

`func (o *VideoStatusEncodingMetadata) SetHeightNil(b bool)`

SetHeightNil sets the value for Height to be an explicit nil

### UnsetHeight
`func (o *VideoStatusEncodingMetadata) UnsetHeight()`

UnsetHeight ensures that no value is present for Height, not even an explicit nil
### GetBitrate

`func (o *VideoStatusEncodingMetadata) GetBitrate() float32`
Expand All @@ -108,6 +128,16 @@ SetBitrate sets Bitrate field to given value.

HasBitrate returns a boolean if a field has been set.

### SetBitrateNil

`func (o *VideoStatusEncodingMetadata) SetBitrateNil(b bool)`

SetBitrateNil sets the value for Bitrate to be an explicit nil

### UnsetBitrate
`func (o *VideoStatusEncodingMetadata) UnsetBitrate()`

UnsetBitrate ensures that no value is present for Bitrate, not even an explicit nil
### GetDuration

`func (o *VideoStatusEncodingMetadata) GetDuration() int32`
Expand All @@ -133,6 +163,16 @@ SetDuration sets Duration field to given value.

HasDuration returns a boolean if a field has been set.

### SetDurationNil

`func (o *VideoStatusEncodingMetadata) SetDurationNil(b bool)`

SetDurationNil sets the value for Duration to be an explicit nil

### UnsetDuration
`func (o *VideoStatusEncodingMetadata) UnsetDuration()`

UnsetDuration ensures that no value is present for Duration, not even an explicit nil
### GetFramerate

`func (o *VideoStatusEncodingMetadata) GetFramerate() int32`
Expand All @@ -158,6 +198,16 @@ SetFramerate sets Framerate field to given value.

HasFramerate returns a boolean if a field has been set.

### SetFramerateNil

`func (o *VideoStatusEncodingMetadata) SetFramerateNil(b bool)`

SetFramerateNil sets the value for Framerate to be an explicit nil

### UnsetFramerate
`func (o *VideoStatusEncodingMetadata) UnsetFramerate()`

UnsetFramerate ensures that no value is present for Framerate, not even an explicit nil
### GetSamplerate

`func (o *VideoStatusEncodingMetadata) GetSamplerate() int32`
Expand All @@ -183,6 +233,16 @@ SetSamplerate sets Samplerate field to given value.

HasSamplerate returns a boolean if a field has been set.

### SetSamplerateNil

`func (o *VideoStatusEncodingMetadata) SetSamplerateNil(b bool)`

SetSamplerateNil sets the value for Samplerate to be an explicit nil

### UnsetSamplerate
`func (o *VideoStatusEncodingMetadata) UnsetSamplerate()`

UnsetSamplerate ensures that no value is present for Samplerate, not even an explicit nil
### GetVideoCodec

`func (o *VideoStatusEncodingMetadata) GetVideoCodec() string`
Expand All @@ -208,6 +268,16 @@ SetVideoCodec sets VideoCodec field to given value.

HasVideoCodec returns a boolean if a field has been set.

### SetVideoCodecNil

`func (o *VideoStatusEncodingMetadata) SetVideoCodecNil(b bool)`

SetVideoCodecNil sets the value for VideoCodec to be an explicit nil

### UnsetVideoCodec
`func (o *VideoStatusEncodingMetadata) UnsetVideoCodec()`

UnsetVideoCodec ensures that no value is present for VideoCodec, not even an explicit nil
### GetAudioCodec

`func (o *VideoStatusEncodingMetadata) GetAudioCodec() string`
Expand All @@ -233,6 +303,16 @@ SetAudioCodec sets AudioCodec field to given value.

HasAudioCodec returns a boolean if a field has been set.

### SetAudioCodecNil

`func (o *VideoStatusEncodingMetadata) SetAudioCodecNil(b bool)`

SetAudioCodecNil sets the value for AudioCodec to be an explicit nil

### UnsetAudioCodec
`func (o *VideoStatusEncodingMetadata) UnsetAudioCodec()`

UnsetAudioCodec ensures that no value is present for AudioCodec, not even an explicit nil
### GetAspectRatio

`func (o *VideoStatusEncodingMetadata) GetAspectRatio() string`
Expand Down
12 changes: 11 additions & 1 deletion docs/VideoStatusIngest.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Status** | Pointer to **string** | There are three possible ingest statuses. missing - you are missing information required to ingest the video. uploading - the video is in the process of being uploaded. uploaded - the video is ready for use. | [optional]
**Filesize** | Pointer to **int32** | The size of your file in bytes. | [optional]
**Filesize** | Pointer to **NullableInt32** | The size of your file in bytes. | [optional]
**ReceivedBytes** | Pointer to [**[]BytesRange**](BytesRange.md) | The total number of bytes received, listed for each chunk of the upload. | [optional]
**ReceivedParts** | Pointer to [**VideoStatusIngestReceivedParts**](VideoStatusIngestReceivedParts.md) | | [optional]

Expand Down Expand Up @@ -78,6 +78,16 @@ SetFilesize sets Filesize field to given value.

HasFilesize returns a boolean if a field has been set.

### SetFilesizeNil

`func (o *VideoStatusIngest) SetFilesizeNil(b bool)`

SetFilesizeNil sets the value for Filesize to be an explicit nil

### UnsetFilesize
`func (o *VideoStatusIngest) UnsetFilesize()`

UnsetFilesize ensures that no value is present for Filesize, not even an explicit nil
### GetReceivedBytes

`func (o *VideoStatusIngest) GetReceivedBytes() []BytesRange`
Expand Down
Loading

0 comments on commit 27791b9

Please sign in to comment.