contact

package
v5.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultListOptions = &ListOptions{
	Limit:  20,
	Offset: 0,
}

DefaultListOptions provides reasonable values for List().

Functions

func Delete

func Delete(c *messagebird.Client, id string) error

Delete attempts deleting the contact with the provided ID. If nil is returned, the resource was deleted successfully.

Types

type Contact

type Contact struct {
	ID            string
	HRef          string
	MSISDN        int64
	FirstName     string
	LastName      string
	CustomDetails struct {
		Custom1 string
		Custom2 string
		Custom3 string
		Custom4 string
	}
	Groups struct {
		TotalCount int
		HRef       string
	}
	Messages struct {
		TotalCount int
		HRef       string
	}
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
}

Contact gets returned by the API.

func Create

func Create(c *messagebird.Client, contactRequest *Request) (*Contact, error)

func Read

func Read(c *messagebird.Client, id string) (*Contact, error)

Read retrieves the information of an existing contact.

func Update

func Update(c *messagebird.Client, id string, contactRequest *Request) (*Contact, error)

Update updates the record referenced by id with any values set in contactRequest. Do not set any values that should not be updated.

type ContactList

type ContactList struct {
	Limit, Offset     int
	Count, TotalCount int
	Items             []Contact
}

func List

func List(c *messagebird.Client, options *ListOptions) (*ContactList, error)

List retrieves a paginated list of contacts, based on the options provided. It's worth noting DefaultListOptions.

type ListOptions

type ListOptions struct {
	Limit, Offset int
}

ListOptions can be used to set pagination options in List().

type Request

type Request struct {
	MSISDN    string `json:"msisdn,omitempty"`
	FirstName string `json:"firstName,omitempty"`
	LastName  string `json:"lastName,omitempty"`
	Custom1   string `json:"custom1,omitempty"`
	Custom2   string `json:"custom2,omitempty"`
	Custom3   string `json:"custom3,omitempty"`
	Custom4   string `json:"custom4,omitempty"`
}

Request represents a contact for write operations, e.g. for creating a new contact or updating an existing one.

Jump to

Keyboard shortcuts

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