import "github.com/sarthakjdev/wapi.go/pkg/business"

type AccountAnalyticsOptions

type AccountAnalyticsOptions struct {
    Start        time.Time                       `json:"start" validate:"required"`
    End          time.Time                       `json:"end" validate:"required"`
    Granularity  AnalyticsRequestGranularityType `json:"granularity" validate:"required"`
    PhoneNumbers []string                        `json:"phone_numbers,omitempty"`

    // * NOT SUPPORTED AS OF NOW
    // ProductTypes []WhatsAppBusinessAccountAnalyticsProductType `json:"product_types,omitempty"`
    CountryCodes []string `json:"country_codes,omitempty"`
}

type AnalyticsDataPoint

type AnalyticsDataPoint struct {
    Start     int `json:"start,omitempty"`
    End       int `json:"end,omitempty"`
    Sent      int `json:"sent,omitempty"`
    Delivered int `json:"delivered,omitempty"`
}

type AnalyticsRequestGranularityType

type AnalyticsRequestGranularityType string
const (
    AnalyticsRequestGranularityTypeHalfHour AnalyticsRequestGranularityType = "HALF_HOUR"
    AnalyticsRequestGranularityTypeDay      AnalyticsRequestGranularityType = "DAY"
    AnalyticsRequestGranularityTypeMonth    AnalyticsRequestGranularityType = "MONTH"
)

type BusinessClient

type BusinessClient struct {
    BusinessAccountId string `json:"businessAccountId" validate:"required"`
    AccessToken       string `json:"accessToken" validate:"required"`
    PhoneNumber       *manager.PhoneNumberManager
    Template          *manager.TemplateManager
    requester         *request_client.RequestClient
}

func NewBusinessClient

func NewBusinessClient(config *BusinessClientConfig) *BusinessClient

func (*BusinessClient) ConversationAnalytics

func (client *BusinessClient) ConversationAnalytics(options ConversationAnalyticsOptions) (*WhatsAppConversationAnalyticsResponse, error)

func (*BusinessClient) CreateNewProductCatalog

func (client *BusinessClient) CreateNewProductCatalog() (string, error)

func (*BusinessClient) DeleteUser

func (client *BusinessClient) DeleteUser(userId string) (string, error)

func (*BusinessClient) Fetch

func (client *BusinessClient) Fetch() FetchBusinessAccountResponse

func (*BusinessClient) FetchAllProductCatalogs

func (client *BusinessClient) FetchAllProductCatalogs() (string, error)

func (*BusinessClient) FetchAnalytics

func (client *BusinessClient) FetchAnalytics(options AccountAnalyticsOptions)

func (*BusinessClient) GetBusinessId

func (bc *BusinessClient) GetBusinessId() string

func (*BusinessClient) SetBusinessId

func (bc *BusinessClient) SetBusinessId(id string)

func (*BusinessClient) UpdateUser

func (client *BusinessClient) UpdateUser(userId string, tasks []BusinessRole) (string, error)

type BusinessClientConfig

type BusinessClientConfig struct {
    BusinessAccountId string `json:"businessAccountId" validate:"required"`
    AccessToken       string `json:"accessToken" validate:"required"`
    Requester         *request_client.RequestClient
}

type BusinessRole

type BusinessRole string
const (
    BusinessRoleManage               BusinessRole = "MANAGE"
    BusinessRoleDevelop              BusinessRole = "DEVELOP"
    BusinessRoleManageTemplates      BusinessRole = "MANAGE_TEMPLATES"
    BusinessRoleManagePhone          BusinessRole = "MANAGE_PHONE"
    BusinessRoleViewCost             BusinessRole = "VIEW_COST"
    BusinessRoleManageExtensions     BusinessRole = "MANAGE_EXTENSIONS"
    BusinessRoleViewPhoneAssets      BusinessRole = "VIEW_PHONE_ASSETS"
    BusinessRoleManagePhoneAssets    BusinessRole = "MANAGE_PHONE_ASSETS"
    BusinessRoleViewTemplates        BusinessRole = "VIEW_TEMPLATES"
    BusinessRoleMessaging            BusinessRole = "MESSAGING"
    BusinessRoleManageBusinessPhones BusinessRole = "MANAGE_BUSINESS_PHONES"
)

func (*BusinessRole) String

func (role *BusinessRole) String() string

type ConversationAnalyticsGranularityType

type ConversationAnalyticsGranularityType string
const (
    ConversationAnalyticsGranularityTypeHalfHour ConversationAnalyticsGranularityType = "HALF_HOUR"
    ConversationAnalyticsGranularityTypeDay      ConversationAnalyticsGranularityType = "DAILY"
    ConversationAnalyticsGranularityTypeMonth    ConversationAnalyticsGranularityType = "MONTHLY"
)

type ConversationAnalyticsOptions

