From 8f3e7309f2f4308b7e327d282d005a7898fdc37c Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Tue, 6 Oct 2020 23:08:02 -0400 Subject: [PATCH] Add comments to a few exported methods --- basic_client.go | 6 ++++++ discovercard_client.go | 6 ++++++ vanguard_client.go | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/basic_client.go b/basic_client.go index 0c4489a..4abaf21 100644 --- a/basic_client.go +++ b/basic_client.go @@ -61,6 +61,8 @@ func (c *BasicClient) CarriageReturnNewLines() bool { 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) { if !strings.HasPrefix(URL, "https://") { 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 } +// 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) { 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) { return clientRequest(c, r) } diff --git a/discovercard_client.go b/discovercard_client.go index d00ed3c..7eb2cce 100644 --- a/discovercard_client.go +++ b/discovercard_client.go @@ -77,6 +77,8 @@ func discoverCardHTTPPost(URL string, r io.Reader) (*http.Response, error) { 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) { if !strings.HasPrefix(URL, "https://") { 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 } +// 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) { 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) { return clientRequest(c, r) } diff --git a/vanguard_client.go b/vanguard_client.go index 171bc40..a6e5d45 100644 --- a/vanguard_client.go +++ b/vanguard_client.go @@ -47,6 +47,8 @@ func rawRequestCookies(URL string, r io.Reader, cookies []*http.Cookie) (*http.R 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) { r.SetClientFields(c) @@ -74,6 +76,8 @@ func (c *VanguardClient) RequestNoParse(r *Request) (*http.Response, error) { 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) { return clientRequest(c, r) }