# Structures All structures are defined in the `proxy` namespace. ## ProxyEvent ***Abstract*** ### ProxyEvent::getInfo() ```cpp HttpInfo* getInfo() const; ``` ### ProxyEvent::getRequest() ```cpp HttpInfo::Request getRequest() const ``` ## RequestEvent ***Extends [ProxyEvent](#proxyevent)*** Sent upon the evoking of a request event listener. ### RequestEvent::getInfo() = [ProxyEvent::getInfo](#proxyeventgetinfo) ### RequestEvent::getRequest() = [ProxyEvent::getRequest](#proxyeventgetrequest) ## ResponseEvent ***Extends [ProxyEvent](#proxyevent)*** Sent upon the evoking of a response event listener. ### ResponseEvent::getInfo() = [ProxyEvent::getInfo](#proxyeventgetinfo) ### ResponseEvent::getRequest() = [ProxyEvent::getRequest](#proxyeventgetrequest) ### ResponseEvent::getResponse() ```cpp HttpInfo::Response getResponse() const ``` ## ProxyFilter ***Abstract*** ### ProxyFilter::ProxyFilter() ```cpp ProxyFilter(const enums::OriginFilter origin = OriginFilter::ALL_FILTER) ProxyFilter(const std::vector& urlParts) ``` ## RequestFilter ***Extends [ProxyFilter](#proxyfilter)*** ### RequestFilter::RequestFilter() = [ProxyFilter::ProxyFilter](#proxyfilterproxyfilter) ## ResponseFilter ***Extends [ProxyFilter](#proxyfilter)*** ### ResponseFilter::ResponseFilter() = [ProxyFilter::ProxyFilter](#proxyfilterproxyfilter) ## HttpInfo ### HttpInfo::cancel() Cancels the request if it hasn't finished yet. ```cpp void cancel() const ``` ### HttpInfo::isPaused() Checks if the request is paused by the proxy. ```cpp bool isPaused() const ``` ### HttpInfo::isInProgress() Checks if the request is still in progress. ```cpp bool isInProgress() const ``` ### HttpInfo::isCompleted() Checks if the request has completed. ```cpp bool isCompleted() const ``` ### HttpInfo::isFaulty() Checks if the request returned an error. ```cpp bool isFaulty() const ``` ### HttpInfo::isCancelled() Checks if the request has been cancelled by either the proxy or the original requester. ```cpp bool isCancelled() const ``` ### HttpInfo::isRepeat() Checks if the request is a repeat of a previous request by making use of the send button in the GDIntercept menu. ```cpp bool isRepeat() const ``` ### HttpInfo::responseReceived() Checks if the response has been received. ```cpp void responseReceived() const ``` ### HttpInfo::getID() ```cpp size_t getID() const ``` ### HttpInfo::getState() ```cpp enums::State getState() const ``` ### HttpInfo::getRequest() ```cpp HttpInfo::Request getRequest() const ``` ### HttpInfo::getResponse() ```cpp HttpInfo::Response getResponse() const ``` ## HttpInfo::HttpContent ### HttpInfo::HttpContent::type ```cpp HttpInfo::ContentType type ``` ### HttpInfo::HttpContent::contents ```cpp std::string contents ``` ## HttpInfo::URL ### HttpInfo::URL::stringifyProtocol() Stringifies the protocol of the URL to one of the following: - `HTTP` - `HTTPS` - `UNKNOWN` ```cpp std::string stringifyProtocol() const ``` ### HttpInfo::URL::stringifyQuery() Stringifies the query string of the URL to a formatted JSON string. ```cpp std::string stringifyQuery(const bool raw = false) const ``` ### HttpInfo::URL::getPortHost() Formats the host with the port if it is not the default port for the protocol or is a localhost. ```cpp std::string getPortHost() const ``` ### HttpInfo::URL::getOrigin() ```cpp enums::Origin getOrigin() const ``` ### HttpInfo::URL::getProtocol() ```cpp enums::Protocol getProtocol() const ``` ### HttpInfo::URL::getMethod() ```cpp std::string getMethod() const ``` ### HttpInfo::URL::getOriginal() ```cpp std::string getOriginal() const ``` ### HttpInfo::URL::getQueryLess() Gets the original URL without the query string. ```cpp std::string getQueryLess() const ``` ### HttpInfo::URL::getHost() ```cpp std::string getHost() const ``` ### HttpInfo::URL::getPort() ```cpp std::string getPort() const ``` ### HttpInfo::URL::getPath() ```cpp std::string getPath() const ``` ### HttpInfo::URL::getQuery() ```cpp nlohmann::json getQuery() const ``` ## HttpInfo::Request ### HttpInfo::Request::stringifyHeaders() Stringifies the headers of the request to a formatted JSON string. ```cpp std::string stringifyHeaders(const bool raw = false) const ``` ### HttpInfo::Request::getBodyContent() Gets the body contents of the request. ```cpp HttpInfo::HttpContent getBodyContent(const bool raw = true) const ``` ### HttpInfo::Request::getURL() ```cpp HttpInfo::URL getURL() const ``` ### HttpInfo::Request::getHeaders() ```cpp nlohmann::json getHeaders() const ``` ### HttpInfo::Request::getBody() ```cpp std::string getBody() const ``` ### HttpInfo::Request::getContentType() ```cpp enums::ContentType getContentType() const ``` ## HttpInfo::Response ### HttpInfo::Response::stringifyHeaders() Stringifies the headers of the response to a formatted JSON string. ```cpp std::string stringifyHeaders(const bool raw = false) const ``` ### HttpInfo::Response::stringifyStatusCode() Stringifies the status code of the response to either the integer code or one of the following error codes: - `No response available yet` (0) - `Request Error` (-1) - `Request Timeout` (-2) - `Request Cancelled` (-3) ```cpp std::string stringifyStatusCode() const ``` ### HttpInfo::Response::getResponseContent() Gets the response contents of the request. ```cpp HttpInfo::HttpContent getResponseContent(const bool raw = true) const ``` ### HttpInfo::Response::received() Checks if the response has been received. ```cpp bool received() const ``` ### HttpInfo::Response::getHeaders() ```cpp nlohmann::json getHeaders() const ``` ### HttpInfo::Response::getStatusCode() ```cpp int getStatusCode() const ``` ### HttpInfo::Response::getResponse() ```cpp std::string getResponse() const ``` ### HttpInfo::Response::getContentType() ```cpp enums::ContentType getContentType() const ```