Created
March 31, 2019 19:57
-
-
Save deankarn/07a0891df857ffa9b8173ad9324cfce8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mylib | |
import "net/http" | |
// New create a new Instance of mylib | |
func New(someAlwaysRequiredValue string) (*Instance, error) { | |
return &Instance{ | |
client: new(http.Client), // default no auth client | |
}, nil | |
} | |
type Instance struct { | |
client *http.Client | |
} | |
// BasicAuth sets the username and password for requests. | |
func (i *Instance) BasicAuth(username, password string) error { | |
// create an http client where the basic credentials | |
// are injected automatically into requests. | |
client,err := //... | |
if err != nil { | |
return err | |
} | |
i.client = client | |
return nil | |
} | |
// OAuth ... | |
func (i *Instance) OAuth(id, secret string) error{ | |
// .... | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment