whoami7 - Manager
:
/
home
/
kckglobal
/
www
/
portal
/
vendor
/
mailchimp
/
marketing
/
lib
/
Api
/
Upload File:
files >> /home/kckglobal/www/portal/vendor/mailchimp/marketing/lib/Api/ReportingApi.php
<?php /** * ReportingApi * PHP version 5 * * @category Class * @package MailchimpMarketing * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ /** * Mailchimp Marketing API * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 3.0.80 * Contact: apihelp@mailchimp.com * Generated by: https://github.com/swagger-api/swagger-codegen.git * Swagger Codegen version: 2.4.12 */ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen * Do not edit the class manually. */ namespace MailchimpMarketing\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Query; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use MailchimpMarketing\ApiException; use MailchimpMarketing\Configuration; use MailchimpMarketing\HeaderSelector; use MailchimpMarketing\ObjectSerializer; class ReportingApi { protected $client; protected $config; protected $headerSelector; public function __construct(Configuration $config = null) { $this->client = new Client([ 'defaults' => [ 'timeout' => 120.0 ] ]); $this->headerSelector = new HeaderSelector(); $this->config = $config ?: new Configuration(); } public function getConfig() { return $this->config; } public function getFacebookAdsReportAll($fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null, $sort_dir = null) { $response = $this->getFacebookAdsReportAllWithHttpInfo($fields, $exclude_fields, $count, $offset, $sort_field, $sort_dir); return $response; } public function getFacebookAdsReportAllWithHttpInfo($fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null, $sort_dir = null) { $request = $this->getFacebookAdsReportAllRequest($fields, $exclude_fields, $count, $offset, $sort_field, $sort_dir); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getFacebookAdsReportAllRequest($fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null, $sort_dir = null) { if ($count !== null && $count > 1000) { throw new \InvalidArgumentException('invalid value for "$count" when calling ReportingApi., must be smaller than or equal to 1000.'); } $resourcePath = '/reporting/facebook-ads'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($count !== null) { $queryParams['count'] = ObjectSerializer::toQueryValue($count); } // query params if ($offset !== null) { $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($sort_field !== null) { $queryParams['sort_field'] = ObjectSerializer::toQueryValue($sort_field); } // query params if ($sort_dir !== null) { $queryParams['sort_dir'] = ObjectSerializer::toQueryValue($sort_dir); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getFacebookAdReport($outreach_id, $fields = null, $exclude_fields = null) { $response = $this->getFacebookAdReportWithHttpInfo($outreach_id, $fields, $exclude_fields); return $response; } public function getFacebookAdReportWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null) { $request = $this->getFacebookAdReportRequest($outreach_id, $fields, $exclude_fields); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getFacebookAdReportRequest($outreach_id, $fields = null, $exclude_fields = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } $resourcePath = '/reporting/facebook-ads/{outreach_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getFacebookAdProductActivityReport($outreach_id, $fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null) { $response = $this->getFacebookAdProductActivityReportWithHttpInfo($outreach_id, $fields, $exclude_fields, $count, $offset, $sort_field); return $response; } public function getFacebookAdProductActivityReportWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null) { $request = $this->getFacebookAdProductActivityReportRequest($outreach_id, $fields, $exclude_fields, $count, $offset, $sort_field); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getFacebookAdProductActivityReportRequest($outreach_id, $fields = null, $exclude_fields = null, $count = '10', $offset = '0', $sort_field = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } if ($count !== null && $count > 1000) { throw new \InvalidArgumentException('invalid value for "$count" when calling ReportingApi., must be smaller than or equal to 1000.'); } $resourcePath = '/reporting/facebook-ads/{outreach_id}/ecommerce-product-activity'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($count !== null) { $queryParams['count'] = ObjectSerializer::toQueryValue($count); } // query params if ($offset !== null) { $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($sort_field !== null) { $queryParams['sort_field'] = ObjectSerializer::toQueryValue($sort_field); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getLandingPageReportsAll($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { $response = $this->getLandingPageReportsAllWithHttpInfo($fields, $exclude_fields, $count, $offset); return $response; } public function getLandingPageReportsAllWithHttpInfo($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { $request = $this->getLandingPageReportsAllRequest($fields, $exclude_fields, $count, $offset); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getLandingPageReportsAllRequest($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { if ($count !== null && $count > 1000) { throw new \InvalidArgumentException('invalid value for "$count" when calling ReportingApi., must be smaller than or equal to 1000.'); } $resourcePath = '/reporting/landing-pages'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($count !== null) { $queryParams['count'] = ObjectSerializer::toQueryValue($count); } // query params if ($offset !== null) { $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getLandingPageReport($outreach_id, $fields = null, $exclude_fields = null) { $response = $this->getLandingPageReportWithHttpInfo($outreach_id, $fields, $exclude_fields); return $response; } public function getLandingPageReportWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null) { $request = $this->getLandingPageReportRequest($outreach_id, $fields, $exclude_fields); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getLandingPageReportRequest($outreach_id, $fields = null, $exclude_fields = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } $resourcePath = '/reporting/landing-pages/{outreach_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyReportsAll($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { $response = $this->getSurveyReportsAllWithHttpInfo($fields, $exclude_fields, $count, $offset); return $response; } public function getSurveyReportsAllWithHttpInfo($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { $request = $this->getSurveyReportsAllRequest($fields, $exclude_fields, $count, $offset); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyReportsAllRequest($fields = null, $exclude_fields = null, $count = '10', $offset = '0') { if ($count !== null && $count > 1000) { throw new \InvalidArgumentException('invalid value for "$count" when calling ReportingApi., must be smaller than or equal to 1000.'); } $resourcePath = '/reporting/surveys'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($count !== null) { $queryParams['count'] = ObjectSerializer::toQueryValue($count); } // query params if ($offset !== null) { $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyReport($outreach_id, $fields = null, $exclude_fields = null) { $response = $this->getSurveyReportWithHttpInfo($outreach_id, $fields, $exclude_fields); return $response; } public function getSurveyReportWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null) { $request = $this->getSurveyReportRequest($outreach_id, $fields, $exclude_fields); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyReportRequest($outreach_id, $fields = null, $exclude_fields = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyQuestionReportsAll($outreach_id, $fields = null, $exclude_fields = null) { $response = $this->getSurveyQuestionReportsAllWithHttpInfo($outreach_id, $fields, $exclude_fields); return $response; } public function getSurveyQuestionReportsAllWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null) { $request = $this->getSurveyQuestionReportsAllRequest($outreach_id, $fields, $exclude_fields); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyQuestionReportsAllRequest($outreach_id, $fields = null, $exclude_fields = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}/questions'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyQuestionReport($outreach_id, $question_id, $fields = null, $exclude_fields = null) { $response = $this->getSurveyQuestionReportWithHttpInfo($outreach_id, $question_id, $fields, $exclude_fields); return $response; } public function getSurveyQuestionReportWithHttpInfo($outreach_id, $question_id, $fields = null, $exclude_fields = null) { $request = $this->getSurveyQuestionReportRequest($outreach_id, $question_id, $fields, $exclude_fields); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyQuestionReportRequest($outreach_id, $question_id, $fields = null, $exclude_fields = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } // verify the required parameter 'question_id' is set if ($question_id === null || (is_array($question_id) && count($question_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $question_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}/questions/{question_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // path params if ($question_id !== null) { $resourcePath = str_replace( '{' . 'question_id' . '}', ObjectSerializer::toPathValue($question_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyQuestionAnswers($outreach_id, $question_id, $fields = null, $exclude_fields = null, $respondent_familiarity_is = null) { $response = $this->getSurveyQuestionAnswersWithHttpInfo($outreach_id, $question_id, $fields, $exclude_fields, $respondent_familiarity_is); return $response; } public function getSurveyQuestionAnswersWithHttpInfo($outreach_id, $question_id, $fields = null, $exclude_fields = null, $respondent_familiarity_is = null) { $request = $this->getSurveyQuestionAnswersRequest($outreach_id, $question_id, $fields, $exclude_fields, $respondent_familiarity_is); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyQuestionAnswersRequest($outreach_id, $question_id, $fields = null, $exclude_fields = null, $respondent_familiarity_is = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } // verify the required parameter 'question_id' is set if ($question_id === null || (is_array($question_id) && count($question_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $question_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}/questions/{question_id}/answers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($respondent_familiarity_is !== null) { $queryParams['respondent_familiarity_is'] = ObjectSerializer::toQueryValue($respondent_familiarity_is); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // path params if ($question_id !== null) { $resourcePath = str_replace( '{' . 'question_id' . '}', ObjectSerializer::toPathValue($question_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyResponsesAll($outreach_id, $fields = null, $exclude_fields = null, $answered_question = null, $chose_answer = null, $respondent_familiarity_is = null) { $response = $this->getSurveyResponsesAllWithHttpInfo($outreach_id, $fields, $exclude_fields, $answered_question, $chose_answer, $respondent_familiarity_is); return $response; } public function getSurveyResponsesAllWithHttpInfo($outreach_id, $fields = null, $exclude_fields = null, $answered_question = null, $chose_answer = null, $respondent_familiarity_is = null) { $request = $this->getSurveyResponsesAllRequest($outreach_id, $fields, $exclude_fields, $answered_question, $chose_answer, $respondent_familiarity_is); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyResponsesAllRequest($outreach_id, $fields = null, $exclude_fields = null, $answered_question = null, $chose_answer = null, $respondent_familiarity_is = null) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}/responses'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if (is_array($fields)) { $queryParams['fields'] = ObjectSerializer::serializeCollection($fields, 'csv'); } else if ($fields !== null) { $queryParams['fields'] = ObjectSerializer::toQueryValue($fields); } // query params if (is_array($exclude_fields)) { $queryParams['exclude_fields'] = ObjectSerializer::serializeCollection($exclude_fields, 'csv'); } else if ($exclude_fields !== null) { $queryParams['exclude_fields'] = ObjectSerializer::toQueryValue($exclude_fields); } // query params if ($answered_question !== null) { $queryParams['answered_question'] = ObjectSerializer::toQueryValue($answered_question); } // query params if ($chose_answer !== null) { $queryParams['chose_answer'] = ObjectSerializer::toQueryValue($chose_answer); } // query params if ($respondent_familiarity_is !== null) { $queryParams['respondent_familiarity_is'] = ObjectSerializer::toQueryValue($respondent_familiarity_is); } // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } public function getSurveyResponse($outreach_id, $response_id) { $response = $this->getSurveyResponseWithHttpInfo($outreach_id, $response_id); return $response; } public function getSurveyResponseWithHttpInfo($outreach_id, $response_id) { $request = $this->getSurveyResponseRequest($outreach_id, $response_id); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw $e; } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); $content = $responseBody->getContents(); $content = json_decode($content); return $content; } catch (ApiException $e) { throw $e->getResponseBody(); } } protected function getSurveyResponseRequest($outreach_id, $response_id) { // verify the required parameter 'outreach_id' is set if ($outreach_id === null || (is_array($outreach_id) && count($outreach_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $outreach_id when calling ' ); } // verify the required parameter 'response_id' is set if ($response_id === null || (is_array($response_id) && count($response_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $response_id when calling ' ); } $resourcePath = '/reporting/surveys/{outreach_id}/responses/{response_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // path params if ($outreach_id !== null) { $resourcePath = str_replace( '{' . 'outreach_id' . '}', ObjectSerializer::toPathValue($outreach_id), $resourcePath ); } // path params if ($response_id !== null) { $resourcePath = str_replace( '{' . 'response_id' . '}', ObjectSerializer::toPathValue($response_id), $resourcePath ); } // body params $_tempBody = null; if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json', 'application/problem+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json', 'application/problem+json'], ['application/json'] ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; if($headers['Content-Type'] === 'application/json') { if ($httpBody instanceof \stdClass) { $httpBody = \GuzzleHttp\json_encode($httpBody); } if (is_array($httpBody)) { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody)); } } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { $httpBody = Query::build($formParams); } } // Basic Authentication if (!empty($this->config->getUsername()) && !empty($this->config->getPassword())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } // OAuth Authentication if (!empty($this->config->getAccessToken())) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = Query::build($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } protected function createHttpClientOption() { $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } if ($this->config->getTimeout()) { $options[RequestOptions::TIMEOUT] = $this->config->getTimeout(); } return $options; } }
Copyright ©2021 || Defacer Indonesia