contact

package
v9.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 *CreateRequest) (*Contact, error)

func Read

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

Read retrieves the information of an existing contact.

func Update

func Update(c messagebird.Client, id string, contactRequest *CreateRequest) (*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 Contacts

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

func List

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

type CreateRequest

type CreateRequest 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"`
}

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

type ViewRequest

type ViewRequest struct {
	MSISDN string `json:"msisdn,omitempty"`
	Name   string `json:"firstName,omitempty"`
}

Jump to

Keyboard shortcuts

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