package google
import "git.sr.ht/~shulhan/pakakeh.go/lib/contact/google"
Package google implement Google's contact API v3.
Index ¶
- func ImportFromJSON(jsonb []byte) (contacts []*contact.Record, err error)
- func ImportWithOAuth(client *http.Client) (contacts []*contact.Record, err error)
- func ParseRel(in string) string
- type Address
- type Author
- type Birthday
- type Category
- type Contact
- type Email
- type Event
- type EventTime
- type Feed
- type GD
- type Generator
- type Link
- type Name
- type Org
- type Phone
- type Root
Functions ¶
func ImportFromJSON ¶
ImportFromJSON will parse JSON input and return Contacts object on success.
On fail it will return nil and error.
func ImportWithOAuth ¶
ImportWithOAuth get Google contact API using OAuth HTTP client.
func ParseRel ¶
ParseRel will parse Google "rel" value and return the type.
Types ¶
type Address ¶
type Address struct { Rel string `json:"rel,omitempty"` Full GD `json:"gd$formattedAddress,omitempty"` POBox GD `json:"gd$pobox,omitempty"` Street GD `json:"gd$street,omitempty"` City GD `json:"gd$city,omitempty"` StateOrProv GD `json:"gd$region,omitempty"` PostalCode GD `json:"gd$postcode,omitempty"` Country GD `json:"gd$country,omitempty"` }
Address format.
type Author ¶
Author define Google contacts author.
type Birthday ¶
type Birthday struct { When string `json:"when,omitempty"` }
Birthday format.
type Category ¶
type Category struct { Scheme string `json:"scheme,omitempty"` Term string `json:"term,omitempty"` }
Category format.
type Contact ¶
type Contact struct { Name Name `json:"gd$name,omitempty"` Birthday Birthday `json:"gContact$birthday,omitempty"` Orgs []Org `json:"gd$organization,omitempty"` Emails []Email `json:"gd$email,omitempty"` Phones []Phone `json:"gd$phoneNumber,omitempty"` Addresses []Address `json:"gd$structuredPostalAddress,omitempty"` Events []Event `json:"gContact$event,omitempty"` Websites []Link `json:"gContact$website,omitempty"` }
Contact define a single Google contact data.
Some of the fields are disabled for speed.
func (*Contact) Decode ¶
Decode will convert Google's Contact to our Contact format.
type Email ¶
type Email struct { Rel string `json:"rel,omitempty"` Address string `json:"address,omitempty"` Primary string `json:"primary,omitempty"` }
Email format.
type Event ¶
Event format.
type EventTime ¶
type EventTime struct { Start string `json:"startTime,omitempty"` }
EventTime format.
type Feed ¶
type Feed struct { TotalResult GD `json:"openSearch$totalResults,omitempty"` Contacts []Contact `json:"entry,omitempty"` }
Feed define content of Google contacts feed metadata.
Some of the fields are disabled for speed.
type GD ¶
type GD struct { Value string `json:"$t,omitempty"` }
GD is Google Data.
type Generator ¶
type Generator struct { Version string `json:"version,omitempty"` URI string `json:"uri,omitempty"` Value string `json:"$t,omitempty"` }
Generator define Google contact generator.
type Link ¶
type Link struct { Rel string `json:"rel,omitempty"` Type string `json:"type,omitempty"` HRef string `json:"href,omitempty"` }
Link define Google contact link type.
type Name ¶
type Name struct { Prefix GD `json:"gd$namePrefix,omitempty"` First GD `json:"gd$givenName,omitempty"` Middle GD `json:"gd$additionalName,omitempty"` Last GD `json:"gd$familyName,omitempty"` Suffix GD `json:"gd$nameSuffix,omitempty"` Full GD `json:"gd$fullName,omitempty"` }
Name define Google contact name format.
type Org ¶
type Org struct { Type string `json:"rel,omitempty"` Name GD `json:"gd$orgName,omitempty"` JobTitle GD `json:"gd$orgTitle,omitempty"` }
Org as organisation.
type Phone ¶
Phone format.
type Root ¶
type Root struct { Version string `json:"version,omitempty"` Encoding string `json:"encoding,omitempty"` Feed Feed `json:"feed,omitempty"` }
Root define the root of Google's contact in JSON.
Source Files ¶
address.go author.go birthday.go category.go contact.go email.go event.go eventtime.go feed.go gd.go generator.go google.go link.go name.go org.go phone.go root.go util.go
- Version
- v0.60.0 (latest)
- Published
- Feb 1, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 9 hours ago –
Tools for package owners.