Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from sourcetoad/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
peterST authored Sep 23, 2021
2 parents 15ef8fd + 373a995 commit 34c53af
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 35 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "GIT_USER_ID/GIT_REPO_ID",
"name": "sourcetoad/clever-php",
"description": "",
"keywords": [
"swagger",
Expand Down
26 changes: 22 additions & 4 deletions lib/Api/DataApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -8120,11 +8120,16 @@ protected function getSectionRequest($id)
*
* @throws \Clever\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Clever\Model\SectionsResponse
* @return \Clever\Model\SectionsResponse|array
*/
public function getSections($limit = null, $starting_after = null, $ending_before = null)
public function getSections($limit = null, $starting_after = null, $ending_before = null, $returnSkipped = false)
{
list($response) = $this->getSectionsWithHttpInfo($limit, $starting_after, $ending_before);
list($response, $statusCode, $headers, $skippedItems) = $this->getSectionsWithHttpInfo($limit, $starting_after, $ending_before);

if ($returnSkipped) {
return [$response, $skippedItems];
}

return $response;
}

Expand Down Expand Up @@ -8181,10 +8186,23 @@ public function getSectionsWithHttpInfo($limit = null, $starting_after = null, $
}
}

$skippedItems = [];
if ($response->getStatusCode() === 200) {
$content->data = array_filter($content->data, function ($item) use (&$skippedItems) {
if (!$item->data || !$item->data->id || !$item->data->grade) {
$skippedItems[] = $item;
return false;
}

return true;
});
}

return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
$response->getHeaders(),
$skippedItems,
];

} catch (ApiException $e) {
Expand Down
47 changes: 27 additions & 20 deletions lib/Api/EventsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* The Clever API
*
* OpenAPI spec version: 2.0.0
*
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

Expand Down Expand Up @@ -110,7 +110,6 @@ public function getEventWithHttpInfo($id)
$request = $this->getEventRequest($id);

try {

try {
$response = $this->client->send($request);
} catch (RequestException $e) {
Expand Down Expand Up @@ -151,7 +150,6 @@ public function getEventWithHttpInfo($id)
$response->getStatusCode(),
$response->getHeaders()
];

} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
Expand All @@ -178,7 +176,7 @@ public function getEventWithHttpInfo($id)
/**
* Operation getEventAsync
*
*
*
*
* @param string $id (required)
*
Expand All @@ -198,7 +196,7 @@ function ($response) {
/**
* Operation getEventAsyncWithHttpInfo
*
*
*
*
* @param string $id (required)
*
Expand Down Expand Up @@ -298,7 +296,6 @@ protected function getEventRequest($id)
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present

} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
Expand All @@ -310,10 +307,8 @@ protected function getEventRequest($id)
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);

} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
Expand Down Expand Up @@ -353,14 +348,20 @@ protected function getEventRequest($id)
* @param string $ending_before ending_before (optional)
* @param string $school school (optional)
* @param string[] $record_type record_type (optional)
* @param bool $returnSkipped
*
* @throws \Clever\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Clever\Model\EventsResponse
*/
public function getEvents($limit = null, $starting_after = null, $ending_before = null, $school = null, $record_type = null)
public function getEvents($limit = null, $starting_after = null, $ending_before = null, $school = null, $record_type = null, $returnSkipped = false)
{
list($response) = $this->getEventsWithHttpInfo($limit, $starting_after, $ending_before, $school, $record_type);
list($response, $statusCode, $headers, $skippedItems) = $this->getEventsWithHttpInfo($limit, $starting_after, $ending_before, $school, $record_type);

if ($returnSkipped) {
return [$response, $skippedItems];
}

return $response;
}

Expand All @@ -383,7 +384,6 @@ public function getEventsWithHttpInfo($limit = null, $starting_after = null, $en
$request = $this->getEventsRequest($limit, $starting_after, $ending_before, $school, $record_type);

try {

try {
$response = $this->client->send($request);
} catch (RequestException $e) {
Expand Down Expand Up @@ -419,12 +419,24 @@ public function getEventsWithHttpInfo($limit = null, $starting_after = null, $en
}
}

$skippedItems = [];
if ($response->getStatusCode() === 200) {
$content->data = array_filter($content->data, function ($item) use (&$skippedItems) {
if (substr($item->data->type, 0, 9) === 'sections.' && (!$item->data->data->object->id || !$item->data->data->object->grade)) {
$skippedItems[] = $item;
return false;
}

return true;
});
}

return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
$response->getHeaders(),
$skippedItems,
];

} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
Expand All @@ -451,7 +463,7 @@ public function getEventsWithHttpInfo($limit = null, $starting_after = null, $en
/**
* Operation getEventsAsync
*
*
*
*
* @param int $limit (optional)
* @param string $starting_after (optional)
Expand All @@ -475,7 +487,7 @@ function ($response) {
/**
* Operation getEventsAsyncWithHttpInfo
*
*
*
*
* @param int $limit (optional)
* @param string $starting_after (optional)
Expand Down Expand Up @@ -542,7 +554,6 @@ function ($exception) {
*/
protected function getEventsRequest($limit = null, $starting_after = null, $ending_before = null, $school = null, $record_type = null)
{

$resourcePath = '/events';
$formParams = [];
$queryParams = [];
Expand Down Expand Up @@ -592,7 +603,6 @@ protected function getEventsRequest($limit = null, $starting_after = null, $endi
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present

} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
Expand All @@ -604,10 +614,8 @@ protected function getEventsRequest($limit = null, $starting_after = null, $endi
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);

} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
Expand Down Expand Up @@ -638,5 +646,4 @@ protected function getEventsRequest($limit = null, $starting_after = null, $endi
$httpBody
);
}

}
2 changes: 1 addition & 1 deletion lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Configuration
*
* @var string
*/
protected $host = 'https://api.clever.com/v2.0';
protected $host = 'https://api.clever.com/v2.1';

