freshsalesclient

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

README

freshsales-client-go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIObject

type APIObject struct {
	Contact *Contact `json:"contact,omitempty"`
	Note    *Note    `json:"note,omitempty"`
}

type BaseNoteDescription

type BaseNoteDescription struct {
	Event  string     `json:"event,omitempty"`
	Client ClientInfo `json:"client,omitempty"`
}

type Client

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

func DefaultFromEnv added in v0.1.0

func DefaultFromEnv() *Client

func New

func New(baseURL, token string) *Client

func (*Client) AddNote

func (c *Client) AddNote(id int64, et EntityType, desc string) (*Note, error)

func (*Client) CreateContact added in v0.1.0

func (c *Client) CreateContact(contact *Contact) (*Contact, error)

func (*Client) GetContact added in v0.1.0

func (c *Client) GetContact(id int) (*Contact, error)

ref: https://developers.freshworks.com/crm/api/#view_a_contact https://appscode.freshsales.io/contacts/5022967942

 /api/contacts/[id]

	curl -H "Authorization: Token token=sfg999666t673t7t82" -H "Content-Type: application/json" -X GET "https://domain.freshsales.io/api/contacts/1"

func (*Client) GetContactFilters added in v0.1.0

func (c *Client) GetContactFilters() ([]ContactView, error)

func (*Client) ListAllContacts added in v0.1.0

func (c *Client) ListAllContacts() ([]Contact, error)

func (*Client) LookupByEmail

func (c *Client) LookupByEmail(email string, et EntityType, more ...EntityType) (*LookupResult, error)

func (*Client) Search

func (c *Client) Search(str string, et EntityType, more ...EntityType) ([]Entity, error)

func (*Client) UpdateContact

func (c *Client) UpdateContact(contact *Contact) (*Contact, error)

type ClientInfo

type ClientInfo struct {
	OS       string      `json:"os,omitempty"`
	Device   string      `json:"device,omitempty"`
	Location GeoLocation `json:"location,omitempty"`
}

type Company

type Company struct {
	ID                int64       `json:"id,omitempty"`
	Name              string      `json:"name,omitempty"`
	Address           string      `json:"address,omitempty"`
	City              string      `json:"city,omitempty"`
	State             string      `json:"state,omitempty"`
	Zipcode           string      `json:"zipcode,omitempty"`
	Country           string      `json:"country,omitempty"`
	NumberOfEmployees int         `json:"number_of_employees,omitempty"`
	AnnualRevenue     int         `json:"annual_revenue,omitempty"`
	Website           string      `json:"website,omitempty"`
	Phone             string      `json:"phone,omitempty"`
	IndustryTypeID    int64       `json:"industry_type_id,omitempty"`
	IndustryType      CompanyType `json:"industry_type,omitempty"`
	BusinessTypeID    int64       `json:"business_type_id,omitempty"`
	BusinessType      CompanyType `json:"business_type,omitempty"`
}

type CompanyType

