Пример #1
0
        public async Task QueueBuild(CancellationToken ct)
        {
            var request = new QueueBuildRequest
            {
                Definition = new BuildDefinition
                {
                    Id = 5
                },
            };
            var body = new StringContent(JsonConvert.SerializeObject(request, Formatting.None), Encoding.UTF8, "application/json");

            using (var response = await _client.PostAsync("build/builds?api-version=5.0", body, ct))
            {
                response.EnsureSuccessStatusCode();
            }
        }
Пример #2
0
        public async Task QueueBuild(string channel, CancellationToken ct)
        {
            var parameters = new Dictionary <string, string>
            {
                { "duplicati.channel", channel }
            };
            var request = new QueueBuildRequest
            {
                Definition = new BuildDefinition
                {
                    Id = 1
                },
                Parameters = JsonConvert.SerializeObject(parameters, Formatting.None)
            };
            var body = new StringContent(JsonConvert.SerializeObject(request, Formatting.None), Encoding.UTF8, "application/json");

            using (var response = await _client.PostAsync("build/builds?api-version=5.0", body, ct))
            {
                response.EnsureSuccessStatusCode();
            }
        }