Documentation
¶
Index ¶
- type Address
- type Client
- func (c *Client) GetContact(resourceName string) (*people.Person, error)
- func (c *Client) ListContactGroups(pageToken string, pageSize int64) (*people.ListContactGroupsResponse, error)
- func (c *Client) ListContacts(pageToken string, pageSize int64) (*people.ListConnectionsResponse, error)
- func (c *Client) SearchContacts(query string, pageSize int64) (*people.SearchResponse, error)
- type Contact
- type ContactGroup
- type ContactsClientInterface
- type Email
- type Name
- type Organization
- type Phone
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
FormattedValue string `json:"formattedValue,omitempty"`
Type string `json:"type,omitempty"`
City string `json:"city,omitempty"`
Region string `json:"region,omitempty"`
PostalCode string `json:"postalCode,omitempty"`
Country string `json:"country,omitempty"`
}
Address represents a physical address
type Client ¶
Client wraps the Google People API service for contacts
func (*Client) GetContact ¶
GetContact retrieves a specific contact by resource name
func (*Client) ListContactGroups ¶
func (c *Client) ListContactGroups(pageToken string, pageSize int64) (*people.ListContactGroupsResponse, error)
ListContactGroups retrieves all contact groups
func (*Client) ListContacts ¶
func (c *Client) ListContacts(pageToken string, pageSize int64) (*people.ListConnectionsResponse, error)
ListContacts retrieves contacts from the user's account
func (*Client) SearchContacts ¶
SearchContacts searches for contacts matching a query
type Contact ¶
type Contact struct {
ResourceName string `json:"resourceName"`
DisplayName string `json:"displayName,omitempty"`
Names []Name `json:"names,omitempty"`
Emails []Email `json:"emails,omitempty"`
Phones []Phone `json:"phones,omitempty"`
Organizations []Organization `json:"organizations,omitempty"`
Addresses []Address `json:"addresses,omitempty"`
URLs []URL `json:"urls,omitempty"`
Biography string `json:"biography,omitempty"`
Birthday string `json:"birthday,omitempty"`
PhotoURL string `json:"photoUrl,omitempty"`
}
Contact represents a simplified contact for output
func ParseContact ¶
ParseContact converts a People API Person to our Contact type
func (*Contact) GetDisplayName ¶
GetDisplayName returns the best display name for a contact
func (*Contact) GetOrganization ¶
GetOrganization returns the first organization name
func (*Contact) GetPrimaryEmail ¶
GetPrimaryEmail returns the primary email or first email
func (*Contact) GetPrimaryPhone ¶
GetPrimaryPhone returns the first phone number
type ContactGroup ¶
type ContactGroup struct {
ResourceName string `json:"resourceName"`
Name string `json:"name"`
GroupType string `json:"groupType,omitempty"`
MemberCount int64 `json:"memberCount"`
}
ContactGroup represents a contact group/label
func ParseContactGroup ¶
func ParseContactGroup(g *people.ContactGroup) *ContactGroup
ParseContactGroup converts a People API ContactGroup to our ContactGroup type
type ContactsClientInterface ¶ added in v1.0.19
type ContactsClientInterface interface {
// ListContacts retrieves contacts from the user's account
ListContacts(pageToken string, pageSize int64) (*people.ListConnectionsResponse, error)
// SearchContacts searches for contacts matching a query
SearchContacts(query string, pageSize int64) (*people.SearchResponse, error)
// GetContact retrieves a specific contact by resource name
GetContact(resourceName string) (*people.Person, error)
// ListContactGroups retrieves all contact groups
ListContactGroups(pageToken string, pageSize int64) (*people.ListContactGroupsResponse, error)
}
ContactsClientInterface defines the interface for Contacts client operations. This enables unit testing through mock implementations.
type Email ¶
type Email struct {
Value string `json:"value"`
Type string `json:"type,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Primary bool `json:"primary,omitempty"`
}
Email represents an email address
type Name ¶
type Name struct {
DisplayName string `json:"displayName,omitempty"`
GivenName string `json:"givenName,omitempty"`
FamilyName string `json:"familyName,omitempty"`
MiddleName string `json:"middleName,omitempty"`
HonorificPrefix string `json:"honorificPrefix,omitempty"`
HonorificSuffix string `json:"honorificSuffix,omitempty"`
PhoneticFullName string `json:"phoneticFullName,omitempty"`
}
Name represents a contact name
type Organization ¶
type Organization struct {
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Department string `json:"department,omitempty"`
Type string `json:"type,omitempty"`
}
Organization represents a company/organization