Cppinecone
A C++ client for the Pinecone vector database
pinecone::net::url_builder Struct Reference

Constructs Pinecone API URLs. More...

#include <url_builder.hpp>

Public Member Functions

 url_builder (std::string environment) noexcept
 Construct a new url builder object. More...
 
auto set_metadata (types::api_metadata metadata) noexcept
 Set the API metadata. More...
 
auto prefix () const noexcept -> std::string_view
 
template<domain::operation_type op>
auto build () const noexcept -> std::string
 Constructs a URL for a specific operation_type. More...
 
template<domain::operation_type op>
auto build (std::string_view index_name) const noexcept -> std::string
 Constructs a URL for a specific operation_type requiring an index name. More...
 

Detailed Description

Constructs Pinecone API URLs.

Definition at line 20 of file url_builder.hpp.

Constructor & Destructor Documentation

◆ url_builder()

pinecone::net::url_builder::url_builder ( std::string  environment)
inlineexplicitnoexcept

Construct a new url builder object.

Parameters
environmentthe cloud environment for the URLs

Definition at line 27 of file url_builder.hpp.

Member Function Documentation

◆ build() [1/2]

template<domain::operation_type op>
auto pinecone::net::url_builder::build ( ) const -> std::string
inlinenoexcept

Constructs a URL for a specific operation_type.

Template Parameters
opthe operation
Returns
the URL

Definition at line 57 of file url_builder.hpp.

◆ build() [2/2]

template<domain::operation_type op>
auto pinecone::net::url_builder::build ( std::string_view  index_name) const -> std::string
inlinenoexcept

Constructs a URL for a specific operation_type requiring an index name.

Template Parameters
opthe operation
Parameters
index_namethe index name
Returns
the URL

Definition at line 72 of file url_builder.hpp.

◆ prefix()

auto pinecone::net::url_builder::prefix ( ) const -> std::string_view
inlinenoexcept
Returns
the prefix for all API operations

Definition at line 48 of file url_builder.hpp.

◆ set_metadata()

auto pinecone::net::url_builder::set_metadata ( types::api_metadata  metadata)
inlinenoexcept

Set the API metadata.

This function is required due to the construction of the Pinecone API. Some API URLs require information that can only be obtained by making an initial API call; thus, Cppinecone makes this request for the user when a new connection is created, then uses the response to populate the requisite metadata for subsequent operations.

Parameters
metadatathe metadata returned by the Pinecone API server

Definition at line 43 of file url_builder.hpp.

Referenced by pinecone::pinecone_client< Mode >::build().


The documentation for this struct was generated from the following file: