Skip to content

Commit 4ef8445

Browse files
committed
Initial commit of generated SDK library
0 parents  commit 4ef8445

39 files changed

+6217
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
src/autoload.php
3+
src/composer.json

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Shotstack PHP SDK
2+
3+
PHP SDK for Shotstack, the cloud video editing API.

composer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "shotstack/shotstack-sdk-php",
3+
"description": "PHP SDK for Shotstack, the cloud video editing API",
4+
"type": "library",
5+
"license": "MIT",
6+
"minimum-stability": "dev",
7+
"keywords": ["shotstack", "video", "video editing", "api"],
8+
"require": {
9+
"php": ">=5.3.3",
10+
"ext-curl": "*",
11+
"ext-json": "*",
12+
"ext-mbstring": "*"
13+
},
14+
"autoload": {
15+
"psr-4": { "Shotstack\\" : "src/" }
16+
}
17+
}

src/Api/RenderApi.php

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?php
2+
/**
3+
* RenderApi
4+
* PHP version 5
5+
*
6+
* @category Class
7+
* @package Shotstack
8+
* @author http://github.com/swagger-api/swagger-codegen
9+
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
10+
* @link https://github.com/swagger-api/swagger-codegen
11+
*/
12+
/**
13+
* Copyright 2016 SmartBear Software
14+
*
15+
* Licensed under the Apache License, Version 2.0 (the "License");
16+
* you may not use this file except in compliance with the License.
17+
* You may obtain a copy of the License at
18+
*
19+
* http://www.apache.org/licenses/LICENSE-2.0
20+
*
21+
* Unless required by applicable law or agreed to in writing, software
22+
* distributed under the License is distributed on an "AS IS" BASIS,
23+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24+
* See the License for the specific language governing permissions and
25+
* limitations under the License.
26+
*/
27+
28+
/**
29+
* NOTE: This class is auto generated by the swagger code generator program.
30+
* https://github.com/swagger-api/swagger-codegen
31+
* Do not edit the class manually.
32+
*/
33+
34+
namespace Shotstack\Api;
35+
36+
use \Shotstack\Configuration;
37+
use \Shotstack\ApiClient;
38+
use \Shotstack\ApiException;
39+
use \Shotstack\ObjectSerializer;
40+
41+
/**
42+
* RenderApi Class Doc Comment
43+
*
44+
* @category Class
45+
* @package Shotstack
46+
* @author http://github.com/swagger-api/swagger-codegen
47+
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
48+
* @link https://github.com/swagger-api/swagger-codegen
49+
*/
50+
class RenderApi
51+
{
52+
53+
/**
54+
* API Client
55+
* @var \Shotstack\ApiClient instance of the ApiClient
56+
*/
57+
protected $apiClient;
58+
59+
/**
60+
* Constructor
61+
* @param \Shotstack\ApiClient|null $apiClient The api client to use
62+
*/
63+
function __construct($apiClient = null)
64+
{
65+
if ($apiClient == null) {
66+
$apiClient = new ApiClient();
67+
$apiClient->getConfig()->setHost('http://api.shotstack.io/v1');
68+
}
69+
70+
$this->apiClient = $apiClient;
71+
}
72+
73+
/**
74+
* Get API client
75+
* @return \Shotstack\ApiClient get the API client
76+
*/
77+
public function getApiClient()
78+
{
79+
return $this->apiClient;
80+
}
81+
82+
/**
83+
* Set the API client
84+
* @param \Shotstack\ApiClient $apiClient set the API client
85+
* @return RenderApi
86+
*/
87+
public function setApiClient(ApiClient $apiClient)
88+
{
89+
$this->apiClient = $apiClient;
90+
return $this;
91+
}
92+
93+
94+
/**
95+
* postRender
96+
*
97+
*
98+
*
99+
* @param \Shotstack\Model\Edit $edit Edit (required)
100+
* @return \Shotstack\Model\QueuedResponse
101+
* @throws \Shotstack\ApiException on non-2xx response
102+
*/
103+
public function postRender($edit)
104+
{
105+
list($response, $statusCode, $httpHeader) = $this->postRenderWithHttpInfo ($edit);
106+
return $response;
107+
}
108+
109+
110+
/**
111+
* postRenderWithHttpInfo
112+
*
113+
*
114+
*
115+
* @param \Shotstack\Model\Edit $edit Edit (required)
116+
* @return Array of \Shotstack\Model\QueuedResponse, HTTP status code, HTTP response headers (array of strings)
117+
* @throws \Shotstack\ApiException on non-2xx response
118+
*/
119+
public function postRenderWithHttpInfo($edit)
120+
{
121+
122+
// verify the required parameter 'edit' is set
123+
if ($edit === null) {
124+
throw new \InvalidArgumentException('Missing the required parameter $edit when calling postRender');
125+
}
126+
127+
// parse inputs
128+
$resourcePath = "/render";
129+
$httpBody = '';
130+
$queryParams = array();
131+
$headerParams = array();
132+
$formParams = array();
133+
$_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
134+
if (!is_null($_header_accept)) {
135+
$headerParams['Accept'] = $_header_accept;
136+
}
137+
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
138+
139+
140+
141+
142+
// default format to json
143+
$resourcePath = str_replace("{format}", "json", $resourcePath);
144+
145+
146+
// body params
147+
$_tempBody = null;
148+
if (isset($edit)) {
149+
$_tempBody = $edit;
150+
}
151+
152+
// for model (json/xml)
153+
if (isset($_tempBody)) {
154+
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
155+
} elseif (count($formParams) > 0) {
156+
$httpBody = $formParams; // for HTTP post (form)
157+
}
158+
159+
// this endpoint requires API key authentication
160+
$apiKey = $this->apiClient->getApiKeyWithPrefix('x-api-key');
161+
if (strlen($apiKey) !== 0) {
162+
$headerParams['x-api-key'] = $apiKey;
163+
}
164+
165+
166+
// make the API Call
167+
try {
168+
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
169+
$resourcePath, 'POST',
170+
$queryParams, $httpBody,
171+
$headerParams, '\Shotstack\Model\QueuedResponse'
172+
);
173+
174+
if (!$response) {
175+
return array(null, $statusCode, $httpHeader);
176+
}
177+
178+
return array(\Shotstack\ObjectSerializer::deserialize($response, '\Shotstack\Model\QueuedResponse', $httpHeader), $statusCode, $httpHeader);
179+
180+
} catch (ApiException $e) {
181+
switch ($e->getCode()) {
182+
case 200:
183+
$data = \Shotstack\ObjectSerializer::deserialize($e->getResponseBody(), '\Shotstack\Model\QueuedResponse', $e->getResponseHeaders());
184+
$e->setResponseObject($data);
185+
break;
186+
}
187+
188+
throw $e;
189+
}
190+
}
191+
192+
}

0 commit comments

Comments
 (0)