| 
    KiCad PCB EDA Suite
    
   | 
 
#include <http_lib_connection.h>
Public Member Functions | |
| HTTP_LIB_CONNECTION (const HTTP_LIB_SOURCE &aSource, bool aTestConnectionNow) | |
| virtual | ~HTTP_LIB_CONNECTION ()=default | 
| bool | IsValidEndpoint () const | 
| bool | SelectOne (const std::string &aPartID, HTTP_LIB_PART &aFetchedPart) | 
| Retrieve a single part with full details from the HTTP library.   | |
| bool | SelectAll (const HTTP_LIB_CATEGORY &aCategory, std::vector< HTTP_LIB_PART > &aParts) | 
| Retrieve 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) | 
| wxString | httpErrorCodeDescription (uint16_t aHttpCode) | 
| HTTP response status codes indicate whether a specific HTTP request has been successfully completed.   | |
Private Attributes | |
| HTTP_LIB_SOURCE | m_source | 
| 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 | 
| std::map< std::string, HTTP_LIB_PART > | m_cachedParts | 
| std::map< std::string, std::tuple< std::string, std::string > > | m_cache | 
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 39 of file http_lib_connection.cpp.
References m_source, and validateHttpLibraryEndpoints().
      
  | 
  virtualdefault | 
      
  | 
  private | 
Definition at line 385 of file http_lib_connection.cpp.
References _, httpErrorCodeDescription(), and m_lastError.
Referenced by SelectOne(), syncCategories(), and validateHttpLibraryEndpoints().
      
  | 
  inlineprivate | 
Definition at line 78 of file http_lib_connection.h.
References m_source.
Referenced by SelectAll(), SelectOne(), syncCategories(), and validateHttpLibraryEndpoints().
      
  | 
  inline | 
Definition at line 72 of file http_lib_connection.h.
References m_cache.
      
  | 
  inline | 
Definition at line 62 of file http_lib_connection.h.
References m_categories.
      
  | 
  inline | 
Definition at line 64 of file http_lib_connection.h.
References m_categoryDescriptions.
      
  | 
  inline | 
Definition at line 60 of file http_lib_connection.h.
References m_lastError.
      
  | 
  private | 
HTTP response status codes indicate whether a specific HTTP request has been successfully completed.
Responses are grouped in five classes:
Server error responses (500 ? 599)
see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
Definition at line 400 of file http_lib_connection.cpp.
Referenced by checkServerResponse().
      
  | 
  inline | 
Definition at line 40 of file http_lib_connection.h.
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 ) | 
Retrieve 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 336 of file http_lib_connection.cpp.
References _, createCurlEasyObject(), HTTP_LIB_CATEGORY::id, HTTP_LIB_PART::id, IsValidEndpoint(), m_cache, m_lastError, m_source, HTTP_LIB_PART::name, res, setPartIdNameAndMetadata(), and traceHTTPLib.
| bool HTTP_LIB_CONNECTION::SelectOne | ( | const std::string & | aPartID, | 
| HTTP_LIB_PART & | aFetchedPart ) | 
Retrieve a single part with full details from the HTTP library.
| aPk | is the primary key of the part | 
| aResult | will contain the part if one was found | 
Definition at line 222 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_LIB_PART::id, IsValidEndpoint(), HTTP_LIB_PART::lastCached, m_cachedParts, m_lastError, m_source, res, setPartIdNameAndMetadata(), HTTP_LIB_PART::symbolIdStr, and traceHTTPLib.
      
  | 
  private | 
Definition at line 96 of file http_lib_connection.cpp.
References _, checkServerResponse(), createCurlEasyObject(), HTTP_LIB_CATEGORY::description, HTTP_LIB_CATEGORY::id, IsValidEndpoint(), m_categories, m_categoryDescriptions, m_lastError, m_source, HTTP_LIB_CATEGORY::name, res, and traceHTTPLib.
Referenced by validateHttpLibraryEndpoints().
      
  | 
  private | 
Definition at line 48 of file http_lib_connection.cpp.
References _, checkServerResponse(), createCurlEasyObject(), m_endpointValid, m_lastError, m_source, res, syncCategories(), and traceHTTPLib.
Referenced by HTTP_LIB_CONNECTION().
      
  | 
  static | 
Definition at line 35 of file http_lib_connection.h.
      
  | 
  private | 
Definition at line 124 of file http_lib_connection.h.
Referenced by GetCachedParts(), and SelectAll().
      
  | 
  private | 
Definition at line 121 of file http_lib_connection.h.
Referenced by SelectOne().
      
  | 
  private | 
Definition at line 116 of file http_lib_connection.h.
Referenced by getCategories(), and syncCategories().
      
  | 
  private | 
Definition at line 117 of file http_lib_connection.h.
Referenced by getCategoryDescription(), and syncCategories().
      
  | 
  private | 
Definition at line 113 of file http_lib_connection.h.
Referenced by IsValidEndpoint(), and validateHttpLibraryEndpoints().
      
  | 
  private | 
Definition at line 114 of file http_lib_connection.h.
Referenced by checkServerResponse(), GetLastError(), SelectAll(), SelectOne(), syncCategories(), and validateHttpLibraryEndpoints().
      
  | 
  private | 
Definition at line 118 of file http_lib_connection.h.
      
  | 
  private | 
Definition at line 112 of file http_lib_connection.h.
Referenced by createCurlEasyObject(), HTTP_LIB_CONNECTION(), SelectAll(), SelectOne(), syncCategories(), and validateHttpLibraryEndpoints().