Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/rossmerr/couchdb-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/rossmerr/couchdb-go

  • v0.0.0-20230323192939-813b0b1dafec
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go API client for couchdb_go

Note This is not a definitive implementation of the CouchDB API, it's missing a lot of the endpoints for server/database managment and everything for attachments all COPY operations and probably a few other parts.

It also targets golang, as such the '#/definitions/Document' is intentionally left empty to generate a go interface, which you can then cast to a map[string]interface{}.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 4.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import couchdb_go "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), couchdb_go.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), couchdb_go.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), couchdb_go.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), couchdb_go.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://virtserver.swaggerhub.com/RossMerr/CouchDB/4.0.0

ClassMethodHTTP requestDescription
DatabaseApiBulkDocsPost /{db}/_bulk_docsThe bulk document API allows you to create and update multiple documents at the same time within a single request.
DatabaseApiBulkGetPost /{db}/_bulk_getThis method can be called to query several documents in bulk.
DatabaseApiDbSecurityGetGet /{db}/_securityReturns the current security object from the specified database.
DatabaseApiDeleteDelete /{db}Deletes the specified database, and all the documents and attachments contained within it.
DatabaseApiDesignDocAllGetGet /{db}/_design_docsReturns a JSON structure of all of the design documents in a given database.
DatabaseApiDesignDocAllPostPost /{db}/_design_docsPOST _design_docs functionality supports identical parameters and behavior as specified in the GET /{db}/_design_docs
DatabaseApiDocGetAllGet /{db}/_all_docsExecutes the built-in _all_docs view
DatabaseApiDocPostAllPost /{db}/_all_docsExecutes the built-in _all_docs view
DatabaseApiExistsHead /{db}Returns the HTTP Headers containing a minimal amount of information about the specified database.
DatabaseApiGetGet /{db}Gets information about the specified database.
DatabaseApiPutPut /{db}Creates a new database.
DatabaseApiSbSecurityPutPut /{db}/_securitySets the security object for the given database.
DesignDocumentsApiDesignDocDeleteDelete /{db}/_design/{ddoc}Deletes the specified document from the database. You must supply the current (latest) revision, either by using the rev parameter to specify the revision.
DesignDocumentsApiDesignDocExistsHead /{db}/_design/{ddoc}Returns the HTTP Headers containing a minimal amount of information about the specified design document.
DesignDocumentsApiDesignDocGetGet /{db}/_design/{ddoc}Returns the contents of the design document specified with the name of the design document and from the specified database from the URL.
DesignDocumentsApiDesignDocInfoHead /{db}/_design/{ddoc}/_infoObtains information about the specified design document, including the index, index size and current status of the design document and associated index information.
DesignDocumentsApiDesignDocPutPut /{db}/_design/{ddoc}The PUT method creates a new named design document, or creates a new revision of the existing design document.
DesignDocumentsApiDesignDocSearchGet /{db}/_design/{ddoc}/_search/{index}Executes a search request against the named index in the specified design document.
DesignDocumentsApiDesignDocSearchInfoGet /{db}/_design/{ddoc}/_search_info/{index}Executes a search request against the named index in the specified design document.
DesignDocumentsApiDesignDocViewGet /{db}/_design/{ddoc}/_view/{view}Executes the specified view function from the specified design document.
DesignDocumentsApiDesignDocViewPostPost /{db}/_design/{ddoc}/_view/{view}Executes the specified view function from the specified design document.
DocumentApiDocDeleteDelete /{db}/{docid}Marks the specified document as deleted by adding a field _deleted with the value true.
DocumentApiDocGetGet /{db}/{docid}Returns document by the specified docid from the specified db. Unless you request a specific revision, the latest revision of the document will always be returned.
DocumentApiDocInfoHead /{db}/{docid}Returns the HTTP Headers containing a minimal amount of information about the specified document.
DocumentApiDocPutPut /{db}/{docid}The PUT method creates a new named document, or creates a new revision of the existing document. Unlike the POST /{db}, you must specify the document ID in the request URL.
DocumentApiPostPost /{db}Creates a new document in the specified database, using the supplied JSON document structure.
IndexApiDbFindPostPost /{db}/_findFinds the document.
IndexApiDbIndexGetGet /{db}/_indexReturns the current indexes object from the specified database.
IndexApiDbPartitionFindPostPost /{db}/_partition/{partition}/_findFinds the document.
IndexApiIndexDeleteDelete /{db}/_index/{designdoc}/json/{name}
IndexApiSbIndexPostPost /{db}/_indexSets the index for the given database.
PartitionApiPartitionDesignDocSearchGet /{db}/_partition/{partition}/_design/{ddoc}/_search/{index}Executes a search request against the named index in the specified design document.
PartitionApiPartitionDesignDocViewGet /{db}/_partition/{partition}/_design/{ddoc}/_view/{view}Executes the specified view function from the specified design document.
PartitionApiPartitionDesignDocViewPostPost /{db}/_partition/{partition}/_design/{ddoc}/_view/{view}Executes the specified view function from the specified design document.
PartitionApiPartitionDocGetAllGet /{db}/_partition/{partition}/_all_docsExecutes the built-in _all_docs view
PartitionApiPartitionInfoGet /{db}/_partition/{partition}This endpoint returns information describing the provided partition. It includes document and deleted document counts along with external and active data sizes.
ServerApiActiveTasksGet /_active_tasksList of running tasks, including the task type, name, status and process ID.
ServerApiAllDBsGet /_all_dbsReturns a list of all the databases in the CouchDB instance.
ServerApiClusterSetupGetGet /_cluster_setupReturns the status of the node or cluster, per the cluster setup wizard.
ServerApiClusterSetupPostPost /_cluster_setupConfigure a node as a single (standalone) node, as part of a cluster, or finalise a cluster.
ServerApiDBsInfoPost /_dbs_infoReturns information of a list of the specified databases in the CouchDB instance.
ServerApiMembershipGet /_membershipDisplays the nodes that are part of the cluster as cluster_nodes.
ServerApiMetaInformationGet /Accessing the root of a CouchDB instance returns meta information about the instance.
ServerApiReplicationPost /_replicateRequest, configure, or stop, a replication operation.
ServerApiSearchAnalyzePost /_search_analyzeTests the results of Lucene analyzer tokenization on sample text.
ServerApiUpGet /_upConfirms that the server is up, running, and ready to respond to requests.

Documentation For Models

Documentation For Authorization

BasicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

JwtAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

FAQs

Package last updated on 23 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc