export

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 6 Imported by: 0

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

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.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/canceldataexport

func (*DataService) CancelRaw

func (s *DataService) CancelRaw(ctx context.Context, jobID string) (*api.Result, error)

CancelRaw cancels an in-progress data export job and returns the full HTTP result.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/canceldataexport

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.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/createdataexport

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.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/createdataexport

func (*DataService) Download

func (s *DataService) Download(ctx context.Context, jobID string, w io.Writer) error

Download writes the exported data to w. The data is typically gzipped CSV. Unlike other methods, Download streams binary data rather than decoding JSON.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/data-export/downloaddataexport

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

func (s *DataService) GetStatusRaw(ctx context.Context, jobID string) (*api.Result, error)

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

type DatasetsResponse struct {
	Type string    `json:"type"`
	Data []Dataset `json:"data"`
}

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

func ParseEnqueueResult(r *api.Result) (*Job, error)

ParseEnqueueResult decodes a Result into a Job.

func ParseGetStatusResult

func ParseGetStatusResult(r *api.Result) (*Job, error)

ParseGetStatusResult 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

func (s *ReportingService) Download(ctx context.Context, jobIdentifier string, w io.Writer) error

Download writes the reporting export data to w. The data is typically CSV.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/downloadreportingdataexport

func (*ReportingService) Enqueue

func (s *ReportingService) Enqueue(ctx context.Context, body *EnqueueRequest) (*Job, error)

Enqueue starts a new reporting data export job.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/enqueuereportingdataexport

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.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/enqueuereportingdataexport

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

func (s *ReportingService) GetDatasetsRaw(ctx context.Context) (*api.Result, error)

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) GetStatus

func (s *ReportingService) GetStatus(ctx context.Context, jobIdentifier string) (*Job, error)

GetStatus retrieves the status of a reporting data export job.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/getreportingdataexport

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.

See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/export/getreportingdataexport

Jump to

Keyboard shortcuts

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