From 2abd895682ec8707f30fc6babbf3787e00a8c280 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 25 Aug 2018 20:42:44 +0300 Subject: Implement CI request submission --- bdep/http-service.hxx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 bdep/http-service.hxx (limited to 'bdep/http-service.hxx') diff --git a/bdep/http-service.hxx b/bdep/http-service.hxx new file mode 100644 index 0000000..b1db7e7 --- /dev/null +++ b/bdep/http-service.hxx @@ -0,0 +1,59 @@ +// file : bdep/http-service.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BDEP_HTTP_SERVICE_HXX +#define BDEP_HTTP_SERVICE_HXX + +#include + +#include +#include + +#include + +namespace bdep +{ + namespace http_service + { + // If type is file, then the value is a path to be uploaded. + // + struct parameter + { + enum {text, file} type; + string name; + string value; + }; + using parameters = vector; + + struct result + { + string message; + optional reference; + + // Does not include status, message, or reference. + // + vector body; + }; + + // Submit text parameters and/or upload files to an HTTP service via the + // POST method. Use the multipart/form-data content type if any files are + // uploaded and application/x-www-form-urlencoded otherwise. + // + // On success, return the response manifest message and reference (if + // present, see below) and the rest of the manifest values, if any. Issue + // diagnostics and fail if anything goes wrong or the response manifest + // status value is not 200 (success). + // + // Note that the HTTP service is expected to respond with the result + // manifest that starts with the 'status' (HTTP status code) and 'message' + // (diagnostics message) values optionally followed by 'reference' and + // then other manifest values. If the status is not 200 and reference is + // present, then it is included in the diagnostics. + // + result + post (const common_options& o, const url&, const parameters&); + } +} + +#endif // BDEP_HTTP_SERVICE_HXX -- cgit v1.1