clientutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 20 Imported by: 9

Documentation

Index

Constants

View Source
const (
	InstantMessageSMSExample   = "/restapi/v1.0/account/~/extension/12345678/message-store/instant?type=SMS"
	InstantMessageSMSPattern   = `message-store/instant.+type=SMS`
	InstantMessageSMSPatternX  = `message-store/instant`
	GlipPostEventFilterPattern = `/restapi/v1.0/glip/posts`
	SubscriptionRenewalFilter  = `/restapi/v1.0/subscription/.+\?threshold=`
)
View Source
const (
	FaxUrl = "/restapi/v1.0/account/~/extension/~/fax"
)
View Source
const (
	ThisDir = "src/github.com/grokify/go-ringcentral-client/office/v1/client"
)

Variables

View Source
var Events = []string{
	"AccountPresenceEvent",
	"ContactDirectoryEvent",
	"DetailedExtensionPresenceEvent",
	"DetailedExtensionPresenceWithSIPEvent",
	"ExtensionFavoritesEvent",
	"ExtensionFavoritesPresenceEvent",
	"ExtensionGrantListEvent",
	"ExtensionListEvent",
	"ExtensionInfoEvent",
	"ExtensionPresenceEvent",
	"ExtensionPresenceLineEvent",
	"GlipGroupsEvent",
	"GlipPostEvent",
	"GlipUnreadMessageCountEvent",
	"InboundMessageEvent",
	"IncomingCallEvent",
	"InstantMessageEvent",
	"MessageEvent",
	"MissedCallEvent",
	"RCVideoNotificationsEvent",
	"SubscriptionRenewalEvent",
}

Events is an array of event structs for reference.

Functions

func ApiResponseErrorBody

func ApiResponseErrorBody(err error) []byte

func AtMention

func AtMention(personId string) string

func BuildFaxApiUrl

func BuildFaxApiUrl(serverUrl string) string

func FaxCoverPageNameToIndex

func FaxCoverPageNameToIndex(s string) (int, error)

func GetFileBytesForEventType

func GetFileBytesForEventType(eventType string) ([]byte, error)

func GetFileNameForEventType

func GetFileNameForEventType(eventType string) string

func GetFilePathForEventType

func GetFilePathForEventType(eventType string) string

func GlipCreatePostIsEmpty

func GlipCreatePostIsEmpty(post rc.GlipCreatePost) bool

func IsAtMentioned

func IsAtMentioned(userId string, mentions []rc.GlipMentionsInfo) bool

func IsAtMentionedFuzzy

func IsAtMentionedFuzzy(personName, textRaw string) bool

func IsAtMentionedGlipdown

func IsAtMentionedGlipdown(personId, textRaw string) bool

func LoadEnv

func LoadEnv() error

func NewApiClientCredentials

func NewApiClientCredentials(creds credentials.Credentials) (*rc.APIClient, error)

func NewApiClientHttpClientBaseURL

func NewApiClientHttpClientBaseURL(httpClient *http.Client, serverUrl string) (*rc.APIClient, error)

func NewApiClientPassword

func NewApiClientPassword(oc credentials.OAuth2Credentials) (*rc.APIClient, error)

func NewApiClientPasswordEnv

func NewApiClientPasswordEnv(envPrefix string) (*rc.APIClient, error)

func NewApiClientPasswordSimple

func NewApiClientPasswordSimple(oc credentials.OAuth2Credentials) (*rc.APIClient, error)

func NewScimApiClient

func NewScimApiClient(oc credentials.OAuth2Credentials) (*rs.APIClient, error)

func PrefixAtMentionUnlessMentioned

func PrefixAtMentionUnlessMentioned(personId, text string) string

func StripAtMention

func StripAtMention(id, text string) string

func StripAtMentionAll

func StripAtMentionAll(id, personName, text string) string

func StripAtMentionFuzzy

func StripAtMentionFuzzy(personName, text string) string

func UploadUserProfileImage

func UploadUserProfileImage(httpClient *http.Client, serverUrl, accountId, extensionId, imgFilepath string) (*http.Response, error)

Types

type DeliveryMode

type DeliveryMode struct {
	TransportType string
	Encryption    bool
	Address       string
	SubscriberKey string
	SecretKey     string
}

type Event

type Event struct {
	UUID           string           `json:"uuid,omitempty"`
	Event          string           `json:"event,omitempty"`
	Timestamp      time.Time        `json:"timestamp,omitempty"`
	SubscriptionId string           `json:"subscriptionId,omitempty"`
	OwnerId        string           `json:"ownerId,omitempty"`
	Body           EventBodyWrapper `json:"body,omitempty"`
}

Event is a generic event.

func EventParseBytes

func EventParseBytes(data []byte) (*Event, error)

func (*Event) GetGlipPostEventBody

func (evt *Event) GetGlipPostEventBody() (*rc.GlipPostEvent, error)

func (*Event) GetInstantMessageBody

func (evt *Event) GetInstantMessageBody() (*rc.InstantMessageEvent, error)

func (*Event) IsEventType

func (evt *Event) IsEventType(eventType EventType) bool

type EventBody