type ConversationAnalyticsOptions struct {
    Start        time.Time                            `json:"start" validate:"required"`
    End          time.Time                            `json:"end" validate:"required"`
    Granularity  ConversationAnalyticsGranularityType `json:"granularity" validate:"required"`
    PhoneNumbers []string                             `json:"phone_numbers,omitempty"`

    ConversationCategory  []ConversationCategoryType  `json:"conversation_category,omitempty"`
    ConversationTypes     []ConversationCategoryType  `json:"conversation_types,omitempty"`
    ConversationDirection []ConversationDirection     `json:"conversation_direction,omitempty"`
    Dimensions            []ConversationDimensionType `json:"dimensions,omitempty"`
}

type ConversationCategoryType

type ConversationCategoryType string
const (
    ConversationCategoryTypeAuthentication ConversationCategoryType = "AUTHENTICATION"
    ConversationCategoryTypeMarketing      ConversationCategoryType = "MARKETING"
    ConversationCategoryTypeService        ConversationCategoryType = "SERVICE"
    ConversationCategoryTypeUtility        ConversationCategoryType = "UTILITY"
)

type ConversationDimensionType

type ConversationDimensionType string
const (
    ConversationDimensionTypeConversationCategory  ConversationDimensionType = "CONVERSATION_CATEGORY"
    ConversationDimensionTypeConversationDirection ConversationDimensionType = "CONVERSATION_DIRECTION"
    ConversationDimensionTypeConversationType      ConversationDimensionType = "CONVERSATION_TYPE"
    ConversationDimensionTypeCountry               ConversationDimensionType = "COUNTRY"
    ConversationDimensionTypePhone                 ConversationDimensionType = "PHONE"
)

type ConversationDirection

type ConversationDirection string
const (
    ConversationDirectionBusinessInitiated ConversationDirection = "BUSINESS_INITIATED"
    ConversationDirectionUserInitiated     ConversationDirection = "USER_INITIATED"
)

type ConversationType

type ConversationType string
const (
    ConversationTypeFreeEntry ConversationType = "FREE_ENTRY"
    ConversationTypeFreeTier  ConversationType = "FREE_TIER"
    ConversationTypeRegular   ConversationType = "REGULAR"
)

type FetchBusinessAccountResponse

type FetchBusinessAccountResponse struct {
    Id                       string `json:"id" validate:"required"`
    Name                     string `json:"name" validate:"required"`
    TimezoneId               string `json:"timezone_id" validate:"required"`
    MessageTemplateNamespace string `json:"message_template_namespace" validate:"required"`
}

type WhatsAppBusinessAccountAnalyticsProductType

type WhatsAppBusinessAccountAnalyticsProductType int
const (
    WhatsAppBusinessAccountAnalyticsProductTypeNotificationMessages    WhatsAppBusinessAccountAnalyticsProductType = 0
    WhatsAppBusinessAccountAnalyticsProductTypeCustomerSupportMessages WhatsAppBusinessAccountAnalyticsProductType = 2
)

type WhatsAppConversationAnalyticsEdge

type WhatsAppConversationAnalyticsEdge struct {
    Data []struct {
        DataPoints []WhatsAppConversationAnalyticsNode `json:"data_points,omitempty"`
    }   `json:"data,omitempty"`
    Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
}

type WhatsAppConversationAnalyticsNode

type WhatsAppConversationAnalyticsNode struct {
    Start                 int    `json:"start" validate:"required"`
    End                   int    `json:"end,omitempty" validate:"required"`
    Conversation          int    `json:"conversation,omitempty"`
    PhoneNumber           string `json:"phone_number,omitempty"`
    Country               string `json:"country,omitempty"`
    ConversationType      string `json:"conversation_type,omitempty"`
    ConversationDirection string `json:"conversation_direction,omitempty"`
    ConversationCategory  string `json:"conversation_category,omitempty"`
    Cost                  int    `json:"cost,omitempty"`
}

type WhatsAppConversationAnalyticsResponse

type WhatsAppConversationAnalyticsResponse struct {
    ConversationAnalytics []WhatsAppConversationAnalyticsEdge `json:"conversation_analytics" validate:"required"`
}

type WhatsappBusinessAccount

type WhatsappBusinessAccount struct {
    BusinessVerificationStatus string `json:"business_verification_status,omitempty"`
    Country                    string `json:"country,omitempty"`
    Currency                   string `json:"currency,omitempty"`
    IsTemplateAnalyticsEnabled string `json:"is_enabled_for_insights,omitempty"`
    MessageTemplateNamespace   string `json:"message_template_namespace,omitempty"`
    Name                       string `json:"name,omitempty"`
    OwnershipType              string `json:"ownership_type,omitempty"`
    PrimaryFundingId           string `json:"primary_funding_id,omitempty"`
    PurchaseOrderNumber        string `json:"purchase_order_number,omitempty"`
    TimezoneId                 string `json:"timezone_id,omitempty"`
}

type WhatsappBusinessAccountAnalyticsResponse

type WhatsappBusinessAccountAnalyticsResponse struct {
    PhoneNumbers []string             `json:"phone_numbers,omitempty"`
    Granularity  string               `json:"granularity,omitempty"`
    DataPoints   []AnalyticsDataPoint `json:"data_points,omitempty"`
}