Documentation ¶
Index ¶
- Constants
- func Stringify(message interface{}) string
- type ActiveFlag
- type Activity
- type AdditionalData
- type BaseActivityObject
- type BaseDealObject
- type BaseNoteObject
- type BasePersonObject
- type BaseResponse
- type Client
- func (c *Client) CreateActivity(ctx context.Context, activity Activity, out ResponseModel) error
- func (c *Client) CreateDeal(ctx context.Context, deal Deal, out ResponseModel) error
- func (c *Client) CreateNote(ctx context.Context, note Note, out ResponseModel) error
- func (c *Client) CreatePerson(ctx context.Context, person Person, out ResponseModel) error
- func (c *Client) DeleteDeal(ctx context.Context, id int) error
- func (c *Client) DeleteDeals(ctx context.Context, ids []int) error
- func (c *Client) DeleteNote(ctx context.Context, id int) error
- func (c *Client) DeletePerson(ctx context.Context, id int) error
- func (c *Client) DeletePersons(ctx context.Context, ids []int) error
- func (c *Client) Do(ctx context.Context, request *http.Request, out interface{}) (*Response, error)
- func (c *Client) GetDeal(ctx context.Context, id int, out ResponseModel) error
- func (c *Client) GetNote(ctx context.Context, id int, out ResponseModel) error
- func (c *Client) GetPerson(ctx context.Context, id int, out ResponseModel) error
- func (c *Client) ListDeals(ctx context.Context, personID int, opt *ListDealOptions, out ResponseModel) error
- func (c *Client) NewRequest(method, url string, opt interface{}, body interface{}) (*http.Request, error)
- func (c *Client) SearchDeals(ctx context.Context, opt *SearchDealsOptions) (*SearchDealsResponse, error)
- func (c *Client) SearchItemFields(ctx context.Context, opt *SearchItemFieldsOptions, out ResponseModel) error
- func (c *Client) SearchPersons(ctx context.Context, opt *SearchPersonsOptions) (*SearchPersonsResponse, error)
- func (c *Client) SetOptions(options ...func(*Client) error) error
- func (c *Client) UpdateDeal(ctx context.Context, id int, deal Deal, out ResponseModel) error
- func (c *Client) UpdateNote(ctx context.Context, id int, note Note, out ResponseModel) error
- func (c *Client) UpdatePerson(ctx context.Context, id int, person Person, out ResponseModel) error
- type Config
- type Deal
- type DealItem
- type DealItems
- type DealProbability
- type DealStatus
- type DeleteMultipleOptions
- type Email
- type ErrorFields
- type ErrorResponse
- type EventAction
- type EventObject
- type FieldType
- type ListDealOptions
- type Note
- type OrgID
- type Pagination
- type Person
- type PersonID
- type PersonItem
- type PersonItems
- type Phone
- type Rate
- type RateLimitError
- type Response
- type ResponseError
- type ResponseModel
- type SearchDealField
- type SearchDealsOptions
- type SearchDealsResponse
- type SearchItemFieldType
- type SearchItemFieldsOptions
- type SearchOptions
- type SearchPersonField
- type SearchPersonsOptions
- type SearchPersonsResponse
- type SearchResultDeal
- type SearchResultDealPerson
- type SearchResultDealStage
- type SearchResultPerson
- type Timestamp
- type UserID
- type VisibleTo
Constants ¶
const ( VisibleToOwnersAndFollowers = 1 VisibleToWholeCompany = 3 )
const ( Open DealStatus = "open" Won DealStatus = "won" Lost DealStatus = "lost" Deleted DealStatus = "deleted" SearchDealCustomFields SearchDealField = "custom_fields" SearchDealNotes SearchDealField = "notes" SearchDealTitle SearchDealField = "title" )
const (
DefaultBaseURL = "https://api.pipedrive.com"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveFlag ¶
type ActiveFlag uint8
Active flags
const ( ActiveFlagEnabled ActiveFlag = 1 ActiveFlagDisabled ActiveFlag = 0 )
type Activity ¶
type Activity interface { }
Activity represents a Pipedrive activity. Should embed BaseActivityObject
type AdditionalData ¶
type AdditionalData struct { User struct { Profile struct { ID int `json:"id"` Email string `json:"email"` Name string `json:"name"` IsAdmin bool `json:"is_admin"` DefaultCurrency string `json:"default_currency"` IconURL interface{} `json:"icon_url"` Activated bool `json:"activated"` } `json:"profile"` Locale struct { Language string `json:"language"` Country string `json:"country"` Uses12HourClock bool `json:"uses_12_hour_clock"` } `json:"locale"` Timezone struct { Name string `json:"name"` Offset int `json:"offset"` } `json:"timezone"` } `json:"user"` MultipleCompanies bool `json:"multiple_companies"` DefaultCompanyID int `json:"default_company_id"` CompanyID int `json:"company_id"` SinceTimestamp string `json:"since_timestamp"` LastTimestampOnPage string `json:"last_timestamp_on_page"` Pagination Pagination `json:"pagination"` }
type BaseActivityObject ¶
type BaseActivityObject struct { // Unsettable Fields ID int `json:"id,omitempty"` // Settable Fields Subject *string `json:"subject,omitempty"` // Subject of the activity // Done *bool `json:"done,omitempty"` Type *string `json:"type,omitempty"` // Type of the activity. This is in correlation with the key_string parameter of ActivityTypes. DueDate *string `json:"due_date,omitempty"` // Due date of the activity. Format: YYYY-MM-DD DueTime *string `json:"due_time,omitempty"` // Due time of the activity in UTC. Format: HH:MM Duration *string `json:"duration,omitempty"` // Duration of the activity. Format: HH:MM UserID *int `json:"user_id,omitempty"` // ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. DealID *int `json:"deal_id,omitempty"` // ID of the deal this activity will be associated with PersonID *int `json:"person_id,omitempty"` // ID of the person this activity will be associated with OrgID *int `json:"org_id,omitempty"` // ID of the organization this activity will be associated with Note *string `json:"note,omitempty"` // Note of the activity (HTML format) PublicDescription *string `json:"public_description,omitempty"` // Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity. }
BaseActivityObject represents a basic Pipedrive deal.
type BaseDealObject ¶
type BaseDealObject struct { // Unsettable Fields ID int `json:"id,omitempty"` Active bool `json:"active,omitempty"` Deleted bool `json:"deleted,omitempty"` PersonName string `json:"person_name,omitempty"` OrgName string `json:"org_name,omitempty"` OwnerName string `json:"owner_name,omitempty"` // Settable Fields Title *string `json:"title,omitempty"` Value *float64 `json:"value,omitempty"` StageID *int `json:"stage_id,omitempty"` PersonID *PersonID `json:"person_id,omitempty"` OrgID *OrgID `json:"org_id"` UserID *UserID `json:"user_id,omitempty"` Status *DealStatus `json:"status,omitempty"` LostReason *string `json:"lost_reason,omitempty"` PipelineID *int `json:"pipeline_id,omitempty"` StageOrderNr *int `json:"stage_order_nr,omitempty"` }
BaseDealObject represents a basic Pipedrive deal.
type BaseNoteObject ¶
type BaseNoteObject struct { // Unsettable Fields ID int `json:"id,omitempty"` // Settable Fields UserID *int `json:"user_id,omitempty"` DealID *int `json:"deal_id,omitempty"` PersonID *int `json:"person_id,omitempty"` OrgID *int `json:"org_id,omitempty"` Content *string `json:"content,omitempty"` }
BaseNoteObject represents a basic pipedrive note
type BasePersonObject ¶
type BasePersonObject struct { // Unsettable Fields ID int `json:"id,omitempty" force:"id,omitempty"` // Settable Fields Name *string `json:"name,omitempty"` // Required FirstName *string `json:"first_name,omitempty"` // Optional LastName *string `json:"last_name,omitempty"` // Optional Phone []*Phone `json:"phone,omitempty"` Email []*Email `json:"email,omitempty"` OrgID *OrgID `json:"org_id,omitempty"` }
BasePersonObject represents a basic pipedrive person
type BaseResponse ¶
type BaseResponse struct { Success bool `json:"success,omitempty"` Data interface{} `json:"data,omitempty"` Error string `json:"error,omitempty"` ErrorInfo string `json:"error_info,omitempty"` AdditionalData AdditionalData `json:"additional_data,omitempty"` RelatedObjects interface{} `json:"related_objects,omitempty"` }
BaseResponse is the base response model
func (*BaseResponse) ErrorString ¶
func (b *BaseResponse) ErrorString() string
func (*BaseResponse) Successful ¶
func (b *BaseResponse) Successful() bool
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the public Pipedrive API, but can be // set to a domain endpoint to use. BaseURL should // always be specified with a trailing slash. BaseURL *url.URL // contains filtered or unexported fields }
func (*Client) CreateActivity ¶
CreateActivity creates an activity . Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Activities/post_activities
func (*Client) CreateDeal ¶
CreateDeal creates a deal. Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals/post_deals
func (*Client) CreateNote ¶
CreateNote creates a note.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Notes/get_notes_id
func (*Client) CreatePerson ¶
CreatePerson create a new person.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/post_persons
func (*Client) DeleteDeal ¶
DeleteDeal deletes a deal.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals/delete_deals_id
func (*Client) DeleteDeals ¶
DeleteDeals deletes deals in bulk.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals/delete_deals
func (*Client) DeleteNote ¶
DeleteNote marks note as deleted.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Notes/delete_notes_id
func (*Client) DeletePerson ¶
DeletePerson marks person as deleted.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/delete_persons_id
func (*Client) DeletePersons ¶
DeletePersons marks multiple persons as deleted.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/delete_persons
func (*Client) Do ¶
Do sends an API request and returns the API response. T
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.
func (*Client) GetNote ¶
GetNote returns a specific note by id.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Notes/get_notes_id
func (*Client) GetPerson ¶
GetPerson returns a person by their id
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/get_persons_id
func (*Client) ListDeals ¶
func (c *Client) ListDeals(ctx context.Context, personID int, opt *ListDealOptions, out ResponseModel) error
ListDeals lists deals belonging to a person
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/get_persons_id_deals
func (*Client) NewRequest ¶
func (*Client) SearchDeals ¶
func (c *Client) SearchDeals(ctx context.Context, opt *SearchDealsOptions) (*SearchDealsResponse, error)
SearchDeals searches all deals
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals/get_deals_search
func (*Client) SearchItemFields ¶
func (c *Client) SearchItemFields(ctx context.Context, opt *SearchItemFieldsOptions, out ResponseModel) error
SearchItemFields searches an object by a specific field Pipedrive API https://developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch_field
func (*Client) SearchPersons ¶
func (c *Client) SearchPersons(ctx context.Context, opt *SearchPersonsOptions) (*SearchPersonsResponse, error)
SearchPersons Searches all persons
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/get_persons_search
func (*Client) UpdateDeal ¶
UpdateDeal updates a deal. Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals/put_deals_id
func (*Client) UpdateNote ¶
UpdateNote updates a specific note.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Notes/put_notes_id
func (*Client) UpdatePerson ¶
UpdatePerson update a specific person.
Pipedrive API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons/put_persons_id
type DealItem ¶
type DealItem struct { Deal SearchResultDeal `json:"item,omitempty"` ResultScore float64 `json:"result_score,omitempty"` }
DealItem contains a SearchResultDeal
type DealItems ¶
type DealItems struct {
Items []DealItem `json:"items,omitempty"`
}
DealItems contains a list of DealItem
type DealProbability ¶
type DealProbability uint8
Deal probability
const ( DealProbabilityEnabled DealProbability = 1 DealProbabilityDisabled DealProbability = 0 )
type DealStatus ¶
type DealStatus string
type DeleteMultipleOptions ¶
type DeleteMultipleOptions struct {
Ids string `url:"ids,omitempty"`
}
type Email ¶
type Email struct { Label string `json:"label"` Value string `json:"value"` Primary bool `json:"primary"` }
Email field struct
type ErrorFields ¶
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Message ResponseError `json:"error"` }
ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type EventAction ¶
type EventAction string
Type of actions.
const ( ACTION_ADDED EventAction = "added" ACTION_UPDATED EventAction = "updated" ACTION_MERGED EventAction = "merged" ACTION_DELETED EventAction = "deleted" ACTION_ALL EventAction = "all" )
type EventObject ¶
type EventObject string
Type of objects.
const ( OBJECT_ACTIVITY EventObject = "activity" OBJECT_ACTIVTIY_TYPE EventObject = "activity_type" OBJECT_DEAL EventObject = "deal" OBJECT_NOTE EventObject = "note" OBJECT_ORGANIZATION EventObject = "organization" OBJECT_PERSON EventObject = "person" OBJECT_PIPELINE EventObject = "pipeline" OBJECT_PRODUCT EventObject = "product" OBJECT_STAGE EventObject = "stage" OBJECT_USER EventObject = "user" OBJECT_ALL_ EventObject = "*" )
type FieldType ¶
type FieldType string
Field types
const ( FieldTypeVarchar FieldType = "varchar" FieldTypeVarcharAuto FieldType = "varchar_auto" FieldTypeText FieldType = "text" FieldTypeDouble FieldType = "double" FieldTypeMonetary FieldType = "monetary" FieldTypeDate FieldType = "date" FieldTypeSet FieldType = "set" FieldTypeEnum FieldType = "enum" FieldTypeUser FieldType = "user" FieldTypeOrg FieldType = "org" FieldTypePeople FieldType = "people" FieldTypePhone FieldType = "phone" FieldTypeTime FieldType = "time" FieldTypeTimerange FieldType = "timerange" FieldTypeDaterange FieldType = "daterange" )
type ListDealOptions ¶
type ListDealOptions struct { Status *string `url:"status,omitempty"` // Only fetch deals with specific status. If omitted, all not deleted deals are fetched Start *int `url:"start,omitempty"` // Pagination start Limit *int `url:"limit,omitempty"` // Items shown per page Sort *string `url:"sort,omitempty"` // Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys) }
ListDealOptions is used to configure a list deals request. PersonID is required
type OrgID ¶
type OrgID struct { // Settable Fields ID int `json:"value,omitempty"` // Unsettable Fields OwnerID int `json:"owner_id,omitempty"` Name string `json:"name,omitempty"` PeopleCount int `json:"people_count,omitempty"` Address string `json:"address,omitempty"` IsActive bool `json:"active_flag,omitempty"` CCEmail string `json:"cc_email,omitempty"` }
func (*OrgID) MarshalJSON ¶
MarshalJSON is a Marshalling override
type Pagination ¶
type Person ¶
type Person interface { }
Person represents a Pipedrive person. Should embed BasePersonObject
type PersonID ¶
type PersonID struct { // Settable Fields ID int `json:"value,omitempty"` // Unsettable Fields Name string `json:"name,omitempty"` Email []*Email `json:"email,omitempty"` Phone []*Phone `json:"phone,omitempty"` IsActive bool `json:"active_flag,omitempty"` }
func (*PersonID) MarshalJSON ¶
MarshalJSON is a Marshalling override
type PersonItem ¶
type PersonItem struct { Person SearchResultPerson `json:"item,omitempty"` ResultScore float64 `json:"result_score,omitempty"` }
PersonItem contains a SearchResultPerson
type PersonItems ¶
type PersonItems struct {
Items []PersonItem `json:"items,omitempty"`
}
PersonItems contains a list of PersonItem
type Phone ¶
type Phone struct { Label string `json:"label"` Value string `json:"value"` Primary bool `json:"primary"` }
Phone field struct
type Rate ¶
type RateLimitError ¶
RateLimitError occurs when Pipedrive returns 403 Forbidden response with a rate limit remaining value of 0.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type ResponseError ¶
type ResponseError string
ResponseError sometimes error is a custom struct instead of string TODO: expand on different error handling
func (*ResponseError) UnmarshalJSON ¶
func (e *ResponseError) UnmarshalJSON(b []byte) error
type ResponseModel ¶
ResponseModel is the response model Should use the BaseResponse with expected struct as BaseResponse.Data.
type SearchDealField ¶
type SearchDealField string
type SearchDealsOptions ¶
type SearchDealsOptions struct { Term string `url:"term"` // The search term to look for. Minimum 2 characters (or 1 if using exact_match). (REQUIRED) Fields *SearchDealField `url:"fields,omitempty"` // A comma-separated string array. The fields to perform the search from. Defaults to all of them. ExactMatch *bool `url:"exact_match,omitempty"` // When enabled, only full exact matches against the given term are returned. It is not case sensitive. PersonID *int `url:"person_id,omitempty"` // Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000. OrganizationID *int `url:"organization_id,omitempty"` // Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000. // IncludeFields *string `url:"include_fields,omitempty"` // Supports including optional fields in the results which are not provided by default. Start *int `url:"start,omitempty"` // Pagination start. Limit *int `url:"limit,omitempty"` // Items shown per page }
SearchDealsOptions is used to configure a search request. Term is required
type SearchDealsResponse ¶
type SearchDealsResponse struct { Success bool `json:"success,omitempty"` Data DealItems `json:"data,omitempty"` Error string `json:"error,omitempty"` ErrorInfo string `json:"error_info,omitempty"` }
SearchDealsResponse is used to model the search person response
type SearchItemFieldType ¶
type SearchItemFieldType string
const ( SearchItemFieldTypeDeal SearchItemFieldType = "dealField" SearchItemFieldTypePerson SearchItemFieldType = "personField" SearchItemFieldTypeOrganization SearchItemFieldType = "organizationField" SearchItemFieldTypeProduct SearchItemFieldType = "productField" )
type SearchItemFieldsOptions ¶
type SearchItemFieldsOptions struct { Term string `url:"term"` // The search term to look for. Minimum 2 characters (or 1 if using exact_match). FieldType SearchItemFieldType `url:"field_type,omitempty"` // The type of the field to perform the search from ExactMatch *bool `url:"exact_match,omitempty"` // When enabled, only full exact matches against the given term are returned. The search is case sensitive. FieldKey string `url:"field_key"` // The key of the field to search from. The field key can be obtained by fetching the list of the fields using any of the fields' API GET methods (dealFields, personFields, etc.). ReturnItemIDs *bool `url:"return_item_ids,omitempty"` // Whether to return the IDs of the matching items or not. When not set or set to 0 or false, only distinct values of the searched field are returned. When set to 1 or true, the ID of each found item is returned. Start *int `url:"start,omitempty"` // Pagination start. Limit *int `url:"limit,omitempty"` // Items shown per page }
SearchItemFieldsOptions is used to configure a search request. Term, FieldType and FieldKey is required
type SearchPersonField ¶
type SearchPersonField string
const ( SearchPersonCustomFields SearchPersonField = "custom_fields" SearchPersonEmail SearchPersonField = "email" SearchPersonNotes SearchPersonField = "notes" SearchPersonPhone SearchPersonField = "phone" SearchPersonName SearchPersonField = "name" )
type SearchPersonsOptions ¶
type SearchPersonsOptions struct { Term string `url:"term"` // The search term to look for. Minimum 2 characters (or 1 if using exact_match). (REQUIRED) Fields *SearchPersonField `url:"fields,omitempty"` // A comma-separated string array. The fields to perform the search from. Defaults to all of them. ExactMatch *bool `url:"exact_match,omitempty"` // When enabled, only full exact matches against the given term are returned. It is not case sensitive. OrganizationID *int `url:"organization_id,omitempty"` // Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000. // IncludeFields *string `url:"include_fields,omitempty"` // Supports including optional fields in the results which are not provided by default. Start *int `url:"start,omitempty"` // Pagination start. Limit *int `url:"limit,omitempty"` // Items shown per page }
SearchPersonsOptions is used to configure a search request. Term is required
type SearchPersonsResponse ¶
type SearchPersonsResponse struct { Success bool `json:"success,omitempty"` Data PersonItems `json:"data,omitempty"` Error string `json:"error,omitempty"` ErrorInfo string `json:"error_info,omitempty"` }
SearchPersonsResponse is used to model the search person response
type SearchResultDeal ¶
type SearchResultDeal struct { ID int `json:"id,omitempty"` Type string `json:"type,omitempty"` Title string `json:"title,omitempty"` Value *float64 `json:"value,omitempty"` Status string `json:"status,omitempty"` Stage SearchResultDealStage `json:"stage,omitempty"` Person SearchResultDealPerson `json:"person,omitempty"` }
SearchResultDeal is the model of a person from the search person response
type SearchResultDealPerson ¶
type SearchResultDealPerson struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` }
SearchResultDealPerson struct
type SearchResultDealStage ¶
type SearchResultDealStage struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` }
SearchResultDealStage struct
type SearchResultPerson ¶
type SearchResultPerson struct { ID int `json:"id,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Phone []string `json:"phone,omitempty"` Email []string `json:"email,omitempty"` }
SearchResultPerson is the model of a person from the search person response
type Timestamp ¶
func (Timestamp) FormatFull ¶
type UserID ¶
type UserID struct { // Settable Fields ID int `json:"id,omitempty"` IDValue int `json:"value,omitempty"` // Unsettable Fields Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` IsActive bool `json:"active_flag,omitempty"` }
func (*UserID) MarshalJSON ¶
MarshalJSON is a Marshalling override