php.api.mustache Maven / Gradle / Ivy
apiClient = $apiClient;
}
{{#operation}}
/**
* {{nickname}}
* {{summary}}
{{#allParams}}
* {{paramName}}, {{dataType}}: {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
{{newline}}
{{/allParams}}
* @return {{returnType}}
*/
public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
//parse inputs
$resourcePath = "{{path}}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "{{httpMethod}}";
$queryParams = array();
$headerParams = array();
{{#queryParams}}
if(${{paramName}} != null) {
$queryParams['{{paramName}}'] = $this->apiClient->toQueryValue(${{paramName}});
}
{{/queryParams}}
{{#headerParams}}
if(${{paramName}} != null) {
$headerParams['{{paramName}}'] = $this->apiClient->toHeaderValue(${{paramName}});
}
{{/headerParams}}
{{#pathParams}}
if(${{paramName}} != null) {
$resourcePath = str_replace("{" . "{{paramName}}" . "}",
$this->apiClient->toPathValue(${{paramName}}), $resourcePath);
}
{{/pathParams}}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
{{#returnType}}
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'{{returnType}}');
return $responseObject;
{{/returnType}}
}
{{/operation}}
{{newline}}
{{/operations}}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy