MarkLogic Connect
MarkLogic Connect Client API Collection
|
Provides a virtual only interface for a connection. Allows the creation of a FakeConnection subclass, or a real Connection subclass. More...
#include <Connection.hpp>
Public Member Functions | |
MLCLIENT_API | IConnection ()=default |
Creates a Connection instance. More... | |
virtual | ~IConnection ()=default |
connection_configuration Connection configuration functions | |
virtual MLCLIENT_API void | configure (const std::string &hostname, const std::string &port, const std::string &username, const std::string &password, const bool usessl=false)=0 |
virtual MLCLIENT_API bool | connect ()=0 |
Connects or tests the authentication in the connection. May not actually connect. More... | |
virtual MLCLIENT_API void | disconnect ()=0 |
Frees up resources held by the connection, until the next call to connect. More... | |
virtual MLCLIENT_API void | setDatabaseName (const std::string &db)=0 |
Sets the name of the database to query/update. Defaults to Documents. More... | |
virtual MLCLIENT_API std::string | getDatabaseName ()=0 |
Returns the database name we're querying/updating. Defaults to Documents. More... | |
http_raw RAW HTTP commands | |
virtual MLCLIENT_API Response * | doGet (const std::string &pathAndQuerystring)=0 |
Performs a HTTP GET Request against MarkLogic Server. More... | |
virtual MLCLIENT_API Response * | doPut (const std::string &pathAndQuerystring, const IDocumentContent &payload)=0 |
Performs a HTTP PUT Request against MarkLogic Server. More... | |
virtual MLCLIENT_API Response * | doPost (const std::string &pathAndQuerystring, const IDocumentContent &payload)=0 |
Performs a HTTP POST Request against MarkLogic Server. More... | |
virtual MLCLIENT_API Response * | doDelete (const std::string &pathAndQueryString)=0 |
TODO multipart payload. More... | |
wrap_rest Convenience wrapper function calls for common MarkLogic REST API calls. | |
TODO PATCH and other HTTP synonyms | |
virtual MLCLIENT_API Response * | getDocument (const std::string &uri)=0 |
Retrieves a document from the server, at the given document URI (MarkLogic unique document ID) More... | |
virtual MLCLIENT_API Response * | getDocument (Document &inout_document)=0 |
TODO add optional call parameters (E.g. fetch properties also) More... | |
virtual MLCLIENT_API Response * | getDocumentContent (Document &inout_document)=0 |
Populates the content of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | getDocumentProperties (Document &inout_document)=0 |
Populates the properties of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | getDocumentPermissions (Document &inout_document)=0 |
Populates the permissions of the specified document (MUST have a uri). More... | |
virtual MLCLIENT_API Response * | saveDocumentContent (const std::string &uri, const IDocumentContent &payload)=0 |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID) More... | |
virtual MLCLIENT_API Response * | saveDocuments (const DocumentSet &documents, const long startPosInclusive, const long endPosInclusive)=0 |
Saves a set of documents as a single batch to MarkLogic Server. More... | |
virtual MLCLIENT_API Response * | saveDocument (const Document &doc)=0 |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID) More... | |
virtual MLCLIENT_API Response * | deleteDocument (const std::string &uri)=0 |
Deletes the specified document by URI. More... | |
virtual MLCLIENT_API Response * | search (const SearchDescription &desc)=0 |
Performs a search against the MarkLogic database given the provided search query, text and options. More... | |
virtual MLCLIENT_API Response * | searchExtension (const std::string &extensionName, const SearchDescription &desc)=0 |
Performs a search against a REST extension that is compatible with POST /v1/search (i.e. Connection::search) More... | |
virtual MLCLIENT_API Response * | saveSearchOptions (const std::string &optionsName, const IDocumentContent *optionsDoc)=0 |
Saves search options to the server. More... | |
virtual MLCLIENT_API Response * | values (const std::string &valuesName, const std::string &optionsName)=0 |
Performs a values lookup in MarkLogic Server, returning the top values from the lexicon as per the search options configuration used. More... | |
virtual MLCLIENT_API Response * | valuesExtension (const std::string &extensionName, const std::string &valuesName, const std::string &optionsName, const SearchDescription &desc)=0 |
Performs a values against a REST extension that is compatible with POST /v1/search (i.e. Connection::search) More... | |
virtual MLCLIENT_API Response * | listRootCollections ()=0 |
Lists the top level collections. I.e. ones starting without a / or ones starting with a / but not containing a / character. More... | |
virtual MLCLIENT_API Response * | listCollections (const std::string &parentCollection)=0 |
Lists the immediate child collections of the specified parent Collections. More... | |
Provides a virtual only interface for a connection. Allows the creation of a FakeConnection subclass, or a real Connection subclass.
|
default |
Creates a Connection instance.
Defaults connection to admin/admin, localhost, nossl, port 8002, and the Documents database.
|
virtualdefault |
Destroys a Connection instance.
|
pure virtual |
Configures this connection, providing connection override information - host, port, username, password and SSL usage
[in] | hostname | The hostname or IP address of the MarkLogic Server (or load balancer) to connect to |
[in] | port | A String representing the (numerical) port number of the MarkLogic Server (or load balancer) to connect to |
[in] | username | The username of the used to connect to MarkLogic Server as |
[in] | password | The plain text password used to authenticate the user to MarkLogic server with |
[in] | usessl | A bool representation whether to use SSL (i.e. a HTTPS url) or not |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Connects or tests the authentication in the connection. May not actually connect.
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Deletes the specified document by URI.
[in] | uri | The document URI to delete |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Frees up resources held by the connection, until the next call to connect.
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
TODO multipart payload.
Performs a HTTP DELETE Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a HTTP DELETE REST request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire delete request. E.g. /v1/documents?uri=/my/doc.json |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Performs a HTTP GET Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP GET request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire get request. E.g. /v1/search?options=myoptions |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Performs a HTTP POST Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP POST request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire post request. E.g. /v1/search?options=myoptions |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Performs a HTTP PUT Request against MarkLogic Server.
Allows mlclient based applications to call any arbitrary REST endpoint on MarkLogic. Just in case we don't yet provide a specific convenience method to invoke it.
Performs a RESTful HTTP PUT request to an arbitrary URL on MarkLogic Server
[in] | pathAndQueryString | the path and query string for the entire put request. E.g. /v1/search?options=myoptions |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Returns the database name we're querying/updating. Defaults to Documents.
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Retrieves a document from the server, at the given document URI (MarkLogic unique document ID)
Performs a GET /v1/documents?uri HTTP call
[in] | uri | The URI of the document to fetch from MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
TODO add optional call parameters (E.g. fetch properties also)
Retrieves a document from the server, at the given document URI (MarkLogic unique document ID, within the Document object)
Performs a GET /v1/documents?uri HTTP call, fetching all document information.
[in,out] | inout_document | The document to fetch from MarkLogic Server. MUST have a URI. |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection.
|
pure virtual |
Populates the content of the specified document (MUST have a uri).
See getDocument(Document&) for details.
Implemented in mlclient::Connection.
|
pure virtual |
Populates the permissions of the specified document (MUST have a uri).
See getDocument(Document&) for details.
Implemented in mlclient::Connection.
|
pure virtual |
Populates the properties of the specified document (MUST have a uri).
See getDocument(Document&) for details.
Implemented in mlclient::Connection.
|
pure virtual |
Lists the immediate child collections of the specified parent Collections.
Implemented in mlclient::Connection.
|
pure virtual |
Lists the top level collections. I.e. ones starting without a / or ones starting with a / but not containing a / character.
Implemented in mlclient::Connection.
|
pure virtual |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID)
Performs a call to PUT /v1/documents?ext in order to save a Document to MarkLogic Server
[in] | Document | The Document to send to MarkLogic Server. Must have a URI and Content DocumentContent instance. |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection.
|
pure virtual |
Saves a document to MarkLogic (either as new or an update), at the given document URI (MarkLogic unique document ID)
Performs a call to PUT /v1/documents?ext in order to save a Document to MarkLogic Server
[in] | uri | The URI of the document to save to MarkLogic Server |
[in] | payload | The DocumentContent to send to MarkLogic Server |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Saves a set of documents as a single batch to MarkLogic Server.
See DocumentSet and DocumentBatchHelper and DocumentBatchWriter for how to use this call.
documents | The set of documents to upload |
startPosInclusive | The first index of the document in the set to upload |
endPostInclusive | The last index of the document in the set to upload |
Implemented in mlclient::Connection.
|
pure virtual |
Saves search options to the server.
[in] | optionsName | The name of the options on the server |
[in] | optionsDoc | The document containing the options |
Implemented in mlclient::Connection.
|
pure virtual |
Performs a search against the MarkLogic database given the provided search query, text and options.
Uses a SearchDescription value object to wrap complex search parameters for MarkLogic Server.
Performs a POST /v1/search HTTP POST to MarkLogic Server
[in] | desc | The SearchDescription defining the search, options, and query string |
NoCredentialsException | The credentials for the Connection were not accepted by MarkLogic Server, or permission is denied for this request. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Performs a search against a REST extension that is compatible with POST /v1/search (i.e. Connection::search)
See also Connection::valuesExtension for similar functionality for aggregate/values extensions
[in] | extensionName | The REST API extension name (file name without .xqy or .sjs) to invoke |
[in] | desc | The SearchDescription defining the search, options, and query string |
Implemented in mlclient::Connection.
|
pure virtual |
Sets the name of the database to query/update. Defaults to Documents.
[in] | The | string name (not internal MarkLogic numeric ID) of the database to query. |
Implemented in mlclient::Connection, and mlclient::internals::FakeConnection.
|
pure virtual |
Performs a values lookup in MarkLogic Server, returning the top values from the lexicon as per the search options configuration used.
[in] | valuesName | The name of the values Configuration within the search options to use |
[in] | optionsName | The name of the installed search options to specify (no default) |
Implemented in mlclient::Connection.
|
pure virtual |
Performs a values against a REST extension that is compatible with POST /v1/search (i.e. Connection::search)
See also Connection::searchExtension for similar functionality for aggregate/values extensions
Invokes POST /v1/values/VALUESNAME?options=OPTIONSNAME and not GET
[in] | extensionName | The REST API extension name (file name without .xqy or .sjs) to invoke |
[in] | valuesName | The name of the values Configuration within the search options to use |
[in] | optionsName | The name of the installed search options to specify (no default) |
[in] | desc | The SearchDescription defining the search, options, and query string |
Implemented in mlclient::Connection.