1#ifndef TENDUKE_HTTP_HTTPREQUESTBUILDER_H 
    2#define TENDUKE_HTTP_HTTPREQUESTBUILDER_H 
    4#include "./HTTPRequest.h" 
    5#include "./HTTPRequestAuthenticator.h" 
    6#include "net/URLBuilder.h" 
    7#include "net/URLEncoder.h" 
   32            std::shared_ptr<const tenduke::net::URLEncoder> urlEncoder,
 
   42    std::unique_ptr<HTTPRequest> 
build();
 
   52    std::unique_ptr<HTTPCall> 
call();
 
  140    const std::shared_ptr<const tenduke::net::URLEncoder> urlEncoder;
 
  143    std::string requestEntity; 
 
  145    std::shared_ptr<const tenduke::http::HTTPRequestAuthenticator> requestAuthenticator;
 
  146    std::multimap<std::string, std::string> headers;
 
  147    std::multimap<std::string, std::string> formParameters;
 
  148    std::string requestContentType;
 
  149    std::string requestCharset;
 
  151    long connectionTimeoutMs;
 
 
HTTPRequestBuilder & contentType(const std::string &contentType)
Sets content-type.
Definition HTTPRequestBuilder.cpp:130
 
HTTPRequestBuilder & charset(const std::string &charset)
Sets character set.
Definition HTTPRequestBuilder.cpp:136
 
HTTPRequestBuilder(std::shared_ptr< const tenduke::net::URLEncoder > urlEncoder, tenduke::http::HTTPClient *client=nullptr, long connectionTimeoutMs=tenduke::http::DEFAULT_CONNECTION_TIMEOUT_MS, long timeoutMs=tenduke::http::DEFAULT_TIMEOUT_MS)
Constructs new instance.
Definition HTTPRequestBuilder.cpp:10
 
HTTPRequestBuilder & url(const std::string &url)
Sets the request URL.
Definition HTTPRequestBuilder.cpp:91
 
HTTP-call which executes the request and returns HTTPResponse.
Definition HTTPCall.h:15
 
A simple HTTP-client.
Definition HTTPClient.h:19
 
HTTPRequestBuilder & get()
Sets the method to GET.
Definition HTTPRequestBuilder.cpp:79
 
HTTPRequestBuilder & body(const std::string &requestEntity)
Sets body as string.
Definition HTTPRequestBuilder.cpp:103
 
tenduke::net::URLBuilder url()
Starts URL-building.
Definition HTTPRequestBuilder.cpp:147
 
HTTPRequestBuilder & contentType(const std::string &contentType)
Sets content-type.
Definition HTTPRequestBuilder.cpp:130
 
HTTPRequestBuilder & formParameter(const std::string &name, const std::string &value)
Adds form-parameter to the request.
Definition HTTPRequestBuilder.cpp:110
 
HTTPRequestBuilder & post()
Sets the method to POST.
Definition HTTPRequestBuilder.cpp:85
 
std::unique_ptr< HTTPRequest > build()
Builds the request.
Definition HTTPRequestBuilder.cpp:21
 
HTTPRequestBuilder & header(const std::string &name, const std::string &value, bool skipIfValueEmpty=true)
Adds header to the request.
Definition HTTPRequestBuilder.cpp:118
 
HTTPRequestBuilder & charset(const std::string &charset)
Sets character set.
Definition HTTPRequestBuilder.cpp:136
 
std::unique_ptr< HTTPCall > call()
Builds the request, and builds the call in one call.
Definition HTTPRequestBuilder.cpp:51
 
std::string buildMessageBodyFromFormParameters()
Builds the message body from form-parameters.
Definition HTTPRequestBuilder.cpp:60
 
HTTPRequestBuilder & authenticateWith(const std::shared_ptr< const tenduke::http::HTTPRequestAuthenticator > &requestAuthenticator)
Sets the request authenticator.
Definition HTTPRequestBuilder.cpp:97
 
HTTPRequestBuilder(std::shared_ptr< const tenduke::net::URLEncoder > urlEncoder, tenduke::http::HTTPClient *client=nullptr, long connectionTimeoutMs=tenduke::http::DEFAULT_CONNECTION_TIMEOUT_MS, long timeoutMs=tenduke::http::DEFAULT_TIMEOUT_MS)
Constructs new instance.
Definition HTTPRequestBuilder.cpp:10
 
HTTPRequestBuilder & utf8()
Sets the character set to UTF-8.
Definition HTTPRequestBuilder.cpp:142
 
Very simple URL-builder.
Definition URLBuilder.h:19
 
HTTP-related services.
Definition BadRequest.h:6
 
const long DEFAULT_CONNECTION_TIMEOUT_MS
Default connection time out in milliseconds.
Definition HTTPRequest.h:13
 
const long DEFAULT_TIMEOUT_MS
Default total time out in milliseconds.
Definition HTTPRequest.h:16
 
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4