Skip to content

Commit

Permalink
Merge pull request #14 from apivideo/watermark-and-clip
Browse files Browse the repository at this point in the history
feat(all): add watermarks & video clips
  • Loading branch information
bot-api-video authored Jan 13, 2022
2 parents 7e29ebe + 00bfc1f commit 192c525
Show file tree
Hide file tree
Showing 24 changed files with 695 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Sources/APIs/PlayerThemesAPI.swift
Sources/APIs/RawStatisticsAPI.swift
Sources/APIs/UploadTokensAPI.swift
Sources/APIs/VideosAPI.swift
Sources/APIs/WatermarksAPI.swift
Sources/APIs/WebhooksAPI.swift
Sources/AlamofireImplementations.swift
Sources/Auth/ApiVideoAuthenticator.swift
Expand Down Expand Up @@ -66,6 +67,7 @@ Sources/Models/TokenListResponse.swift
Sources/Models/UploadToken.swift
Sources/Models/Video.swift
Sources/Models/VideoAssets.swift
Sources/Models/VideoClip.swift
Sources/Models/VideoCreationPayload.swift
Sources/Models/VideoSession.swift
Sources/Models/VideoSessionClient.swift
Expand All @@ -83,7 +85,10 @@ Sources/Models/VideoStatusEncodingMetadata.swift
Sources/Models/VideoStatusIngest.swift
Sources/Models/VideoThumbnailPickPayload.swift
Sources/Models/VideoUpdatePayload.swift
Sources/Models/VideoWatermark.swift
Sources/Models/VideosListResponse.swift
Sources/Models/Watermark.swift
Sources/Models/WatermarksListResponse.swift
Sources/Models/Webhook.swift
Sources/Models/WebhooksCreationPayload.swift
Sources/Models/WebhooksListResponse.swift
Expand Down Expand Up @@ -141,6 +146,7 @@ docs/UploadToken.md
docs/UploadTokensAPI.md
docs/Video.md
docs/VideoAssets.md
docs/VideoClip.md
docs/VideoCreationPayload.md
docs/VideoSession.md
docs/VideoSessionClient.md
Expand All @@ -158,8 +164,12 @@ docs/VideoStatusEncodingMetadata.md
docs/VideoStatusIngest.md
docs/VideoThumbnailPickPayload.md
docs/VideoUpdatePayload.md
docs/VideoWatermark.md
docs/VideosAPI.md
docs/VideosListResponse.md
docs/Watermark.md
docs/WatermarksAPI.md
docs/WatermarksListResponse.md
docs/Webhook.md
docs/WebhooksAPI.md
docs/WebhooksCreationPayload.md
Expand Down
2 changes: 1 addition & 1 deletion .openapi-generator/oas_apivideo.yaml-defaut-cli.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
89d90eb8417142f456f0e11aab66e6714f24bea291cb3c8cbd38de96f1d52dbe
d6524c62486df62e78c0e30682f41a3558bf7f6d8b618cc65a92913b36d06233
4 changes: 2 additions & 2 deletions ApiVideoClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.version = '0.1.2'
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v0.1.2' }
s.version = '1.0.0'
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v1.0.0' }
s.authors = { 'Ecosystem Team' => '[email protected]' }
s.license = { :type => 'MIT' }
s.homepage = 'https://docs.api.video'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All changes to this project will be documented in this file.

## [1.0.0] - 2022-01-07
- Add watermark endpoints
- Add video clips
- Fix tags[] query parameter format of GET /videos
- Correctly distinguish between "undefined", "defined" and "null" values if the playerId parameter of PATCH /videos/{videoId}