type EventBody struct {
	ExpiresIn            int       `json:"expiresIn,omitempty"`
	CreationTime         time.Time `json:"creationTime,omitempty"`
	Direction            string    `json:"direction,omitempty"`
	LastModificationTime time.Time `json:"lastModificationTime,omitempty"`
	Subject              string    `json:"subject,omitempty"`
	Type                 string    `json:"type,omitempty"`
}

type EventBodyWrapper

type EventBodyWrapper struct {
	Raw    string      `json:"raw"`
	Parsed interface{} `json:"parsed"`
}

func (*EventBodyWrapper) UnmarshalJSON

func (w *EventBodyWrapper) UnmarshalJSON(data []byte) error

type EventSimple

type EventSimple struct {
	UUID           string    `json:"uuid,omitempty"`
	Event          string    `json:"event,omitempty"`
	Timestamp      time.Time `json:"timestamp,omitempty"`
	SubscriptionId string    `json:"subscriptionId,omitempty"`
	OwnerId        string    `json:"ownerId,omitempty"`
	Body           EventBody `json:"body,omitempty"`
}

EventSimple is a event for Instant SMS for testing purposes

type EventType

type EventType int
const (
	AccountPresenceEvent EventType = iota
	ContactDirectoryEvent
	DetailedExtensionPresenceEvent
	DetailedExtensionPresenceWithSIPEvent
	ExtensionFavoritesEvent
	ExtensionFavoritesPresenceEvent
	ExtensionGrantListEvent
	ExtensionListEvent
	ExtensionInfoEvent
	ExtensionPresenceEvent
	ExtensionPresenceLineEvent
	GlipGroupsEvent
	GlipPostEvent
	GlipUnreadMessageCountEvent
	InboundMessageEvent
	IncomingCallEvent
	InstantMessageEvent
	MessageEvent
	MissedCallEvent
	RCVideoNotificationsEvent
	SubscriptionRenewalEvent
)

func ParseEventTypeForFilter

func ParseEventTypeForFilter(eventFilter string) (EventType, error)
func IsInstantMessageSMS(s string) bool {
	if strings.Index(s, InstantMessageSMSPattern) == -1 {
		return false
	}
	return true
}

func (EventType) String

func (d EventType) String() string

type FaxCoverPage

type FaxCoverPage int
const (
	None         FaxCoverPage = iota // 0
	Ancient                          // 1
	Birthday                         // 2
	Blank                            // 3
	Clasmod                          // 4
	Classic                          // 5
	Confidential                     // 5
	Contempo                         // 7
	Elegant                          // 8
	Express                          // 9
	Formal                           // 10
	Jazzy                            // 11
	Modern                           // 12
	Urgent                           // 13
)

func (FaxCoverPage) String

func (d FaxCoverPage) String() string

String returns the English name of the fax cover page ("None", "Ancient", ...).

type FaxRequest

type FaxRequest struct {
	CoverIndex    int
	CoverPageText string
	Resolution    string
	SendTime      *time.Time
	IsoCode       string
	To            []string
	FilePaths     []string
	FileHeaders   []*multipart.FileHeader
}

FaxRequest is a fax request helper that can send more than one attachment. The core Swagger Codegen appears to only send one file at a time with a fixed MIME part name.

func NewFaxRequest

func NewFaxRequest() FaxRequest

func (*FaxRequest) Post

func (fax *FaxRequest) Post(httpClient *http.Client, url string) (*http.Response, error)

type GlipApiUtil

type GlipApiUtil struct {
	ApiClient *rc.APIClient
}

func (*GlipApiUtil) AtMentionedOrGroupOfTwo

func (apiUtil *GlipApiUtil) AtMentionedOrGroupOfTwo(userId, groupId string, mentions []rc.GlipMentionsInfo) (bool, error)

DirectMessage means a group of 2 or a team of 2

func (*GlipApiUtil) AtMentionedOrGroupOfTwoFuzzy

func (apiUtil *GlipApiUtil) AtMentionedOrGroupOfTwoFuzzy(info GlipInfoAtMentionOrGroupOfTwoInfo) (bool, error)

func (*GlipApiUtil) GlipGroupMemberCount

func (apiUtil *GlipApiUtil) GlipGroupMemberCount(groupId string) (int64, error)

type GlipInfoAtMentionOrGroupOfTwoInfo

type GlipInfoAtMentionOrGroupOfTwoInfo struct {
	PersonId       string
	AtMentions     []rc.GlipMentionsInfo
	PersonName     string
	FuzzyAtMention bool
	TextRaw        string
	GroupId        string
}

type RingOutRequest

type RingOutRequest struct {
	To         string
	From       string
	CallerId   string
	PlayPrompt bool
	CountryId  string
}

func (*RingOutRequest) Body

func (ro *RingOutRequest) Body() *rc.MakeRingOutRequest

type SubscriptionInfo

type SubscriptionInfo struct {
	EventFilters   []string
	SubscriptionId string
	DeliveryMode   DeliveryMode
	CreationTime   time.Time
	ExpirationTime time.Time
	ExpiresIn      int64
	Status         string
	URI            string
}

type SubscriptionManager

type SubscriptionManager struct {
	Client       *rc.APIClient
	EventFilters []string
	// contains filtered or unexported fields
}

func NewSubscriptionManager

func NewSubscriptionManager(apiClient *rc.APIClient) SubscriptionManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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