Documentation ¶
Index ¶
Constants ¶
const (
// LibVersion used to be sent with User-Agent
LibVersion = "0.2beta"
)
Variables ¶
var ( // DelightedAPIKey for delighted. DelightedAPIKey string BaseURL string = "https://api.delighted.com/v1/%s" )
Functions ¶
func HandleResponse ¶
HandleResponse from delighted app.
Types ¶
type Client ¶
type Client struct { UserAgent string PersonService *PersonService SurveyService *SurveyService MetricService *MetricService // contains filtered or unexported fields }
Client handles communication between lib and delighted api.
type MetricResponse ¶
type MetricResponse struct { NPS int `json:"nps,omitempty"` PromoterCount int `json:"promoter_count,omitempty"` PromoterPercent int `json:"promoter_percent,omitemty"` PassiveCount int `json:"passive_count,omitempty"` PassivePercent int `json:"passive_percent,omitempty"` DectractorCount int `json:"detractor_count,omitempty"` DectractorPercent int `json:"detractor_percent,omitempty"` ResponseCount int `json:"response_count,omitempty"` }
MetricResponse payload from delighted
type MetricService ¶
type MetricService struct {
// contains filtered or unexported fields
}
MetricService struct
func (*MetricService) Get ¶
func (s *MetricService) Get(m *Metrics) (*MetricResponse, error)
Get metrics from delighted.
type Metrics ¶
type Metrics struct { Since int `url:"since,omitempty"` Until int `url:"until,omitempty"` Trend string `url:"trend,omitempty"` }
Metrics endpoint query options
type Person ¶
type Person struct { ID string `json:"id,omitempty"` Email string `json:"email"` Name string `json:"name,omitempty"` Delay int `json:"delay,omitempty"` Properties map[string]string `json:"properties,omitempty"` Send bool `json:"send,omitempty"` LastSentAt int `json:"last_sent_at,omitempty"` }
Person representation in golang.
type PersonService ¶
type PersonService struct {
// contains filtered or unexported fields
}
PeopleService struct
func (*PersonService) Create ¶
func (s *PersonService) Create(p *Person) (*Person, error)
Create a new person for a survey.
func (*PersonService) RemovePendingSurvey ¶
func (s *PersonService) RemovePendingSurvey(p *Person) (bool, error)
RemovePendingSurvey from a person who already has a pending survey
func (*PersonService) Unsubscribe ¶
func (s *PersonService) Unsubscribe(p *Person) (bool, error)
Unsubscribe a person from a survey, returns true of false if person was sucessfully Unsubscribed
type PersonSurveyResponse ¶
type PersonSurveyResponse struct {
Ok string `json:"ok,omitempty"`
}
PersonSurveyResponse from action against a person's survey
type PersonUnsubscribePayload ¶
type PersonUnsubscribePayload struct {
Email string `json:"person_email"`
}
PersonUnsubscribePayload for unsubscribing a person.
type Survey ¶
type Survey struct { ID string `json:"id"` PersonID int `json:"person"` Score int `json:"score"` Comment string `json:"comment,omitempty"` Permalink string `json:"permalink"` CreatedAt int `json:"created_at"` UpdatedAt int `json:"updated_at"` PersonProperties map[string]string `json:"person_properties,omitemtpy"` Notes []surveyNotes `json:"notes"` Tags []surveyTags `json:"tags"` }
Survey single representation of a survery comment in responses.
type SurveyResponses ¶
type SurveyResponses struct { PerPage int `url:"per_page,omitempty"` Page int `url:"page,omitempty"` Since int `url:"since,omitempty"` Until int `url:"until,omitempty"` UpdatedSince int `url:"updated_since,omitempty"` UpdatedUntil int `url:"updated_until,omitempty"` Trend string `url:"trend,omitempty"` PersonID string `url:"person_id,omitempty"` PersonEmail string `url:"person_email,omitempty"` // find response(s) by email }
SurveyResponses endpoint in delighted, allows you to set query options which is transformed into a query string.
type SurveyService ¶
type SurveyService struct {
// contains filtered or unexported fields
}
SurveyService struct
func (*SurveyService) GetAll ¶
func (s *SurveyService) GetAll(sr *SurveyResponses) (*[]Survey, error)
GetAll survey responses. Default limit is set to 20 per page.