KiCad PCB EDA Suite
|
#include <http_lib_connection.h>
Public Member Functions | |
HTTP_LIB_CONNECTION (const HTTP_LIB_SOURCE &aSource, bool aTestConnectionNow) | |
~HTTP_LIB_CONNECTION () | |
bool | IsValidEndpoint () const |
bool | SelectOne (const std::string &aPartID, HTTP_LIB_PART &aFetchedPart) |
Retrieves a single part with full details from the HTTP library. | |
bool | SelectAll (const HTTP_LIB_CATEGORY &aCategory, std::vector< HTTP_LIB_PART > &aParts) |
Retrieves all parts from a specific category from the HTTP library. | |
std::string | GetLastError () const |
std::vector< HTTP_LIB_CATEGORY > | getCategories () const |
std::string | getCategoryDescription (const std::string &aCategoryName) const |
auto | getCachedParts () |
Static Public Attributes | |
static const long | DEFAULT_TIMEOUT = 10 |
Private Member Functions | |
std::unique_ptr< KICAD_CURL_EASY > | createCurlEasyObject () |
bool | ValidateHTTPLibraryEndpoints () |
bool | syncCategories () |
bool | checkServerResponse (std::unique_ptr< KICAD_CURL_EASY > &aCurl) |
bool | boolFromString (const std::any &aVal, bool aDefaultValue=false) |
wxString | httpErrorCodeDescription (uint16_t aHttpCode) |
Private Attributes | |
HTTP_LIB_SOURCE | m_source |
std::map< std::string, HTTP_LIB_PART > | m_cachedParts |
std::map< std::string, std::tuple< std::string, std::string > > | m_cache |
bool | m_endpointValid = false |
std::string | m_lastError |
std::vector< HTTP_LIB_CATEGORY > | m_categories |
std::map< std::string, std::string > | m_categoryDescriptions |
std::map< std::string, std::string > | m_parts |
const std::string | http_endpoint_categories = "categories" |
const std::string | http_endpoint_parts = "parts" |
const std::string | http_endpoint_settings = "settings" |
const std::string | http_endpoint_auth = "authentication" |
Definition at line 32 of file http_lib_connection.h.
HTTP_LIB_CONNECTION::HTTP_LIB_CONNECTION | ( | const HTTP_LIB_SOURCE & | aSource, |
bool | aTestConnectionNow | ||
) |
Definition at line 37 of file http_lib_connection.cpp.
References m_source, and ValidateHTTPLibraryEndpoints().
HTTP_LIB_CONNECTION::~HTTP_LIB_CONNECTION | ( | ) |
Definition at line 48 of file http_lib_connection.cpp.
|
private |
Definition at line 392 of file http_lib_connection.cpp.
Referenced by SelectOne().
|
private |
Definition at line 378 of file http_lib_connection.cpp.
References _, httpErrorCodeDescription(), and m_lastError.
Referenced by SelectOne(), syncCategories(), and ValidateHTTPLibraryEndpoints().
|
inlineprivate |
Definition at line 73 of file http_lib_connection.h.
References m_source, and HTTP_LIB_SOURCE::token.
Referenced by SelectAll(), SelectOne(), syncCategories(), and ValidateHTTPLibraryEndpoints().
|
inline |
Definition at line 68 of file http_lib_connection.h.
References m_cache.
|
inline |
Definition at line 61 of file http_lib_connection.h.
References m_categories.
|
inline |
Definition at line 63 of file http_lib_connection.h.
References m_categoryDescriptions.
|
inline |
Definition at line 59 of file http_lib_connection.h.
References m_lastError.
|
private |
Definition at line 433 of file http_lib_connection.cpp.
Referenced by checkServerResponse().
bool HTTP_LIB_CONNECTION::IsValidEndpoint | ( | ) | const |
Definition at line 109 of file http_lib_connection.cpp.
References m_endpointValid.
Referenced by SelectAll(), SelectOne(), and syncCategories().
bool HTTP_LIB_CONNECTION::SelectAll | ( | const HTTP_LIB_CATEGORY & | aCategory, |
std::vector< HTTP_LIB_PART > & | aParts | ||
) |
Retrieves all parts from a specific category from the HTTP library.
aPk | is the primary key of the category |
aResults | will be filled with all parts in that category |
Definition at line 309 of file http_lib_connection.cpp.
References _, createCurlEasyObject(), HTTP_LIB_PART::fields, http_endpoint_parts, HTTP_LIB_PART::id, HTTP_LIB_CATEGORY::id, IsValidEndpoint(), m_cache, m_lastError, m_source, HTTP_LIB_PART::name, res, HTTP_LIB_SOURCE::root_url, and traceHTTPLib.
bool HTTP_LIB_CONNECTION::SelectOne | ( | const std::string & | aPartID, |
HTTP_LIB_PART & | aFetchedPart | ||
) |
Retrieves a single part with full details from the HTTP library.
aPk | is the primary key of the part |
aResult | will conatain the part if one was found |
Definition at line 177 of file http_lib_connection.cpp.
References _, boolFromString(), checkServerResponse(), createCurlEasyObject(), HTTP_LIB_PART::exclude_from_board, HTTP_LIB_PART::exclude_from_bom, HTTP_LIB_PART::exclude_from_sim, HTTP_LIB_PART::fields, http_endpoint_parts, HTTP_LIB_PART::id, IsValidEndpoint(), HTTP_LIB_PART::lastCached, m_cachedParts, m_lastError, m_source, HTTP_LIB_PART::name, res, HTTP_LIB_SOURCE::root_url, HTTP_LIB_PART::symbolIdStr, HTTP_LIB_SOURCE::timeout_parts, and traceHTTPLib.
|
private |
Definition at line 115 of file http_lib_connection.cpp.
References _, checkServerResponse(), createCurlEasyObject(), HTTP_LIB_CATEGORY::description, http_endpoint_categories, HTTP_LIB_CATEGORY::id, IsValidEndpoint(), m_categories, m_categoryDescriptions, m_lastError, m_source, HTTP_LIB_CATEGORY::name, res, HTTP_LIB_SOURCE::root_url, and traceHTTPLib.
Referenced by ValidateHTTPLibraryEndpoints().
|
private |
Definition at line 54 of file http_lib_connection.cpp.
References _, checkServerResponse(), createCurlEasyObject(), http_endpoint_categories, http_endpoint_parts, m_endpointValid, m_lastError, m_source, res, HTTP_LIB_SOURCE::root_url, syncCategories(), and traceHTTPLib.
Referenced by HTTP_LIB_CONNECTION().
|
static |
Definition at line 35 of file http_lib_connection.h.
|
private |
Definition at line 114 of file http_lib_connection.h.
|
private |
Definition at line 111 of file http_lib_connection.h.
Referenced by syncCategories(), and ValidateHTTPLibraryEndpoints().
|
private |
Definition at line 112 of file http_lib_connection.h.
Referenced by SelectAll(), SelectOne(), and ValidateHTTPLibraryEndpoints().
|
private |
Definition at line 113 of file http_lib_connection.h.
|
private |
Definition at line 100 of file http_lib_connection.h.
Referenced by getCachedParts(), and SelectAll().
|
private |
Definition at line 97 of file http_lib_connection.h.
Referenced by SelectOne().
|
private |
Definition at line 106 of file http_lib_connection.h.
Referenced by getCategories(), and syncCategories().
|
private |
Definition at line 107 of file http_lib_connection.h.
Referenced by getCategoryDescription(), and syncCategories().
|
private |
Definition at line 102 of file http_lib_connection.h.
Referenced by IsValidEndpoint(), and ValidateHTTPLibraryEndpoints().
|
private |
Definition at line 104 of file http_lib_connection.h.
Referenced by checkServerResponse(), GetLastError(), SelectAll(), SelectOne(), syncCategories(), and ValidateHTTPLibraryEndpoints().
|
private |
Definition at line 109 of file http_lib_connection.h.
|
private |
Definition at line 94 of file http_lib_connection.h.
Referenced by createCurlEasyObject(), HTTP_LIB_CONNECTION(), SelectAll(), SelectOne(), syncCategories(), and ValidateHTTPLibraryEndpoints().