group

package
v0.0.0-...-421306c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContacts

func AddContacts(c messagebird.Client, groupID string, contactIDs []string) error

AddContacts adds a maximum of 50 contacts to the group.

func Delete

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

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

func ListContacts

func ListContacts(c messagebird.Client, groupID string, options *messagebird.PaginationRequest) (*contact.Contacts, error)

ListContacts lists the contacts that are a member of a group.

func RemoveContact

func RemoveContact(c messagebird.Client, groupID, contactID string) error

RemoveContact removes the contact from a group. If nil is returned, the operation was successful.

func Update

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

Update overrides the group with any values provided in request.

Types

type Group

type Group struct {
	ID       string
	HRef     string
	Name     string
	Contacts struct {
		TotalCount int
		HRef       string
	}
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
}

Group gets returned by the API.

func Create

func Create(c messagebird.Client, request *Request) (*Group, error)

func Read

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

Read retrieves the information of an existing group.

type Groups

type Groups struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Links      struct {
		First    string
		Previous string
		Next     string
		Last     string
	}
	Items []Group
}

func List

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

type Request

type Request struct {
	Name string `json:"name"`
}

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

Jump to

Keyboard shortcuts

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