Documentation ¶
Overview ¶
Package digits provides a Client for the Digits API.
The digits package provides a Client for accessing Digits API services. Here is an example request for a Digit user's Account.
import ( "github.com/dghubble/go-digits/digits" "github.com/dghubble/oauth1" ) config := oauth1.NewConfig("consumerKey", "consumerSecret") token := oauth1.NewToken("accessToken", "accessTokenSecret") // OAuth1 http.Client will automatically authorize Requests httpClient := config.Client(token) // Digits client client := digits.NewClient(httpClient) // get current user's Digits Account account, resp, err := client.Accounts.Account()
The API client accepts any http.Client capable of signing OAuth1 requests to handle authorization.
See the OAuth1 package https://github.com/dghubble/oauth1 for authorization details and examples.
To implement Login with Digits, see https://github.com/dghubble/gologin.
Index ¶
Constants ¶
const (
DigitsAPI = "https://api.digits.com"
)
DigitsAPI and version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Errors []ErrorDetail `json:"errors"`
}
APIError represents a Digits API Error response
type AccessToken ¶
AccessToken is a Digits OAuth1 access token and secret.
type Account ¶
type Account struct { AccessToken AccessToken `json:"access_token"` CreatedAt string `json:"created_at"` Email Email `json:"email_address"` ID int64 `json:"id"` IDStr string `json:"id_str"` PhoneNumber string `json:"phone_number"` VerificationType string `json:"verification_type"` }
Account is a Digits user account.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService provides methods for accessing Digits Accounts.
func NewAccountService ¶
func NewAccountService(sling *sling.Sling) *AccountService
NewAccountService returns a new AccountService.
type Client ¶
type Client struct { // Digits API Services Accounts *AccountService Contacts *ContactService // contains filtered or unexported fields }
Client is a Digits client for making Digits API requests.
type ContactService ¶
type ContactService struct {
// contains filtered or unexported fields
}
ContactService provides methods for accessing Digits contacts.
func NewContactService ¶
func NewContactService(sling *sling.Sling) *ContactService
NewContactService returns a new ContactService.
func (*ContactService) Matches ¶
func (s *ContactService) Matches(params *MatchesParams) (*Contacts, *http.Response, error)
Matches returns Contacts with the cursored Digits Accounts which have logged into the Digits application and are known to the authenticated user Account via address book uploads.
type Contacts ¶
type Contacts struct { NextCursor string `json:"next_cursor"` // matched contacts are partially hydrated Accounts (i.e. no token, phone) Users []Account `json:"users"` }
Contacts represents a cursored subset of a set of contacts.
type ErrorDetail ¶
ErrorDetail represents an individual error in an APIError.
type MatchesParams ¶
type MatchesParams struct { NextCursor string `url:"next_cursor,omitempty"` Count int `url:"count,omitempty"` }
MatchesParams are the parameters for ContactService.Matches