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> 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> 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 <IImmutableList <RepositoryBranch> > > ListRepositoriesInternalAsync( string branch = default, string repository = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/repo-config/repositories"; 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.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 OnListRepositoriesFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <RepositoryBranch> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <RepositoryBranch> >(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <IImmutableList <SubscriptionHistoryItem> > > GetSubscriptionHistoryInternalAsync( Guid id, int?page = default, int?perPage = default, CancellationToken cancellationToken = default ) { if (id == default(Guid)) { throw new ArgumentNullException(nameof(id)); } const string apiVersion = "2019-01-16"; var _path = "/api/subscriptions/{id}/history"; _path = _path.Replace("{id}", Client.Serialize(id)); var _query = new QueryBuilder(); 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 OnGetSubscriptionHistoryFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <SubscriptionHistoryItem> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <SubscriptionHistoryItem> >(_responseContent), }); } 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 != default) { _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; } }
internal async Task <HttpOperationResponse <Subscription> > UpdateSubscriptionInternalAsync( Guid id, SubscriptionUpdate body = default, CancellationToken cancellationToken = default ) { if (id == default(Guid)) { throw new ArgumentNullException(nameof(id)); } const string apiVersion = "2019-01-16"; var _path = "/api/subscriptions/{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 != default(SubscriptionUpdate)) { _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 OnUpdateSubscriptionFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <Subscription> { Request = _req, Response = _res, Body = Client.Deserialize <Subscription>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <IImmutableList <Subscription> > > ListSubscriptionsInternalAsync( int?channelId = default, bool?enabled = default, string sourceRepository = default, string targetRepository = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/subscriptions"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(sourceRepository)) { _query.Add("sourceRepository", Client.Serialize(sourceRepository)); } if (!string.IsNullOrEmpty(targetRepository)) { _query.Add("targetRepository", Client.Serialize(targetRepository)); } if (channelId != default(int?)) { _query.Add("channelId", Client.Serialize(channelId)); } if (enabled != default(bool?)) { _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 OnListSubscriptionsFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <IImmutableList <Subscription> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <Subscription> >(_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> CreateInternalAsync( DefaultChannelCreateData body, CancellationToken cancellationToken = default ) { if (body == default(DefaultChannelCreateData)) { throw new ArgumentNullException(nameof(body)); } if (!body.IsValid) { throw new ArgumentException("The parameter is not valid", nameof(body)); } const string apiVersion = "2019-01-16"; var _path = "/api/default-channels"; 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.Post, _url); string _requestContent = null; if (body != default(DefaultChannelCreateData)) { _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 OnCreateFailed(_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 <Build> > GetLatestInternalAsync( string buildNumber = default, int?channelId = default, string commit = default, bool?loadCollections = default, DateTimeOffset?notAfter = default, DateTimeOffset?notBefore = default, string repository = default, CancellationToken cancellationToken = default ) { const string apiVersion = "2019-01-16"; var _path = "/api/builds/latest"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(repository)) { _query.Add("repository", Client.Serialize(repository)); } if (!string.IsNullOrEmpty(commit)) { _query.Add("commit", Client.Serialize(commit)); } if (!string.IsNullOrEmpty(buildNumber)) { _query.Add("buildNumber", Client.Serialize(buildNumber)); } if (channelId != default) { _query.Add("channelId", Client.Serialize(channelId)); } if (notBefore != default) { _query.Add("notBefore", Client.Serialize(notBefore)); } if (notAfter != default) { _query.Add("notAfter", Client.Serialize(notAfter)); } if (loadCollections != default) { _query.Add("loadCollections", Client.Serialize(loadCollections)); } _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 OnGetLatestFailed(_req, _res); } string _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <Build> { Request = _req, Response = _res, Body = Client.Deserialize <Build>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }