Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP9-12596 regenerate, add new client, add simple test #503

Merged
merged 2 commits into from Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
141 changes: 141 additions & 0 deletions src/Picturepark.SDK.V1.CloudManager/Generated/Clients.Generated.cs
Expand Up @@ -9734,6 +9734,147 @@ public async System.Threading.Tasks.Task<BusinessProcess> UpdateOutdatedMetadata
}
}

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="ApiException">A server side error occurred.</exception>
/// <exception cref="PictureparkValidationException">Validation exception</exception>
/// <exception cref="PictureparkForbiddenException">Forbidden</exception>
/// <exception cref="PictureparkNotFoundException">Entity not found</exception>
/// <exception cref="PictureparkConflictException">Version conflict</exception>
/// <exception cref="PictureparkException">Internal server error</exception>
public async System.Threading.Tasks.Task<BusinessProcess> AddStatisticsEventsAsync(string id, AddContentEventsRequest request, System.TimeSpan? timeout = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var urlBuilder_ = new System.Text.StringBuilder();
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/Maintenance/customer/{id}/statistics/events?");
urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
if (timeout != null)
{
urlBuilder_.Append(System.Uri.EscapeDataString("timeout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timeout, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
}
urlBuilder_.Length--;

var client_ = _httpClient;
try
{
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
{
var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value));
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));

PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
PrepareRequest(client_, request_, url_);

var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
try
{
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
headers_[item_.Key] = item_.Value;
}

ProcessResponse(client_, response_);

var status_ = ((int)response_.StatusCode).ToString();
if (status_ == "200")
{
var objectResponse_ = await ReadObjectResponseAsync<BusinessProcess>(response_, headers_).ConfigureAwait(false);
return objectResponse_.Object;
}
else
if (status_ == "400")
{
var objectResponse_ = await ReadObjectResponseAsync<PictureparkValidationException>(response_, headers_).ConfigureAwait(false);
var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PictureparkValidationException();
responseObject_.Data.Add("HttpStatus", status_);
responseObject_.Data.Add("HttpHeaders", headers_);
responseObject_.Data.Add("HttpResponse", objectResponse_.Text);
throw responseObject_;
}
else
if (status_ == "401")
{
string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("Unauthorized", (int)response_.StatusCode, responseText_, headers_, null);
}
else
if (status_ == "403")
{
var objectResponse_ = await ReadObjectResponseAsync<PictureparkForbiddenException>(response_, headers_).ConfigureAwait(false);
var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PictureparkForbiddenException();
responseObject_.Data.Add("HttpStatus", status_);
responseObject_.Data.Add("HttpHeaders", headers_);
responseObject_.Data.Add("HttpResponse", objectResponse_.Text);
throw responseObject_;
}
else
if (status_ == "404")
{
var objectResponse_ = await ReadObjectResponseAsync<PictureparkNotFoundException>(response_, headers_).ConfigureAwait(false);
var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PictureparkNotFoundException();
responseObject_.Data.Add("HttpStatus", status_);
responseObject_.Data.Add("HttpHeaders", headers_);
responseObject_.Data.Add("HttpResponse", objectResponse_.Text);
throw responseObject_;
}
else
if (status_ == "405")
{
string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("Method not allowed", (int)response_.StatusCode, responseText_, headers_, null);
}
else
if (status_ == "409")
{
var objectResponse_ = await ReadObjectResponseAsync<PictureparkConflictException>(response_, headers_).ConfigureAwait(false);
var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PictureparkConflictException();
responseObject_.Data.Add("HttpStatus", status_);
responseObject_.Data.Add("HttpHeaders", headers_);
responseObject_.Data.Add("HttpResponse", objectResponse_.Text);
throw responseObject_;
}
else
if (status_ == "429")
{
string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("Too many requests", (int)response_.StatusCode, responseText_, headers_, null);
}
else
if (status_ == "500")
{
var objectResponse_ = await ReadObjectResponseAsync<PictureparkException>(response_, headers_).ConfigureAwait(false);
var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PictureparkException();
responseObject_.Data.Add("HttpStatus", status_);
responseObject_.Data.Add("HttpHeaders", headers_);
responseObject_.Data.Add("HttpResponse", objectResponse_.Text);
throw responseObject_;
}
else
if (status_ != "200" && status_ != "204")
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
}

return default(BusinessProcess);
}
finally
{
if (response_ != null)
response_.Dispose();
}
}
}
finally
{
}
}

protected struct ObjectResponseResult<T>
{
public ObjectResponseResult(T responseObject, string responseText)
Expand Down