-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from apivideo/watermark-and-clip
feat(all): add watermarks & video clips
- Loading branch information
Showing
24 changed files
with
695 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
89d90eb8417142f456f0e11aab66e6714f24bea291cb3c8cbd38de96f1d52dbe | ||
d6524c62486df62e78c0e30682f41a3558bf7f6d8b618cc65a92913b36d06233 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
|
Oops, something went wrong.