1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-21 19:20:05 -05:00

Add comments to a few exported methods

This commit is contained in:
Aaron Lindsay 2020-10-06 23:08:02 -04:00
parent 631508ccc9
commit 8f3e7309f2
3 changed files with 16 additions and 0 deletions

View File

@ -61,6 +61,8 @@ func (c *BasicClient) CarriageReturnNewLines() bool {
return c.CarriageReturn return c.CarriageReturn
} }
// RawRequest is a convenience wrapper around http.Post. It is exposed only for
// when you need to read/inspect the raw HTTP response yourself.
func (c *BasicClient) RawRequest(URL string, r io.Reader) (*http.Response, error) { func (c *BasicClient) RawRequest(URL string, r io.Reader) (*http.Response, error) {
if !strings.HasPrefix(URL, "https://") { if !strings.HasPrefix(URL, "https://") {
return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol") return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol")
@ -78,10 +80,14 @@ func (c *BasicClient) RawRequest(URL string, r io.Reader) (*http.Response, error
return response, nil return response, nil
} }
// RequestNoParse marshals a Request to XML, makes an HTTP request, and returns
// the raw HTTP response
func (c *BasicClient) RequestNoParse(r *Request) (*http.Response, error) { func (c *BasicClient) RequestNoParse(r *Request) (*http.Response, error) {
return clientRequestNoParse(c, r) return clientRequestNoParse(c, r)
} }
// Request marshals a Request to XML, makes an HTTP request, and then
// unmarshals the response into a Response object.
func (c *BasicClient) Request(r *Request) (*Response, error) { func (c *BasicClient) Request(r *Request) (*Response, error) {
return clientRequest(c, r) return clientRequest(c, r)
} }

View File

@ -77,6 +77,8 @@ func discoverCardHTTPPost(URL string, r io.Reader) (*http.Response, error) {
return http.ReadResponse(bufio.NewReader(conn), nil) return http.ReadResponse(bufio.NewReader(conn), nil)
} }
// RawRequest is a convenience wrapper around http.Post. It is exposed only for
// when you need to read/inspect the raw HTTP response yourself.
func (c *DiscoverCardClient) RawRequest(URL string, r io.Reader) (*http.Response, error) { func (c *DiscoverCardClient) RawRequest(URL string, r io.Reader) (*http.Response, error) {
if !strings.HasPrefix(URL, "https://") { if !strings.HasPrefix(URL, "https://") {
return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol") return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol")
@ -94,10 +96,14 @@ func (c *DiscoverCardClient) RawRequest(URL string, r io.Reader) (*http.Response
return response, nil return response, nil
} }
// RequestNoParse marshals a Request to XML, makes an HTTP request, and returns
// the raw HTTP response
func (c *DiscoverCardClient) RequestNoParse(r *Request) (*http.Response, error) { func (c *DiscoverCardClient) RequestNoParse(r *Request) (*http.Response, error) {
return clientRequestNoParse(c, r) return clientRequestNoParse(c, r)
} }
// Request marshals a Request to XML, makes an HTTP request, and then
// unmarshals the response into a Response object.
func (c *DiscoverCardClient) Request(r *Request) (*Response, error) { func (c *DiscoverCardClient) Request(r *Request) (*Response, error) {
return clientRequest(c, r) return clientRequest(c, r)
} }

View File

@ -47,6 +47,8 @@ func rawRequestCookies(URL string, r io.Reader, cookies []*http.Cookie) (*http.R
return response, nil return response, nil
} }
// RequestNoParse marshals a Request to XML, makes an HTTP request, and returns
// the raw HTTP response
func (c *VanguardClient) RequestNoParse(r *Request) (*http.Response, error) { func (c *VanguardClient) RequestNoParse(r *Request) (*http.Response, error) {
r.SetClientFields(c) r.SetClientFields(c)
@ -74,6 +76,8 @@ func (c *VanguardClient) RequestNoParse(r *Request) (*http.Response, error) {
return response, err return response, err
} }
// Request marshals a Request to XML, makes an HTTP request, and then
// unmarshals the response into a Response object.
func (c *VanguardClient) Request(r *Request) (*Response, error) { func (c *VanguardClient) Request(r *Request) (*Response, error) {
return clientRequest(c, r) return clientRequest(c, r)
} }