Documentation ¶
Overview ¶
Package ncbi provides support for interaction with the NCBI services, Entrez and Blast.
Please check the relevant usage policy when using these services. Note that the Blast and Entrez server requests are subject to frequency limits.
Required parameters are specified by name in the function call.
The following two parameters should be included in all requests.
tool Name of application making the call. Its value must be a string with no internal spaces. email E-mail address of the user. Its value must be a string with no internal spaces, and should be a valid e-mail address.
Index ¶
- Variables
- type Limiter
- type Util
- func (ut Util) Get(v url.Values, tool, email string, l *Limiter) (io.ReadCloser, error)
- func (ut Util) GetResponse(v url.Values, tool, email string, l *Limiter) (*http.Response, error)
- func (ut Util) GetXML(v url.Values, tool, email string, l *Limiter, d interface{}) error
- func (ut Util) NewRequest(method, db string, v url.Values, tool, email string, l *Limiter) (*http.Request, error)
- func (ut Util) Prepare(v url.Values, tool, email string) (*url.URL, error)
Constants ¶
This section is empty.
Variables ¶
var GetMethodLimit = 2048
GetMethodLimit is the maximum length of a constructed URL that will be retrieved by the high level API functions using the GET method.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter implements a thread-safe event frequency limit.
func NewLimiter ¶
NewLimiter returns a Limiter that will wait for the specified duration between Wait calls.
type Util ¶
type Util string
Util implements low level request generator for interaction with the NCBI services. It is the clients responsibility to provide appropriate program parameters and deserialise the returned data using the appropriate unmarshaling method.
func (Util) Get ¶
Get performs a GET or POST method call to the URI in ut, passing the parameters in v, tool and email. The decision on which method to use is based on the length of the constructed URL the value of GetMethodLimit. An io.ReadCloser is returned for a successful request. It is the caller's responsibility to close this.
func (Util) GetResponse ¶
GetResponse performs a GET or POST method call to the URI in ut, passing the parameters in v, tool and email. The decision on which method to use is based on the length of the constructed URL the value of GetMethodLimit. An http.Response is returned for a successful request. It is the caller's responsibility to close the response body.
func (Util) GetXML ¶
GetXML performs a GET or POST method call to the URI in ut, passing the parameters in v, tool and email. The returned stream is unmarshaled into d. The decision on which method to use is based on the length of the constructed URL the value of GetMethodLimit.
func (Util) NewRequest ¶
func (ut Util) NewRequest(method, db string, v url.Values, tool, email string, l *Limiter) (*http.Request, error)
NewRequest returns an http.Request for the utility, ut using the given method. Parameters to be sent to the utility program should be places in db, v, tool and email. NewRequest is subject to a limit that prevents requests being sent more frequently than allowed by l. The limit is easy to circumvent, though circumvention may result in IP blocking by the NCBI servers, so please do not do this.