/**
* User agent of the HTTP request, set to "PHP-Swagger" by default
Expand Down
47 changes: 38 additions & 9 deletions lib/Model/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* The Clever API
*
* OpenAPI spec version: 2.0.0
*
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

Expand Down Expand Up @@ -71,7 +71,8 @@ class Section implements ModelInterface, ArrayAccess
'subject' => 'string',
'teacher' => 'string',
'teachers' => 'string[]',
'term_id' => 'string'
'term_id' => 'string',
'ext' => 'object',
];

/**
Expand All @@ -95,7 +96,8 @@ class Section implements ModelInterface, ArrayAccess
'subject' => null,
'teacher' => null,
'teachers' => null,
'term_id' => null
'term_id' => null,
'ext' => null,
];

/**
Expand Down Expand Up @@ -140,7 +142,8 @@ public static function swaggerFormats()
'subject' => 'subject',
'teacher' => 'teacher',
'teachers' => 'teachers',
'term_id' => 'term_id'
'term_id' => 'term_id',
'ext' => 'ext',
];

/**
Expand All @@ -164,7 +167,8 @@ public static function swaggerFormats()
'subject' => 'setSubject',
'teacher' => 'setTeacher',
'teachers' => 'setTeachers',
'term_id' => 'setTermId'
'term_id' => 'setTermId',
'ext' => 'setExt',
];

/**
Expand All @@ -188,7 +192,8 @@ public static function swaggerFormats()
'subject' => 'getSubject',
'teacher' => 'getTeacher',
'teachers' => 'getTeachers',
'term_id' => 'getTermId'
'term_id' => 'getTermId',
'ext' => 'getExt',
];

/**
Expand Down Expand Up @@ -343,6 +348,7 @@ public function __construct(array $data = null)
$this->container['teacher'] = isset($data['teacher']) ? $data['teacher'] : null;
$this->container['teachers'] = isset($data['teachers']) ? $data['teachers'] : null;
$this->container['term_id'] = isset($data['term_id']) ? $data['term_id'] : null;
$this->container['ext'] = isset($data['ext']) ? $data['ext'] : null;
}

/**
Expand Down Expand Up @@ -381,7 +387,6 @@ public function listInvalidProperties()
*/
public function valid()
{

$allowedValues = $this->getGradeAllowableValues();
if (!in_array($this->container['grade'], $allowedValues)) {
return false;
Expand Down Expand Up @@ -795,6 +800,32 @@ public function setTermId($term_id)

return $this;
}


/**
* Gets ext.
*
* @return string
*/
public function getExt()
{
return $this->container['ext'];
}

/**
* Sets ext.
*
* @param string $ext ext
*
* @return $this
*/
public function setExt($ext)
{
$this->container['ext'] = $ext;

return $this;
}

/**
* Returns true if offset exists. False otherwise.
*
Expand Down Expand Up @@ -865,5 +896,3 @@ public function __toString()
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}


0 comments on commit 34c53af

Please sign in to comment.