Documentation
¶
Overview ¶
Package export provides services for Intercom data exports.
DataService manages bulk data export jobs for downloading workspace data. ReportingService handles reporting export jobs and CSV downloads.
Index ¶
- type CreateRequest
- type DataExport
- type DataService
- func (s *DataService) Cancel(ctx context.Context, jobID string) (*DataExport, error)
- func (s *DataService) CancelRaw(ctx context.Context, jobID string) (*api.Result, error)
- func (s *DataService) Create(ctx context.Context, body *CreateRequest) (*DataExport, error)
- func (s *DataService) CreateRaw(ctx context.Context, body *CreateRequest) (*api.Result, error)
- func (s *DataService) Download(ctx context.Context, jobID string, w io.Writer) error
- func (s *DataService) GetStatus(ctx context.Context, jobID string) (*DataExport, error)
- func (s *DataService) GetStatusRaw(ctx context.Context, jobID string) (*api.Result, error)
- type Dataset
- type DatasetAttribute
- type DatasetsResponse
- type EnqueueRequest
- type Job
- type ReportingService
- func (s *ReportingService) Download(ctx context.Context, jobIdentifier string, w io.Writer) error
- func (s *ReportingService) Enqueue(ctx context.Context, body *EnqueueRequest) (*Job, error)
- func (s *ReportingService) EnqueueRaw(ctx context.Context, body *EnqueueRequest) (*api.Result, error)
- func (s *ReportingService) GetDatasets(ctx context.Context) ([]Dataset, error)
- func (s *ReportingService) GetDatasetsRaw(ctx context.Context) (*api.Result, error)
- func (s *ReportingService) GetStatus(ctx context.Context, jobIdentifier string) (*Job, error)
- func (s *ReportingService) GetStatusRaw(ctx context.Context, jobIdentifier string) (*api.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
CreatedAtAfter int64 `json:"created_at_after"`
CreatedAtBefore int64 `json:"created_at_before"`
}
CreateRequest represents the request body for creating a data export.
type DataExport ¶
type DataExport struct {
JobIdentifier string `json:"job_identifier"`
Status string `json:"status"`
DownloadURL string `json:"download_url"`
DownloadExpiresAt string `json:"download_expires_at"`
}
DataExport represents an Intercom content data export job.
func ParseCancelResult ¶
func ParseCancelResult(r *api.Result) (*DataExport, error)
ParseCancelResult decodes a Result into a DataExport.
func ParseCreateResult ¶
func ParseCreateResult(r *api.Result) (*DataExport, error)
ParseCreateResult decodes a Result into a DataExport.
func ParseDataGetStatusResult ¶
func ParseDataGetStatusResult(r *api.Result) (*DataExport, error)
ParseDataGetStatusResult decodes a Result into a DataExport.
type DataService ¶
type DataService struct {
// contains filtered or unexported fields
}
DataService handles communication with the data export related methods of the Intercom API.
func NewDataService ¶
func NewDataService(c api.Caller) *DataService
NewDataService creates a new data export Service.
func (*DataService) Cancel ¶
func (s *DataService) Cancel(ctx context.Context, jobID string) (*DataExport, error)
Cancel cancels an in-progress data export job.
func (*DataService) CancelRaw ¶
CancelRaw cancels an in-progress data export job and returns the full HTTP result.
func (*DataService) Create ¶
func (s *DataService) Create(ctx context.Context, body *CreateRequest) (*DataExport, error)
Create starts a new content data export job for the given time range.
func (*DataService) CreateRaw ¶
func (s *DataService) CreateRaw(ctx context.Context, body *CreateRequest) (*api.Result, error)
CreateRaw starts a new content data export job and returns the full HTTP result.
func (*DataService) Download ¶
Download writes the exported data to w. The data is typically gzipped CSV. Unlike other methods, Download streams binary data rather than decoding JSON.
func (*DataService) GetStatus ¶
func (s *DataService) GetStatus(ctx context.Context, jobID string) (*DataExport, error)
GetStatus retrieves the status of a data export job.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/getdataexport
func (*DataService) GetStatusRaw ¶
GetStatusRaw retrieves the status of a data export job with the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/getdataexport
type Dataset ¶
type Dataset struct {
ID string `json:"id"`
Name string `json:"name"`
Attributes []DatasetAttribute `json:"attributes"`
}
Dataset represents an available reporting dataset.
type DatasetAttribute ¶
type DatasetAttribute struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
}
DatasetAttribute represents an attribute within a reporting dataset.
type DatasetsResponse ¶
DatasetsResponse wraps the datasets list API response.
func ParseGetDatasetsResult ¶
func ParseGetDatasetsResult(r *api.Result) (*DatasetsResponse, error)
ParseGetDatasetsResult decodes a Result into a DatasetsResponse.
type EnqueueRequest ¶
type EnqueueRequest struct {
DatasetID string `json:"dataset_id"`
AttributeIDs []string `json:"attribute_ids"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
}
EnqueueRequest represents the request body for enqueueing a reporting data export job.
type Job ¶
type Job struct {
JobIdentifier string `json:"job_identifier"`
Status string `json:"status"`
DownloadURL string `json:"download_url"`
DownloadExpiresAt string `json:"download_expires_at"`
}
Job represents a reporting data export job.
func ParseEnqueueResult ¶
ParseEnqueueResult decodes a Result into a Job.
type ReportingService ¶
type ReportingService struct {
// contains filtered or unexported fields
}
ReportingService handles communication with the reporting data export related methods of the Intercom API.
func NewReportingService ¶
func NewReportingService(c api.Caller) *ReportingService
NewReportingService creates a new export reporting Service.
func (*ReportingService) Download ¶
Download writes the reporting export data to w. The data is typically CSV.
func (*ReportingService) Enqueue ¶
func (s *ReportingService) Enqueue(ctx context.Context, body *EnqueueRequest) (*Job, error)
Enqueue starts a new reporting data export job.
func (*ReportingService) EnqueueRaw ¶
func (s *ReportingService) EnqueueRaw(ctx context.Context, body *EnqueueRequest) (*api.Result, error)
EnqueueRaw starts a new reporting data export job and returns the full HTTP result.
func (*ReportingService) GetDatasets ¶
func (s *ReportingService) GetDatasets(ctx context.Context) ([]Dataset, error)
GetDatasets returns the list of available reporting datasets and their attributes.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/getreportingdatasets
func (*ReportingService) GetDatasetsRaw ¶
GetDatasetsRaw returns the list of available reporting datasets with the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/getreportingdatasets
func (*ReportingService) GetStatusRaw ¶
func (s *ReportingService) GetStatusRaw(ctx context.Context, jobIdentifier string) (*api.Result, error)
GetStatusRaw retrieves the status of a reporting data export job with the full HTTP result.