internal async Task <HttpOperationResponse <DefaultChannel> > UpdateInternalAsync( int id, DefaultChannelUpdateData body = default, CancellationToken cancellationToken = default ) { if (id == default) { throw new ArgumentNullException(nameof(id)); } const string apiVersion = "2019-01-16"; var _path = "/api/default-channels/{id}"; _path = _path.Replace("{id}", Client.Serialize(id)); var _query = new QueryBuilder(); _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(new HttpMethod("PATCH"), _url); string _requestContent = null; if (body != null) { _requestContent = Client.Serialize(body); _req.Content = new StringContent(_requestContent, Encoding.UTF8) { Headers = { ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"), }, }; } if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnUpdateFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <DefaultChannel> { Request = _req, Response = _res, Body = Client.Deserialize <DefaultChannel>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <IImmutableList <DefaultChannel> > > ListInternalAsync( string branch = default, int?channelId = default, bool?enabled = default, string repository = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/default-channels"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(repository)) { _query.Add("repository", Client.Serialize(repository)); } if (!string.IsNullOrEmpty(branch)) { _query.Add("branch", Client.Serialize(branch)); } if (channelId != default) { _query.Add("channelId", Client.Serialize(channelId)); } if (enabled != default) { _query.Add("enabled", Client.Serialize(enabled)); } _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnListFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <DefaultChannel> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <DefaultChannel> >(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <IImmutableList <ReleasePipeline> > > ListInternalAsync( string organization = default, int?pipelineIdentifier = default, string project = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/pipelines"; var _query = new QueryBuilder(); if (pipelineIdentifier != default(int)) { _query.Add("pipelineIdentifier", Client.Serialize(pipelineIdentifier)); } if (!string.IsNullOrEmpty(organization)) { _query.Add("organization", Client.Serialize(organization)); } if (!string.IsNullOrEmpty(project)) { _query.Add("project", Client.Serialize(project)); } _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnListFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <ReleasePipeline> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <ReleasePipeline> >(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse> RemoveAssetLocationFromAssetInternalAsync( int assetId, int assetLocationId, CancellationToken cancellationToken = default ) { if (assetId == default(int)) { throw new ArgumentNullException(nameof(assetId)); } if (assetLocationId == default(int)) { throw new ArgumentNullException(nameof(assetLocationId)); } const string apiVersion = "2019-01-16"; var _path = "/api/assets/{assetId}/locations/{assetLocationId}"; _path = _path.Replace("{assetId}", Client.Serialize(assetId)); _path = _path.Replace("{assetLocationId}", Client.Serialize(assetLocationId)); var _query = new QueryBuilder(); _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Delete, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnRemoveAssetLocationFromAssetFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse { Request = _req, Response = _res, }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <IImmutableList <Asset> > > ListAssetsInternalAsync( int?buildId = default, bool?loadLocations = default, string name = default, bool?nonShipping = default, int?page = default, int?perPage = default, string version = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/assets"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(name)) { _query.Add("name", Client.Serialize(name)); } if (!string.IsNullOrEmpty(version)) { _query.Add("version", Client.Serialize(version)); } if (buildId != default(int?)) { _query.Add("buildId", Client.Serialize(buildId)); } if (nonShipping != default(bool?)) { _query.Add("nonShipping", Client.Serialize(nonShipping)); } if (loadLocations != default(bool?)) { _query.Add("loadLocations", Client.Serialize(loadLocations)); } if (page != default(int?)) { _query.Add("page", Client.Serialize(page)); } if (perPage != default(int?)) { _query.Add("perPage", Client.Serialize(perPage)); } _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnListAssetsFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <Asset> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <Asset> >(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse> RetryActionAsyncInternalAsync( string branch, string repository, long timestamp, CancellationToken cancellationToken = default ) { if (string.IsNullOrEmpty(branch)) { throw new ArgumentNullException(nameof(branch)); } if (string.IsNullOrEmpty(repository)) { throw new ArgumentNullException(nameof(repository)); } if (timestamp == default) { throw new ArgumentNullException(nameof(timestamp)); } const string apiVersion = "2019-01-16"; var _path = "/api/repo-config/retry/{timestamp}"; _path = _path.Replace("{timestamp}", Client.Serialize(timestamp)); var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(repository)) { _query.Add("repository", Client.Serialize(repository)); } if (!string.IsNullOrEmpty(branch)) { _query.Add("branch", Client.Serialize(branch)); } _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Post, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnRetryActionAsyncFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse { Request = _req, Response = _res, }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse> SetMergePoliciesInternalAsync( string branch, string repository, IImmutableList <MergePolicy> body = default, CancellationToken cancellationToken = default ) { if (string.IsNullOrEmpty(branch)) { throw new ArgumentNullException(nameof(branch)); } if (string.IsNullOrEmpty(repository)) { throw new ArgumentNullException(nameof(repository)); } const string apiVersion = "2019-01-16"; var _path = "/api/repo-config/merge-policy"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(repository)) { _query.Add("repository", Client.Serialize(repository)); } if (!string.IsNullOrEmpty(branch)) { _query.Add("branch", Client.Serialize(branch)); } _query.Add("api-version", Client.Serialize(apiVersion)); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Post, _url); string _requestContent = null; if (body != null) { _requestContent = Client.Serialize(body); _req.Content = new StringContent(_requestContent, Encoding.UTF8) { Headers = { ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"), }, }; } if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { await OnSetMergePoliciesFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse { Request = _req, Response = _res, }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }