Ejemplo n.º 1
0
        /// <summary>
        /// Gets the deployments page asynchronously.
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <returns></returns>
        public async Task <IDeploymentDetails[]> GetDeploymentsPageAsync(string environment, int pageNumber)
        {
            Assumption.AssertNotNullOrWhiteSpace(this._readAccessToken, nameof(this._readAccessToken));

            var config = new RollbarConfig(this._readAccessToken);

            using HttpClient httpClient = new HttpClient();
            RollbarDeployClient rollbarClient = new RollbarDeployClient(config, httpClient);
            var result = await rollbarClient.GetDeploymentsAsync(this._readAccessToken, pageNumber);

            return(result.DeploysPage.Deploys);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the deployment asynchronously.
        /// </summary>
        /// <param name="deploymentID">The deployment identifier.</param>
        /// <returns></returns>
        public async Task <IDeploymentDetails> GetDeploymentAsync(string deploymentID)
        {
            Assumption.AssertNotNullOrWhiteSpace(deploymentID, nameof(deploymentID));
            Assumption.AssertNotNullOrWhiteSpace(this._readAccessToken, nameof(this._readAccessToken));

            var config = new RollbarConfig(this._readAccessToken);

            using HttpClient httpClient = new HttpClient();
            RollbarDeployClient rollbarClient = new RollbarDeployClient(config, httpClient);
            var result = await rollbarClient.GetDeploymentAsync(this._readAccessToken, deploymentID);

            return(result.Deploy);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Registers the deployment asynchronously.
        /// </summary>
        /// <param name="deployment">The deployment.</param>
        /// <returns></returns>
        public async Task RegisterAsync(IDeployment deployment)
        {
            Assumption.AssertNotNullOrWhiteSpace(this._writeAccessToken, nameof(this._writeAccessToken));

            var config =
                new RollbarConfig(this._writeAccessToken)
            {
                Environment = deployment.Environment,
            };

            using HttpClient httpClient = new HttpClient();
            RollbarDeployClient rollbarClient = new RollbarDeployClient(config, httpClient);
            await rollbarClient.PostAsync(deployment);
        }