type CompanyType struct {
	Partial  bool   `json:"partial,omitempty"`
	ID       int64  `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Position int    `json:"position,omitempty"`
}

type Contact

type Contact struct {
	ID                             int64        `json:"id"`
	FirstName                      string       `json:"first_name"`
	LastName                       string       `json:"last_name"`
	DisplayName                    string       `json:"display_name"`
	Avatar                         string       `json:"avatar"`
	JobTitle                       string       `json:"job_title"`
	City                           string       `json:"city"`
	State                          string       `json:"state"`
	Zipcode                        string       `json:"zipcode"`
	Country                        string       `json:"country"`
	Email                          string       `json:"email"`
	Emails                         []EmailInfo  `json:"emails"`
	TimeZone                       string       `json:"time_zone"`
	WorkNumber                     string       `json:"work_number"`
	MobileNumber                   string       `json:"mobile_number"`
	Address                        string       `json:"address"`
	LastSeen                       string       `json:"last_seen"`
	LeadScore                      int          `json:"lead_score"`
	LastContacted                  time.Time    `json:"last_contacted"`
	OpenDealsAmount                string       `json:"open_deals_amount"`
	WonDealsAmount                 string       `json:"won_deals_amount"`
	Links                          Links        `json:"links"`
	LastContactedSalesActivityMode string       `json:"last_contacted_sales_activity_mode"`
	CustomField                    CustomFields `json:"custom_field"`
	CreatedAt                      time.Time    `json:"created_at"`
	UpdatedAt                      time.Time    `json:"updated_at"`
	Keyword                        string       `json:"keyword"`
	Medium                         string       `json:"medium"`
	LastContactedMode              string       `json:"last_contacted_mode"`
	RecentNote                     string       `json:"recent_note"`
	WonDealsCount                  int          `json:"won_deals_count"`
	LastContactedViaSalesActivity  time.Time    `json:"last_contacted_via_sales_activity"`
	CompletedSalesSequences        string       `json:"completed_sales_sequences"`
	ActiveSalesSequences           string       `json:"active_sales_sequences"`
	WebFormIds                     string       `json:"web_form_ids"`
	OpenDealsCount                 int          `json:"open_deals_count"`
	LastAssignedAt                 *time.Time   `json:"last_assigned_at"`
	Facebook                       string       `json:"facebook"`
	Twitter                        string       `json:"twitter"`
	Linkedin                       string       `json:"linkedin"`
	IsDeleted                      bool         `json:"is_deleted"`
	TeamUserIds                    string       `json:"team_user_ids"`
	ExternalId                     string       `json:"external_id"`
	WorkEmail                      string       `json:"work_email"`
	SubscriptionStatus             int          `json:"subscription_status"`
	SubscriptionTypes              string       `json:"subscription_types"`
	UnsubscriptionReason           string       `json:"unsubscription_reason"`
	OtherUnsubscriptionReason      string       `json:"other_unsubscription_reason"`
	CustomerFit                    int          `json:"customer_fit"`
	WhatsappSubscriptionStatus     int          `json:"whatsapp_subscription_status"`
	SmsSubscriptionStatus          int          `json:"sms_subscription_status"`
	LastSeenChat                   string       `json:"last_seen_chat"`
	FirstSeenChat                  string       `json:"first_seen_chat"`
	Locale                         string       `json:"locale"`
	TotalSessions                  string       `json:"total_sessions"`
	SystemTags                     []string     `json:"system_tags"`
	FirstCampaign                  string       `json:"first_campaign"`
	FirstMedium                    string       `json:"first_medium"`
	FirstSource                    string       `json:"first_source"`
	LastCampaign                   string       `json:"last_campaign"`
	LastMedium                     string       `json:"last_medium"`
	LastSource                     string       `json:"last_source"`
	LatestCampaign                 string       `json:"latest_campaign"`
	LatestMedium                   string       `json:"latest_medium"`
	LatestSource                   string       `json:"latest_source"`
	McrId                          int64        `json:"mcr_id"`
	PhoneNumbers                   []string     `json:"phone_numbers"`
	Tags                           []string     `json:"tags"`
}

type ContactFilters added in v0.1.0

type ContactFilters struct {
	Filters []ContactView `json:"filters"`
}

type ContactView added in v0.1.0

type ContactView struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	ModelClassName string `json:"model_class_name"`
	UserID         int    `json:"user_id"`
	IsDefault      bool   `json:"is_default"`
	IsPublic       bool   `json:"is_public"`
	UpdatedAt      string `json:"updated_at"`
}

type Currency

type Currency struct {
	Partial      bool        `json:"partial,omitempty"`
	ID           int64       `json:"id,omitempty"`
	IsActive     bool        `json:"is_active,omitempty"`
	CurrencyCode string      `json:"currency_code,omitempty"`
	ExchangeRate string      `json:"exchange_rate,omitempty"`
	CurrencyType int         `json:"currency_type,omitempty"`
	ScheduleInfo interface{} `json:"schedule_info,omitempty"`
}

type CustomFields

type CustomFields struct {
	Interest              string `json:"cf_interest,omitempty"`
	Github                string `json:"cf_github,omitempty"`
	KubernetesSetup       string `json:"cf_kubernetes_setup,omitempty"`
	CalendlyMeetingAgenda string `json:"cf_calendly_meeting_agenda,omitempty"`
}

type Deal

type Deal struct {
	ID                 int64       `json:"id,omitempty"`
	Name               string      `json:"name,omitempty"`
	Amount             float64     `json:"amount,omitempty"`
	CurrencyID         int64       `json:"currency_id,omitempty"`
	BaseCurrencyAmount float64     `json:"base_currency_amount,omitempty"`
	ExpectedClose      *time.Time  `json:"expected_close,omitempty"`
	DealProductID      int64       `json:"deal_product_id,omitempty"`
	DealProduct        interface{} `json:"deal_product,omitempty"`
	Currency           Currency    `json:"currency,omitempty"`
	ProductID          int         `json:"product_id,omitempty"`
}

type EmailInfo

type EmailInfo struct {
	ID        int64       `json:"id,omitempty"`
	Value     string      `json:"value,omitempty"`
	IsPrimary bool        `json:"is_primary,omitempty"`
	Label     interface{} `json:"label,omitempty"`
	Destroy   bool        `json:"_destroy,omitempty"`
}

type Entity

type Entity struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Email       string `json:"email"`
	Avatar      string `json:"avatar"`
	CompanyName string `json:"company_name,omitempty"`
}

type EntityType

type EntityType string
const (
	EntityContact      EntityType = "Contact"
	EntitySalesAccount EntityType = "SalesAccount"
	EntityDeal         EntityType = "Deal"
)

type GeoLocation

type GeoLocation struct {
	IP          string `json:"ip,omitempty"`
	Timezone    string `json:"timezone,omitempty"`
	City        string `json:"city,omitempty"`
	Country     string `json:"country,omitempty"`
	Coordinates string `json:"coordinates,omitempty"`
}
type Links struct {
	Conversations        string `json:"conversations,omitempty"`
	TimelineFeeds        string `json:"timeline_feeds,omitempty"`
	DocumentAssociations string `json:"document_associations,omitempty"`
	Notes                string `json:"notes,omitempty"`
	Tasks                string `json:"tasks,omitempty"`
	Appointments         string `json:"appointments,omitempty"`
	Reminders            string `json:"reminders,omitempty"`
	Duplicates           string `json:"duplicates,omitempty"`
	Connections          string `json:"connections,omitempty"`
}

type ListMeta added in v0.0.2

type ListMeta struct {
	TotalPages int `json:"total_pages"`
	Total      int `json:"total"`
}

type ListResponse added in v0.0.2

type ListResponse struct {
	Contacts []Contact `json:"contacts"`
	Meta     ListMeta  `json:"meta"`
}

type LookupResult

type LookupResult struct {
	Contacts struct {
		Contacts []Contact `json:"contacts,omitempty"`
	} `json:"contacts,omitempty"`
}

type Note

type Note struct {
	Description    string `json:"description,omitempty"`
	TargetableType string `json:"targetable_type,omitempty"`
	TargetableID   int64  `json:"targetable_id,omitempty"`

	ID        int64      `json:"id,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

type SearchResults

type SearchResults []Entity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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