yahoo

package
v0.58.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package yahoo implement user's contacts import using Yahoo API.

Reference

- https://developer.yahoo.com/social/rest_api_guide/contacts-resource.html

Index

Constants

View Source
const (
	FieldTypeAddress  = "address"
	FieldTypeBirthday = "birthday"
	FieldTypeCompany  = "company"
	FieldTypeEmail    = "email"
	FieldTypeJobTitle = "jobTitle"
	FieldTypeLink     = "link"
	FieldTypeName     = "name"
	FieldTypePhone    = "phone"
)

List of field type.

Variables

This section is empty.

Functions

func ImportFromJSON

func ImportFromJSON(jsonb []byte) (contacts []*contact.Record, err error)

ImportFromJSON will parse JSON input and return list of Contact on success.

On fail it will return nil and error.

func ImportWithOAuth

func ImportWithOAuth(client *http.Client, guid string) (contacts []*contact.Record, err error)

ImportWithOAuth get Yahoo contacts using OAuth HTTP client.

func ParseJSON

func ParseJSON(jsonb []byte) (to *contact.Record, err error)

ParseJSON will parse JSON input and return contact.Record object on success.

On fail it will return nil and error.

Types

type Category

type Category struct {
	Meta2
	Name string `json:"name"`
	ID   int    `json:"id"`
}

Category define a contact category.

type Contact

type Contact struct {
	Fields []Field `json:"fields"`
}

Contact define the contact item in response.

func (*Contact) Decode

func (c *Contact) Decode() (to *contact.Record)

Decode will convert the interface value in each field into its struct representation.

type Contacts

type Contacts struct {
	URI     string    `json:"uri"`
	Contact []Contact `json:"contact"`
	Start   int       `json:"start"`
	Count   int       `json:"count"`
	Total   int       `json:"total"`
}

Contacts define the holder for root of contacts response.

type Field

type Field struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
	Flags []string    `json:"flags"`
}

Field define a composite attribute in Contact. Known value for Type: "phone", "name", "address".

func (*Field) Decode

func (field *Field) Decode(to *contact.Record)

Decode will convert Yahoo' contact field value and save it to contact Contact format.

type Meta

type Meta struct {
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
	URI     string    `json:"uri"`
}

Meta define a common metadata inside a struct.

type Meta2

type Meta2 struct {
	Created string `json:"created"`
	Updated string `json:"updated"`
	URI     string `json:"uri"`
}

Meta2 define a common metadata inside a struct.

type Root

type Root struct {
	Contacts Contacts `json:"contacts"`
}

Root define the root of JSON response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL