api

package module
v0.0.0-...-524240a Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTagConfirmedEventUpdate string = "CONFIRMED_EVENT_UPDATE"
	MessageTagPostPurchaseUpdate   string = "POST_PURCHASE_UPDATE"
	MessageTagAccountUpdate        string = "ACCOUNT_UPDATE"
	MessageTagHumanAgent           string = "HUMAN_AGENT"
	MessageTagCustomerFeedback     string = "CUSTOMER_FEEDBACK"
)

Variables

This section is empty.

Functions

func DoBoolPostRequest

func DoBoolPostRequest(sling *sling.Sling, path string, requestParams interface{}) (bool, *http.Response, error)

func MatchFirstError

func MatchFirstError(httpError error, errorResponse *ErrorResponse) error

Types

type AddSubscriberTagByNameRequest

type AddSubscriberTagByNameRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	TagName      string `json:"tag_name"`
}

type AddSubscriberTagRequest

type AddSubscriberTagRequest struct {
	SubscriberId int64 `json:"subscriber_id"`
	TagId        int64 `json:"tag_id"`
}

type BoolSuccessResponse

type BoolSuccessResponse struct {
	Status string `json:"status"`
}

type BotField

type BotField struct {
	Id          int64        `json:"id"`
	Name        string       `json:"name"`
	Type        BotFieldType `json:"type"`
	Description string       `json:"description"`
	Value       interface{}  `json:"value"`
}

type BotFieldService

type BotFieldService struct {
	// contains filtered or unexported fields
}

func (*BotFieldService) CreateBotField

func (s *BotFieldService) CreateBotField(request CreateBotFieldRequest) (*BotField, *http.Response, error)

func (*BotFieldService) GetBotFields

func (s *BotFieldService) GetBotFields() (*[]BotField, *http.Response, error)

func (*BotFieldService) SetBotField

func (s *BotFieldService) SetBotField(request SetBotFieldRequest) (bool, *http.Response, error)

func (*BotFieldService) SetBotFieldByName

func (s *BotFieldService) SetBotFieldByName(request SetBotFieldByNameRequest) (bool, *http.Response, error)

func (*BotFieldService) SetBotFields

func (s *BotFieldService) SetBotFields(request SetBotFieldsRequest) (bool, *http.Response, error)

func (*BotFieldService) SetCustomFields

func (s *BotFieldService) SetCustomFields(request SetCustomFieldsRequest) (bool, *http.Response, error)

type BotFieldType

type BotFieldType DataType

type CreateBotFieldRequest

type CreateBotFieldRequest struct {
	Name        string      `json:"name"`
	Type        DataType    `json:"type"`
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
}

type CreateSubscriberRequest

type CreateSubscriberRequest struct {
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Phone         string `json:"phone"`
	WhatsAppPhone string `json:"whatsapp_phone,omitempty"`
	Email         string `json:"email"`
	Gender        string `json:"gender"`
	HasOptInSMS   bool   `json:"has_opt_in_sms"`
	HasOptInEmail bool   `json:"has_opt_in_email"`
	ConsentPhrase string `json:"consent_phrase"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Name string `json:"name,omitempty"`
}

type CustomField

type CustomField struct {
	Id          int64    `json:"id"`
	Name        string   `json:"name"`
	Type        DataType `json:"type"`
	Description string   `json:"description"`
}

type CustomFieldService

type CustomFieldService struct {
	// contains filtered or unexported fields
}

func (*CustomFieldService) CreateCustomField

func (s *CustomFieldService) CreateCustomField(request СreateCustomFieldRequest) (*CustomField, *http.Response, error)

func (*CustomFieldService) GetCustomFields

func (s *CustomFieldService) GetCustomFields() (*[]CustomField, *http.Response, error)

type DataType

type DataType string
const (
	BotFieldTypeUndefined DataType = DataTypeUndefined
	BotFieldTypeText      DataType = DataTypeText
	BotFieldTypeNumber    DataType = DataTypeNumber
	BotFieldTypeDate      DataType = DataTypeDate
	BotFieldTypeDateTime  DataType = DataTypeDateTime
	BotFieldTypeBoolean   DataType = DataTypeBoolean
)
const (
	CustomFieldTypeUndefined DataType = DataTypeUndefined
	CustomFieldTypeText      DataType = DataTypeText
	CustomFieldTypeNumber    DataType = DataTypeNumber
	CustomFieldTypeDate      DataType = DataTypeDate
	CustomFieldTypeDateTime  DataType = DataTypeDateTime
	CustomFieldTypeBoolean   DataType = DataTypeBoolean
)
const (
	DataTypeUndefined DataType = ""
	DataTypeText      DataType = "text"
	DataTypeNumber    DataType = "number"
	DataTypeDate      DataType = "date"
	DataTypeDateTime  DataType = "datetime"
	DataTypeBoolean   DataType = "boolean"
)

type ErrorResponse

type ErrorResponse struct {
	Status    string      `json:"status"`
	Message   string      `json:"message"`
	Details   interface{} `json:"details,omitempty"`
	ErrorCode int         `json:"error_code,omitempty"`
}

type FindSubscriberByCustomFieldRequest

type FindSubscriberByCustomFieldRequest struct {
	FieldId    int64       `url:"field_id"`
	FieldValue interface{} `url:"field_value"`
}

type FindSubscriberByEmailRequest

type FindSubscriberByEmailRequest struct {
	Email string `url:"email"`
}

type FindSubscriberByNameRequest

type FindSubscriberByNameRequest struct {
	Name string `url:"name"`
}

type FindSubscriberByPhoneRequest

type FindSubscriberByPhoneRequest struct {
	Phone string `url:"phone"`
}

type Flow

type Flow struct {
	NS       string `json:"ns"`
	Name     string `json:"name"`
	FolderId int64  `json:"folder_id"`
}

type FlowService

type FlowService struct {
	// contains filtered or unexported fields
}

func (*FlowService) GetFlows

func (s *FlowService) GetFlows() (*Flows, *http.Response, error)

type Flows

type Flows struct {
	Flows   []Flow   `json:"flows"`
	Folders []Folder `json:"folders"`
}

type Folder

type Folder struct {
	Id       int64  `json:"id"`
	Name     string `json:"name"`
	ParentId int64  `json:"parent_id"`
}

type GetSubscriberInfoByUserRefRequest

type GetSubscriberInfoByUserRefRequest struct {
	UserRef int64 `url:"user_ref"`
}

type GetSubscriberInfoRequest

type GetSubscriberInfoRequest struct {
	SubscriberId int64 `url:"subscriber_id"`
}

type GrowthTool

type GrowthTool struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type GrowthToolsService

type GrowthToolsService struct {
	// contains filtered or unexported fields
}

func (*GrowthToolsService) GetGrowthTools

func (s *GrowthToolsService) GetGrowthTools() (*[]GrowthTool, *http.Response, error)

type OtnTopic

type OtnTopic struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type OtnTopicService

type OtnTopicService struct {
	// contains filtered or unexported fields
}

func (*OtnTopicService) GetOtnTopics

func (s *OtnTopicService) GetOtnTopics() (*[]OtnTopic, *http.Response, error)

type Page

type Page struct {
	Id          int64  `json:"id"`
	Name        string `json:"name"`
	Category    string `json:"category"`
	AvatarLink  string `json:"avatar_link"`
	Username    string `json:"username"`
	About       string `json:"about"`
	Description string `json:"description"`
	IsPro       bool   `json:"is_pro"`
	Timezone    string `json:"timezone"`
}

type PageService

type PageService struct {
	Tags         *TagService
	GrowthTools  *GrowthToolsService
	Flows        *FlowService
	OtnTopics    *OtnTopicService
	CustomFields *CustomFieldService
	BotFields    *BotFieldService
	// contains filtered or unexported fields
}

func NewPageService

func NewPageService(sling *sling.Sling) *PageService

func (*PageService) GetInfo

func (s *PageService) GetInfo() (*Page, *http.Response, error)

type RateLimit

type RateLimit uint16
const (
	RateLimitPageGetInfo           RateLimit = 100
	RateLimitPageCreateTag         RateLimit = 10
	RateLimitPageGetTags           RateLimit = 100
	RateLimitPageRemoveTag         RateLimit = 10
	RateLimitPageRemoveTageByName  RateLimit = 10
	RateLimitPageCreateCustomField RateLimit = 10
	RateLimitPageGetGrowthTools    RateLimit = 100
	RateLimitPageGetFlows          RateLimit = 10
	RateLimitPageGetCustomFields   RateLimit = 100
	RateLimitPageGetOtnTopics      RateLimit = 100
	RateLimitPageGetBotFields      RateLimit = 100
	RateLimitPageCreateBotField    RateLimit = 10
	RateLimitPageSetBotField       RateLimit = 10
	RateLimitPageSetBotFieldByName RateLimit = 10
	RateLimitPageSetBotFields      RateLimit = 10

	RateLimitSubscriberGetInfo               RateLimit = 10
	RateLimitSubscriberFindByName            RateLimit = 100
	RateLimitSubscriberGetInfoByUserRef      RateLimit = 1000
	RateLimitSubscriberFindByCustomField     RateLimit = 100
	RateLimitSubscriberFindBySystemField     RateLimit = 100
	RateLimitSubscriberAddTag                RateLimit = 10
	RateLimitSubscriberAddTagByName          RateLimit = 10
	RateLimitSubscriberRemoveTag             RateLimit = 10
	RateLimitSubscriberRemoveTagByName       RateLimit = 10
	RateLimitSubscriberSetCustomField        RateLimit = 10
	RateLimitSubscriberSetCustomFields       RateLimit = 10
	RateLimitSubscriberSetCustomFieldByName  RateLimit = 10
	RateLimitSubscriberVerifyBySignedRequest RateLimit = 10
	RateLimitSubscriberCreateSubscriber      RateLimit = 10
	RateLimitSubscriberUpdateSubscriber      RateLimit = 10

	RateLimitSendingSendContent          RateLimit = 25
	RateLimitSendingSendContentByUserRef RateLimit = 25
	RateLimitSendingSendFlow             RateLimit = 25
)

type RemoveSubscriberTagByNameRequest

type RemoveSubscriberTagByNameRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	TagName      string `json:"tag_name"`
}

type RemoveSubscriberTagRequest

type RemoveSubscriberTagRequest struct {
	SubscriberId int64 `json:"subscriber_id"`
	TagId        int64 `json:"tag_id"`
}

type RemoveTagByNameRequest

type RemoveTagByNameRequest struct {
	Name string `json:"tag_name,omitempty"`
}

type RemoveTagRequest

type RemoveTagRequest struct {
	Id int64 `json:"tag_id,omitempty"`
}

type SendingSendContentByUserRefRequest

type SendingSendContentByUserRefRequest struct {
	UserRef int64        `json:"user_ref"`
	Data    DynamicBlock `json:"data"`
}

type SendingSendContentRequest

type SendingSendContentRequest struct {
	SubscriberId int64         `json:"subscriber_id"`
	Data         *DynamicBlock `json:"data"`
	MessageTag   string        `json:"message_tag"`
	OtnTopicName string        `json:"otn_topic_name,omitempty"`
}

type SendingSendFlowRequest

type SendingSendFlowRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	FlowNS       string `json:"flow_ns"`
}

type SendingService

type SendingService struct {
	// contains filtered or unexported fields
}

func NewSendingService

func NewSendingService(sling *sling.Sling) *SendingService

func (*SendingService) SendContent

func (s *SendingService) SendContent(request SendingSendContentRequest) (bool, *http.Response, error)

func (*SendingService) SendContentByUserRef

func (s *SendingService) SendContentByUserRef(request SendingSendContentByUserRefRequest) (bool, *http.Response, error)

func (*SendingService) SendFlow

func (s *SendingService) SendFlow(request SendingSendFlowRequest) (bool, *http.Response, error)

type SetBotFieldByNameRequest

type SetBotFieldByNameRequest struct {
	FieldName  string      `json:"field_name"`
	FieldValue interface{} `json:"field_value"`
}

type SetBotFieldRequest

type SetBotFieldRequest struct {
	FieldId    int64       `json:"field_id"`
	FieldValue interface{} `json:"field_value"`
}

type SetBotFieldsItem

type SetBotFieldsItem struct {
	Id    int64       `json:"field_id,omitempty"`
	Name  string      `json:"field_name,omitempty"`
	Value interface{} `json:"field_value"`
}

type SetBotFieldsRequest

type SetBotFieldsRequest struct {
	Items []SetBotFieldsItem `json:"fields"`
}

type SetCustomFieldsItem

type SetCustomFieldsItem struct {
	Id    int64       `json:"field_id,omitempty"`
	Name  string      `json:"field_name,omitempty"`
	Value interface{} `json:"field_value"`
}

type SetCustomFieldsRequest

type SetCustomFieldsRequest struct {
	Items []SetCustomFieldsItem `json:"fields"`
}

type SetSubscriberCustomFieldByNameRequest

type SetSubscriberCustomFieldByNameRequest struct {
	SubscriberId int64       `json:"subscriber_id"`
	FieldName    string      `json:"field_name"`
	FieldValue   interface{} `json:"field_value"`
}

type SetSubscriberCustomFieldRequest

type SetSubscriberCustomFieldRequest struct {
	SubscriberId int64       `json:"subscriber_id"`
	FieldId      int64       `json:"field_id"`
	FieldValue   interface{} `json:"field_value"`
}

type Subscriber

type Subscriber struct {
	Id                string                   `json:"id"`
	PageId            string                   `json:"page_id"`
	UserRefs          []SubscriberRefField     `json:"user_refs,omitempty"`
	FirstName         string                   `json:"first_name"`
	LastName          string                   `json:"last_name"`
	Name              string                   `json:"name"`
	Gender            string                   `json:"gender"`
	ProfilePic        string                   `json:"profile_pic"`
	Locale            string                   `json:"locale"`
	Language          string                   `json:"language"`
	TimeZone          string                   `json:"time_zone"`
	LiveChatUrl       string                   `json:"live_chat_url"`
	LastInputText     string                   `json:"last_input_text"`
	OptInPhone        bool                     `json:"optin_phone"`
	Phone             string                   `json:"phone"`
	OptInEmail        bool                     `json:"optin_email"`
	Email             string                   `json:"email"`
	Subscribed        string                   `json:"subscribed"`
	LastInteraction   string                   `json:"last_interaction"`
	LastSeen          string                   `json:"last_seen"`
	IsFollowupEnabled bool                     `json:"is_followup_enabled"`
	IgUsername        string                   `json:"ig_username"`
	IgId              int64                    `json:"ig_id"`
	WhatsAppPhone     string                   `json:"whatsapp_phone"`
	OptInWhatsApp     bool                     `json:"optin_whatsapp"`
	CustomFields      []SubscriberCustomField  `json:"custom_fields"`
	ShopifyFields     []SubscriberShopifyField `json:"shopify_fields,omitempty"`
	Tags              []Tag                    `json:"tags,omitempty"`
}

type SubscriberCustomField

type SubscriberCustomField struct {
	Id          int64       `json:"id"`
	Name        string      `json:"name"`
	Type        DataType    `json:"type"`
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
}

type SubscriberRefField

type SubscriberRefField struct {
	UserRef string `json:"user_ref"`
	OptedIn string `json:"opted_in"`
}

type SubscriberService

type SubscriberService struct {
	// contains filtered or unexported fields
}

func NewSubscriberService

func NewSubscriberService(sling *sling.Sling) *SubscriberService

func (*SubscriberService) AddTag

func (*SubscriberService) AddTagByName

func (s *SubscriberService) AddTagByName(request AddSubscriberTagRequest) (bool, *http.Response, error)

func (*SubscriberService) CreateSubscriber

func (s *SubscriberService) CreateSubscriber(request CreateSubscriberRequest) (*Subscriber, *http.Response, error)

func (*SubscriberService) FindByCustomField

func (s *SubscriberService) FindByCustomField(request FindSubscriberByCustomFieldRequest) (*[]Subscriber, *http.Response, error)

func (*SubscriberService) FindByEmail

func (*SubscriberService) FindByName

func (*SubscriberService) FindByPhone

func (*SubscriberService) GetInfo

func (*SubscriberService) GetInfoByUserRef

func (*SubscriberService) RemoveTag

func (*SubscriberService) RemoveTagByName

func (s *SubscriberService) RemoveTagByName(request RemoveSubscriberTagByNameRequest) (bool, *http.Response, error)

func (*SubscriberService) SetCustomField

func (s *SubscriberService) SetCustomField(request SetSubscriberCustomFieldRequest) (bool, *http.Response, error)

func (*SubscriberService) SetCustomFieldByName

func (s *SubscriberService) SetCustomFieldByName(request SetSubscriberCustomFieldByNameRequest) (bool, *http.Response, error)

func (*SubscriberService) UpdateSubscriber

func (s *SubscriberService) UpdateSubscriber(request UpdateSubscriberRequest) (*Subscriber, *http.Response, error)

func (*SubscriberService) VerifyBySignedRequest

func (s *SubscriberService) VerifyBySignedRequest(request SubscriberVerifyBySignedRequestRequest) (bool, *http.Response, error)

type SubscriberShopifyField

type SubscriberShopifyField struct {
	Id                    int64    `json:"id"`
	State                 string   `json:"state"`
	Currency              string   `json:"currency"`
	TotalSpent            string   `json:"total_spent"`
	OrdersCount           int64    `json:"orders_count"`
	AcceptsMarketing      bool     `json:"accepts_marketing"`
	LastOrderId           int64    `json:"last_order_id"`
	LastOrderCreatedAt    string   `json:"last_order_created_at"`
	Tags                  []string `json:"tags"`
	LastCheckoutId        int64    `json:"last_checkout_id"`
	LastCheckoutPrice     string   `json:"last_checkout_price"`
	LastCheckoutCreatedAt string   `json:"last_checkout_created_at"`
}

type SubscriberVerifyBySignedRequestRequest

type SubscriberVerifyBySignedRequestRequest struct {
	SubscriberId  int64  `json:"subscriber_id"`
	SignedRequest string `json:"signed_request"`
}

type Tag

type Tag struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type TagService

type TagService struct {
	// contains filtered or unexported fields
}

func (*TagService) CreateTag

func (s *TagService) CreateTag(request CreateTagRequest) (*Tag, *http.Response, error)

func (*TagService) GetTags

func (s *TagService) GetTags() (*[]Tag, *http.Response, error)

func (*TagService) RemoveTag

func (s *TagService) RemoveTag(request RemoveTagRequest) (bool, *http.Response, error)

func (*TagService) RemoveTagByName

func (s *TagService) RemoveTagByName(request RemoveTagByNameRequest) (bool, *http.Response, error)

type UpdateSubscriberRequest

type UpdateSubscriberRequest struct {
	SubscriberId  int64  `json:"subscriber_id"`
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Phone         string `json:"phone"`
	WhatsAppPhone string `json:"whatsapp_phone,omitempty"`
	Email         string `json:"email"`
	Gender        string `json:"gender"`
	HasOptInSMS   bool   `json:"has_opt_in_sms"`
	HasOptInEmail bool   `json:"has_opt_in_email"`
	ConsentPhrase string `json:"consent_phrase"`
}

type СreateCustomFieldRequest

type СreateCustomFieldRequest struct {
	Caption     string   `json:"caption"`
	Type        DataType `json:"type"`
	Description string   `json:"description"`
}

Jump to

Keyboard shortcuts

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