## [0.1.2] - 2021-12-14
- Set protocol for progressive upload session visibility to public

Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [RawStatisticsAPI](#RawStatisticsAPI)
- [UploadTokensAPI](#UploadTokensAPI)
- [VideosAPI](#VideosAPI)
- [WatermarksAPI](#WatermarksAPI)
- [WebhooksAPI](#WebhooksAPI)
- [Models](#models)
- [Authorization](#documentation-for-authorization)
Expand All @@ -41,14 +42,14 @@ api.video's iOS client streamlines the coding process. Chunking files is handled
Specify it in your `Cartfile`:

```
github "apivideo/api.video-ios-client" ~> 0.1.2
github "apivideo/api.video-ios-client" ~> 1.0.0
```

Run `carthage update`

### CocoaPods

Add `pod 'ApiVideoClient', '0.1.2'` in your `Podfile`
Add `pod 'ApiVideoClient', '1.0.0'` in your `Podfile`

Run `pod install`

Expand Down Expand Up @@ -227,6 +228,23 @@ Method | HTTP request | Description
[**uploadThumbnail**](docs/VideosAPI.md#uploadThumbnail) | **POST** /videos/{videoId}/thumbnail | Upload a thumbnail


### WatermarksAPI

#### Retrieve an instance of WatermarksAPI:

```swift
WatermarksAPI
```

#### Endpoints

Method | HTTP request | Description
------------- | ------------- | -------------
[**delete**](docs/WatermarksAPI.md#delete) | **DELETE** /watermarks/{watermarkId} | Delete a watermark
[**list**](docs/WatermarksAPI.md#list) | **GET** /watermarks | List all watermarks
[**upload**](docs/WatermarksAPI.md#upload) | **POST** /watermarks | Upload a watermark


### WebhooksAPI

#### Retrieve an instance of WebhooksAPI:
Expand Down Expand Up @@ -289,6 +307,7 @@ Method | HTTP request | Description
- [UploadToken](docs/UploadToken.md)
- [Video](docs/Video.md)
- [VideoAssets](docs/VideoAssets.md)
- [VideoClip](docs/VideoClip.md)
- [VideoCreationPayload](docs/VideoCreationPayload.md)
- [VideoSession](docs/VideoSession.md)
- [VideoSessionClient](docs/VideoSessionClient.md)
Expand All @@ -306,7 +325,10 @@ Method | HTTP request | Description
- [VideoStatusIngest](docs/VideoStatusIngest.md)
- [VideoThumbnailPickPayload](docs/VideoThumbnailPickPayload.md)
- [VideoUpdatePayload](docs/VideoUpdatePayload.md)
- [VideoWatermark](docs/VideoWatermark.md)
- [VideosListResponse](docs/VideosListResponse.md)
- [Watermark](docs/Watermark.md)
- [WatermarksListResponse](docs/WatermarksListResponse.md)
- [Webhook](docs/Webhook.md)
- [WebhooksCreationPayload](docs/WebhooksCreationPayload.md)
- [WebhooksListResponse](docs/WebhooksListResponse.md)
Expand Down
180 changes: 180 additions & 0 deletions Sources/APIs/WatermarksAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
//
// WatermarksAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import Foundation
#if canImport(AnyCodable)
import AnyCodable
#endif

open class WatermarksAPI {

/**
Delete a watermark
- parameter watermarkId: (path) The watermark ID for the watermark you want to delete.
- parameter apiResponseQueue: The queue on which api response is dispatched.
- parameter completion: completion handler to receive the data and the error objects.
*/
@discardableResult
open class func delete(watermarkId: String, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? {
return deleteWithRequestBuilder(watermarkId: watermarkId).execute(apiResponseQueue) { result in
switch result {
case .success:
completion((), nil)
case let .failure(error):
completion(nil, error)
}
}
}


/**
Delete a watermark
- DELETE /watermarks/{watermarkId}
- Delete a watermark. A watermark is a static image overlapping a video used as a \"stamp\" to limit leetching.
- BASIC:
- type: http
- name: bearerAuth
- parameter watermarkId: (path) The watermark ID for the watermark you want to delete.
- returns: RequestBuilder<Void>
*/
open class func deleteWithRequestBuilder(watermarkId: String) -> RequestBuilder<Void> {
var localVariablePath = "/watermarks/{watermarkId}"
let watermarkIdPreEscape = "\(APIHelper.mapValueToPathItem(watermarkId))"
let watermarkIdPostEscape = watermarkIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{watermarkId}", with: watermarkIdPostEscape, options: .literal, range: nil)
let localVariableURLString = ApiVideoClient.basePath + localVariablePath
let localVariableParameters: [String: Any]? = nil

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

let localVariableNillableHeaders: [String: Any?] = [
:
]

let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)

let localVariableRequestBuilder: RequestBuilder<Void>.Type = ApiVideoClient.requestBuilderFactory.getNonDecodableBuilder()

return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
}


/**
List all watermarks
- parameter sortBy: (query) Allowed: createdAt. You can search by the time watermark were created at. (optional)
- parameter sortOrder: (query) Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. (optional)
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
- parameter apiResponseQueue: The queue on which api response is dispatched.
- parameter completion: completion handler to receive the data and the error objects.
*/
@discardableResult
open class func list(sortBy: String? = nil, sortOrder: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: WatermarksListResponse?, _ error: Error?) -> Void)) -> URLSessionTask? {
return listWithRequestBuilder(sortBy: sortBy, sortOrder: sortOrder, currentPage: currentPage, pageSize: pageSize).execute(apiResponseQueue) { result in
switch result {
case let .success(response):
completion(response.body, nil)
case let .failure(error):
completion(nil, error)
}
}
}


/**
List all watermarks
- GET /watermarks
- List all watermarks. A watermark is a static image overlapping a video used as a \"stamp\" to limit leetching.
- BASIC:
- type: http
- name: bearerAuth
- parameter sortBy: (query) Allowed: createdAt. You can search by the time watermark were created at. (optional)
- parameter sortOrder: (query) Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A. (optional)
- parameter currentPage: (query) Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1)
- parameter pageSize: (query) Results per page. Allowed values 1-100, default is 25. (optional, default to 25)
- returns: RequestBuilder<WatermarksListResponse>
*/
open class func listWithRequestBuilder(sortBy: String? = nil, sortOrder: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil) -> RequestBuilder<WatermarksListResponse> {
let localVariablePath = "/watermarks"
let localVariableURLString = ApiVideoClient.basePath + localVariablePath
let localVariableParameters: [String: Any]? = nil

var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"sortBy": sortBy?.encodeToJSON(),
"sortOrder": sortOrder?.encodeToJSON(),
"currentPage": currentPage?.encodeToJSON(),
"pageSize": pageSize?.encodeToJSON(),
])

let localVariableNillableHeaders: [String: Any?] = [
:
]

let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)

let localVariableRequestBuilder: RequestBuilder<WatermarksListResponse>.Type = ApiVideoClient.requestBuilderFactory.getBuilder()

return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
}


/**
Upload a watermark
- parameter file: (form) The .jpg or .png image to be added as a watermark.
- parameter apiResponseQueue: The queue on which api response is dispatched.
- parameter completion: completion handler to receive the data and the error objects.
*/
@discardableResult
open class func upload(file: URL, apiResponseQueue: DispatchQueue = ApiVideoClient.apiResponseQueue, completion: @escaping ((_ data: Watermark?, _ error: Error?) -> Void)) -> URLSessionTask? {
return uploadWithRequestBuilder(file: file).execute(apiResponseQueue) { result in
switch result {
case let .success(response):
completion(response.body, nil)
case let .failure(error):
completion(nil, error)
}
}
}


/**
Upload a watermark
- POST /watermarks
- Create a new watermark by uploading a .jpg or a .png image. A watermark is a static image overlapping a video used as a \"stamp\" to limit leetching.
- BASIC:
- type: http
- name: bearerAuth
- parameter file: (form) The .jpg or .png image to be added as a watermark.
- returns: RequestBuilder<Watermark>
*/
open class func uploadWithRequestBuilder(file: URL) -> RequestBuilder<Watermark> {
let localVariablePath = "/watermarks"
let localVariableURLString = ApiVideoClient.basePath + localVariablePath
let localVariableFormParams: [String: Any?] = [
"file": file.encodeToJSON(),
]
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)

let localVariableUrlComponents = URLComponents(string: localVariableURLString)

let localVariableNillableHeaders: [String: Any?] = [
"Content-Type": "multipart/form-data",
]

let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)

let localVariableRequestBuilder: RequestBuilder<Watermark>.Type = ApiVideoClient.requestBuilderFactory.getBuilder()

return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
}

}
36 changes: 36 additions & 0 deletions Sources/Models/VideoClip.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// VideoClip.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import Foundation
#if canImport(AnyCodable)
import AnyCodable
#endif

public struct VideoClip: Codable, Hashable {

public var startTimecode: String?
public var endTimecode: String?

public init(startTimecode: String? = nil, endTimecode: String? = nil) {
self.startTimecode = startTimecode
self.endTimecode = endTimecode
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case startTimecode
case endTimecode
}

// Encodable protocol methods

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(startTimecode, forKey: .startTimecode)
try container.encodeIfPresent(endTimecode, forKey: .endTimecode)
}
}

Loading

0 comments on commit 192c525

Please sign in to comment.