Documentation ¶
Index ¶
- Variables
- func HTTPFetcher(a *API) error
- func LogURLs(a *API) error
- type API
- func (pd *API) FetchDeal(dealID int) (DealRef, error)
- func (pd *API) FetchDealActivities(dealID int) (<-chan Activity, <-chan error)
- func (pd *API) FetchDealUpdates(dealID int) (DealUpdates, error)
- func (pd *API) FetchDeals(filterID int) (DealRefs, error)
- func (pd *API) FetchDealsFromPipeline(plID, filterID int) (Deals, error)
- func (pd *API) FetchGeneric(urlGenerator Urler, results chan GenericResponse) error
- func (pd *API) FetchOrganization(orgID int) (Organization, error)
- func (pd *API) FetchPipelineChanges(deals []Deal, stages Stages) (PipelineChangeResults, error)
- func (pd *API) GenericStreamHelper(worker func(r GenericResponse) error, generator Urler, closer func()) <-chan error
- func (pd *API) GetDealFieldByID(id int) (DealField, error)
- func (pd *API) GetFilterIDByName(name string) (int, error)
- func (pd *API) GetPipelineIDByName(name string) (int, error)
- func (pd *API) PutGeneric(endpoint string, data io.Reader, results chan GenericResponse) error
- func (pd *API) RetrieveStagesForPipeline(plID int) (Stages, error)
- type Activity
- type CustomFieldMap
- type Date
- type Deal
- type DealField
- type DealFlowUpdate
- type DealFlowUpdates
- type DealRef
- type DealRefs
- type DealUpdate
- type DealUpdates
- type Deals
- type Filter
- type Filters
- type GenericResponse
- type Option
- type Organization
- type OrganizationField
- type Pipeline
- type PipelineChangeResult
- type PipelineChangeResults
- type Stage
- type Stages
- type StagesResult
- type Time
- type Urler
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyToken = errors.New("Pipedrive token must not be empty")
Functions ¶
func HTTPFetcher ¶
Types ¶
type API ¶
type API struct { Endpoints endpoints // contains filtered or unexported fields }
API represents the information needed to access the Pipedrive API v1
func (*API) FetchDealActivities ¶
func (*API) FetchDealUpdates ¶
func (pd *API) FetchDealUpdates(dealID int) (DealUpdates, error)
FetchDealUpdates request updates for a specific deal
func (*API) FetchDeals ¶
FetchDeals returns a list of deals, optionally using a filter
func (*API) FetchDealsFromPipeline ¶
FetchDealsFromPipeline returns a list of all deals in a pipeline, optionally using a filter
func (*API) FetchGeneric ¶
func (pd *API) FetchGeneric(urlGenerator Urler, results chan GenericResponse) error
FetchGeneric calls the Pipedrive API with a GET request.
func (*API) FetchOrganization ¶
func (pd *API) FetchOrganization(orgID int) (Organization, error)
FetchOrganization returns the Organization with the given id
func (*API) FetchPipelineChanges ¶
func (pd *API) FetchPipelineChanges(deals []Deal, stages Stages) (PipelineChangeResults, error)
FetchPipelineChanges generates a list of deals with changes between the given stages
func (*API) GenericStreamHelper ¶
func (pd *API) GenericStreamHelper(worker func(r GenericResponse) error, generator Urler, closer func()) <-chan error
func (*API) GetDealFieldByID ¶
GetDealFieldByID returns the DealField with the given ID.
func (*API) GetFilterIDByName ¶
GetFilterIDByName returns the filter id for the given name
func (*API) GetPipelineIDByName ¶
GetPipelineIDByName searches for the given pipeline and returns its ID.
func (*API) PutGeneric ¶
PutGeneric makes a PUT request to the Pipedrive API using the supplied endpoint and data.
type Activity ¶
type Activity struct { ID int `json:"id"` CompanyID int `json:"company_id"` UserID int `json:"user_id"` Done bool `json:"done"` Type string `json:"type"` ReferenceType string `json:"reference_type"` ReferenceID interface{} `json:"reference_id"` DueDate string `json:"due_date"` DueTime string `json:"due_time"` Duration string `json:"duration"` AddTime string `json:"add_time"` MarkedAsDoneTime string `json:"marked_as_done_time"` Subject string `json:"subject"` DealID int `json:"deal_id"` OrgID int `json:"org_id"` PersonID int `json:"person_id"` ActiveFlag bool `json:"active_flag"` UpdateTime string `json:"update_time"` GcalEventID interface{} `json:"gcal_event_id"` GoogleCalendarID interface{} `json:"google_calendar_id"` GoogleCalendarEtag interface{} `json:"google_calendar_etag"` Note string `json:"note"` NoteClean string `json:"note_clean"` Participants []struct { PersonID int `json:"person_id"` PrimaryFlag bool `json:"primary_flag"` } `json:"participants"` PersonName string `json:"person_name"` OrgName string `json:"org_name"` DealTitle string `json:"deal_title"` AssignedToUserID int `json:"assigned_to_user_id"` CreatedByUserID int `json:"created_by_user_id"` OwnerName string `json:"owner_name"` PersonDropboxBcc string `json:"person_dropbox_bcc"` DealDropboxBcc string `json:"deal_dropbox_bcc"` }
type CustomFieldMap ¶ added in v1.1.2
type CustomFieldMap map[string]interface{}
type Date ¶
func (*Date) UnmarshalJSON ¶
type Deal ¶
type Deal struct { ID int `json:"id"` //"user_id": 872124, Person int `json:"person_id"` Organization int `json:"org_id"` Stage int `json:"stage_id"` StageChangetime *Time `json:"stage_change_time"` Title string `json:"title"` Value float64 `json:"value"` Added Time `json:"add_time"` Updated *Time `json:"update_time"` Status string `json:"status"` WonAt *Time `json:"won_time"` LostAt *Time `json:"lost_time"` LastActivity *Date `json:"last_activity_date"` LostReason *string `json:"lost_reason"` Source string `json:"898dea9060ea3bb803e6a4f58c3c780b44e77cf7"` LeadDate string `json:"19cef73a8ff77b70bf05736552155a7b9f97a36f"` CustomFields CustomFieldMap }
Deal models a Pipedrive Deal
type DealFlowUpdate ¶
type DealFlowUpdates ¶
type DealFlowUpdates []DealFlowUpdate
func (DealFlowUpdates) Len ¶
func (slice DealFlowUpdates) Len() int
func (DealFlowUpdates) Less ¶
func (slice DealFlowUpdates) Less(i, j int) bool
func (DealFlowUpdates) Swap ¶
func (slice DealFlowUpdates) Swap(i, j int)
type DealRef ¶
type DealRef struct { ID int `json:"id"` //"user_id": 872124, Person struct { ID int `json:"value"` Name string `json:"name"` Email []struct { Label string `json:"label"` Value string `json:"value"` Primary bool `json:"primary"` } `json:"email"` } `json:"person_id"` Organization struct { ID int `json:"value"` Name string `json:"name"` } `json:"org_id"` Stage int `json:"stage_id"` StageChangetime *Time `json:"stage_change_time"` Title string `json:"title"` Value float64 `json:"value"` Added Time `json:"add_time"` Updated *Time `json:"update_time"` Status string `json:"status"` WonAt *Time `json:"won_time"` LostAt *Time `json:"lost_time"` LostReason string `json:"lost_reason"` LastActivity *Date `json:"last_activity_date"` Source string `json:"898dea9060ea3bb803e6a4f58c3c780b44e77cf7"` LeadDate string `json:"19cef73a8ff77b70bf05736552155a7b9f97a36f"` User struct { ID int `json:"id"` Name string `json:"name"` Email string `json:"email"` HasPicture int `json:"has_pic"` Active bool `json:"active_flag"` Value int `json:"value"` } `json:"user_id"` CustomFields CustomFieldMap }
DealRef models a Pipedrive Deal
type DealUpdate ¶
type DealUpdate struct { // "id": 20215, //"company_id": 452851, StoryData struct { ActionType string `json:"action_type"` ChangeLog []struct { OldValue interface{} `json:"old_value"` NewValue interface{} `json:"new_value"` FieldName string `json:"field_name"` FieldKey string `json:"field_key"` } `json:"change_log"` AddTime Time `json:"add_time"` } `json:"story_data"` AddTime Time `json:"add_time"` }
type DealUpdates ¶
type DealUpdates []DealUpdate
type GenericResponse ¶
type GenericResponse struct { Data json.RawMessage // contains filtered or unexported fields }
GenericResponse lets the user of this package decode the data themselves
type Option ¶
Option represents an option given to the API constructor
func CustomURLLogger ¶
func FixedToken ¶
func HTTPFetcherWithTimeout ¶
func WithCustomDealFields ¶ added in v1.1.2
func WithCustomDealFields() Option
func WithCustomOrgFields ¶ added in v1.1.2
func WithCustomOrgFields() Option
type Organization ¶
type Organization struct { ID int `json:"id"` CompanyID int `json:"company_id"` Name string `json:"name"` OwnerID struct { ID int `json:"id"` Name string `json:"name"` Email string `json:"email"` HasPic int `json:"has_pic"` PicHash interface{} `json:"pic_hash"` ActiveFlag bool `json:"active_flag"` Value int `json:"value"` } `json:"owner_id"` OpenDealsCount int `json:"open_deals_count"` RelatedOpenDealsCount int `json:"related_open_deals_count"` ClosedDealsCount int `json:"closed_deals_count"` RelatedClosedDealsCount int `json:"related_closed_deals_count"` EmailMessagesCount int `json:"email_messages_count"` PeopleCount int `json:"people_count"` ActivitiesCount int `json:"activities_count"` DoneActivitiesCount int `json:"done_activities_count"` UndoneActivitiesCount int `json:"undone_activities_count"` ReferenceActivitiesCount int `json:"reference_activities_count"` FilesCount int `json:"files_count"` NotesCount int `json:"notes_count"` FollowersCount int `json:"followers_count"` WonDealsCount int `json:"won_deals_count"` RelatedWonDealsCount int `json:"related_won_deals_count"` LostDealsCount int `json:"lost_deals_count"` RelatedLostDealsCount int `json:"related_lost_deals_count"` ActiveFlag bool `json:"active_flag"` CategoryID interface{} `json:"category_id"` PictureID interface{} `json:"picture_id"` CountryCode interface{} `json:"country_code"` FirstChar string `json:"first_char"` UpdateTime string `json:"update_time"` AddTime string `json:"add_time"` VisibleTo string `json:"visible_to"` NextActivityDate interface{} `json:"next_activity_date"` NextActivityTime interface{} `json:"next_activity_time"` NextActivityID interface{} `json:"next_activity_id"` LastActivityID int `json:"last_activity_id"` LastActivityDate string `json:"last_activity_date"` Address string `json:"address"` AddressSubpremise string `json:"address_subpremise"` AddressStreetNumber string `json:"address_street_number"` AddressRoute string `json:"address_route"` AddressSublocality string `json:"address_sublocality"` AddressLocality string `json:"address_locality"` AddressAdminAreaLevel1 string `json:"address_admin_area_level_1"` AddressAdminAreaLevel2 string `json:"address_admin_area_level_2"` AddressCountry string `json:"address_country"` AddressPostalCode string `json:"address_postal_code"` AddressFormattedAddress string `json:"address_formatted_address"` Label interface{} `json:"label"` CcEmail string `json:"cc_email"` OwnerName string `json:"owner_name"` EditName bool `json:"edit_name"` LastActivity struct { ID int `json:"id"` CompanyID int `json:"company_id"` UserID int `json:"user_id"` Done bool `json:"done"` Type string `json:"type"` ReferenceType string `json:"reference_type"` ReferenceID interface{} `json:"reference_id"` DueDate string `json:"due_date"` DueTime string `json:"due_time"` Duration string `json:"duration"` BusyFlag interface{} `json:"busy_flag"` AddTime string `json:"add_time"` MarkedAsDoneTime string `json:"marked_as_done_time"` LastNotificationTime interface{} `json:"last_notification_time"` LastNotificationUserID interface{} `json:"last_notification_user_id"` NotificationLanguageID interface{} `json:"notification_language_id"` Subject string `json:"subject"` PublicDescription interface{} `json:"public_description"` CalendarSyncIncludeContext interface{} `json:"calendar_sync_include_context"` Location interface{} `json:"location"` OrgID int `json:"org_id"` PersonID int `json:"person_id"` DealID int `json:"deal_id"` ActiveFlag bool `json:"active_flag"` UpdateTime string `json:"update_time"` UpdateUserID interface{} `json:"update_user_id"` GcalEventID interface{} `json:"gcal_event_id"` GoogleCalendarID interface{} `json:"google_calendar_id"` GoogleCalendarEtag interface{} `json:"google_calendar_etag"` SourceTimezone interface{} `json:"source_timezone"` RecRule interface{} `json:"rec_rule"` RecRuleExtension interface{} `json:"rec_rule_extension"` RecMasterActivityID interface{} `json:"rec_master_activity_id"` Note string `json:"note"` CreatedByUserID int `json:"created_by_user_id"` LocationSubpremise interface{} `json:"location_subpremise"` LocationStreetNumber interface{} `json:"location_street_number"` LocationRoute interface{} `json:"location_route"` LocationSublocality interface{} `json:"location_sublocality"` LocationLocality interface{} `json:"location_locality"` LocationAdminAreaLevel1 interface{} `json:"location_admin_area_level_1"` LocationAdminAreaLevel2 interface{} `json:"location_admin_area_level_2"` LocationCountry interface{} `json:"location_country"` LocationPostalCode interface{} `json:"location_postal_code"` LocationFormattedAddress interface{} `json:"location_formatted_address"` Attendees interface{} `json:"attendees"` Participants []struct { PersonID int `json:"person_id"` PrimaryFlag bool `json:"primary_flag"` } `json:"participants"` Series interface{} `json:"series"` OrgName string `json:"org_name"` PersonName string `json:"person_name"` DealTitle string `json:"deal_title"` OwnerName string `json:"owner_name"` PersonDropboxBcc string `json:"person_dropbox_bcc"` DealDropboxBcc string `json:"deal_dropbox_bcc"` AssignedToUserID int `json:"assigned_to_user_id"` File interface{} `json:"file"` } `json:"last_activity"` NextActivity interface{} `json:"next_activity"` CustomFields CustomFieldMap }
type OrganizationField ¶ added in v1.1.2
type OrganizationField struct { ID int `json:"id"` Key string `json:"key"` Name string `json:"name"` OrderNr int `json:"order_nr"` FieldType string `json:"field_type"` AddTime string `json:"add_time"` UpdateTime string `json:"update_time"` LastUpdatedByUserID interface{} `json:"last_updated_by_user_id"` ActiveFlag bool `json:"active_flag"` EditFlag bool `json:"edit_flag"` IndexVisibleFlag bool `json:"index_visible_flag"` DetailsVisibleFlag bool `json:"details_visible_flag"` AddVisibleFlag bool `json:"add_visible_flag"` ImportantFlag bool `json:"important_flag"` BulkEditAllowed bool `json:"bulk_edit_allowed"` SearchableFlag bool `json:"searchable_flag"` FilteringAllowed bool `json:"filtering_allowed"` SortableFlag bool `json:"sortable_flag"` Options []struct { Label string `json:"label"` ID int `json:"id"` } `json:"options"` MandatoryFlag bool `json:"mandatory_flag"` }
type Pipeline ¶
type Pipeline struct { ID int `json:"id"` Name string `json:"name"` URLTitle string `json:"url_title"` OrderNr int `json:"order_nr"` Active bool `json:"active"` AddTime Time `json:"add_time"` UpdateTime Time `json:"update_time"` Selected bool `json:"selected"` }
Pipeline models the pipeline API object
type PipelineChangeResult ¶
type PipelineChangeResult struct { Deal Deal PipelineUpdates DealFlowUpdates Updates DealUpdates }
func (PipelineChangeResult) DecisionTime ¶
func (cr PipelineChangeResult) DecisionTime() time.Time
type PipelineChangeResults ¶
type PipelineChangeResults []PipelineChangeResult
type Stage ¶
type Stage struct { Id int `json:"id"` OrderNr int `json:"order_nr"` Name string `json:"name"` Active bool `json:"active_flag"` AddTime Time `json:"add_time"` UpdateTime Time `json:"update_time"` Rotten bool `json:"rotten_flag"` RottenDays int `json:"rotten_days"` PipelineID int `json:"pipeline_id"` PipelineName string `json:"pipeline_name"` DealProbability int `json:"deal_probability"` }
type StagesResult ¶
type StagesResult struct { Data Stages `json:"data"` // contains filtered or unexported fields }