api

package
v0.0.0-...-acaaaf6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReportExporter

func NewReportExporter(exportPath string, reportCfg *ReportExporterCfg) (*feed.ReportExporter, error)

NewReportExporter returns a new instance of ReportExporter

Types

type AppVersion

type AppVersion struct {
	IntegrationID      string
	IntegrationVersion string
}

AppVersion used to store the version and ID

type ConfigurationManager

type ConfigurationManager struct {
	Configuration *ExporterConfiguration
	// contains filtered or unexported fields
}

ConfigurationManager wrapper for configuration and fileName

func NewConfigurationManager

func NewConfigurationManager(path string, fileName string) *ConfigurationManager

NewConfigurationManager will create a ConfigurationManager with default data,

func NewConfigurationManagerFromFile

func NewConfigurationManagerFromFile(path string, fileName string) (*ConfigurationManager, error)

NewConfigurationManagerFromFile will create a ConfigurationManager with data from the specified file

func (*ConfigurationManager) ApplySafetyGuards

func (c *ConfigurationManager) ApplySafetyGuards()

ApplySafetyGuards will adjust certain values to acceptable maximum values

func (*ConfigurationManager) SaveConfiguration

func (c *ConfigurationManager) SaveConfiguration() error

SaveConfiguration will save the configuration to the file

type ExportStatusResponse

type ExportStatusResponse struct {
	ExportStarted   bool                       `json:"export_started"`
	ExportCompleted bool                       `json:"export_completed"`
	Feeds           []ExportStatusResponseItem `json:"feeds"`
}

type ExportStatusResponseItem

type ExportStatusResponseItem struct {
	FeedName           string `json:"feed_name"`
	Counter            int64  `json:"counter"`
	CounterDecremental bool   `json:"counter_decremental"`
	StatusMessage      string `json:"status_message"`
	Started            bool   `json:"started"`
	Finished           bool   `json:"finished"`
	Stage              string `json:"stage"`
	HasError           bool   `json:"has_error"`
	DurationMs         int64  `json:"duration_ms"`
}

ExportStatusResponseItem representation of Feed Export Status

type ExporterConfiguration

type ExporterConfiguration struct {
	AccessToken string `yaml:"access_token"`
	API         struct {
		ProxyURL       string `yaml:"proxy_url"`
		SheqsyURL      string `yaml:"sheqsy_url"`
		TLSCert        string `yaml:"tls_cert"`
		TLSSkipVerify  bool   `yaml:"tls_skip_verify"`
		URL            string `yaml:"url"`
		MaxConcurrency int    `yaml:"max_concurrency"`
	} `yaml:"api"`
	Csv struct {
		MaxRowsPerFile int `yaml:"max_rows_per_file"`
	} `yaml:"csv"`
	Db struct {
		ConnectionString    string `yaml:"connection_string"`
		Dialect             string `yaml:"dialect"`
		AutoMigrateDisabled bool   `yaml:"auto_migrate_disabled"`
	} `yaml:"db"`
	Export struct {
		Action struct {
			Limit int `yaml:"limit"`
		} `yaml:"action"`
		Asset struct {
			Limit int `yaml:"limit"`
		} `yaml:"asset"`
		Course struct {
			Progress struct {
				Limit            int    `yaml:"limit"`
				CompletionStatus string `yaml:"completion_status"`
			} `yaml:"progress"`
		} `yaml:"course"`
		Incremental bool `yaml:"incremental"`
		Inspection  struct {
			Archived              string   `yaml:"archived"`
			Completed             string   `yaml:"completed"`
			IncludedInactiveItems bool     `yaml:"included_inactive_items"`
			Limit                 int      `yaml:"limit"`
			SkipIds               []string `yaml:"skip_ids"`
			WebReportLink         string   `yaml:"web_report_link"`
		} `yaml:"inspection"`
		InspectionItems struct {
			SkipFields []string `yaml:"skip_fields"`
		} `yaml:"inspection_items"`
		Issue struct {
			Limit int `yaml:"limit"`
		} `yaml:"issue"`
		Media         bool   `yaml:"media"`
		MediaPath     string `yaml:"media_path"`
		ModifiedAfter mTime  `yaml:"modified_after"`
		TimeZone      string `yaml:"time_zone"`
		Path          string `yaml:"path"`
		SchemaOnly    bool   `yaml:"-"`
		Site          struct {
			IncludeDeleted       bool `yaml:"include_deleted"`
			IncludeFullHierarchy bool `yaml:"include_full_hierarchy"`
		} `yaml:"site"`
		Schedule struct {
			ResumeDownload bool `yaml:"resume_download"`
		} `yaml:"schedule"`
		Tables      []string `yaml:"tables"`
		TemplateIds []string `yaml:"template_ids"`
	} `yaml:"export"`
	Report struct {
		FilenameConvention string   `yaml:"filename_convention"`
		Format             []string `yaml:"format"`
		PreferenceID       string   `yaml:"preference_id"`
		RetryTimeout       int      `yaml:"retry_timeout"`
	} `yaml:"report"`
	SheqsyCompanyID string `yaml:"sheqsy_company_id"`
	SheqsyPassword  string `yaml:"sheqsy_password"`
	SheqsyUsername  string `yaml:"sheqsy_username"`
	Session         struct {
		ExportType string `yaml:"export_type"`
	} `yaml:"session"`
}

ExporterConfiguration is the equivalent struct of YAML

func BuildConfigurationWithDefaults

func BuildConfigurationWithDefaults() *ExporterConfiguration

BuildConfigurationWithDefaults will set up an initial configuration with default values

func (*ExporterConfiguration) ToApiConfig

func (ec *ExporterConfiguration) ToApiConfig() *HttpApiCfg

func (*ExporterConfiguration) ToExporterConfig

func (ec *ExporterConfiguration) ToExporterConfig() *feed.ExporterFeedCfg

func (*ExporterConfiguration) ToInspectionConfig

func (ec *ExporterConfiguration) ToInspectionConfig() *inspections.InspectionClientCfg

func (*ExporterConfiguration) ToReporterConfig

func (ec *ExporterConfiguration) ToReporterConfig() *ReportExporterCfg

type HttpApiCfg

type HttpApiCfg struct {
	// contains filtered or unexported fields
}

type ReportExporterCfg

type ReportExporterCfg struct {
	Format       []string
	PreferenceID string
	Filename     string
	RetryTimeout int
}

type SafetyCultureExporter

type SafetyCultureExporter struct {
	// contains filtered or unexported fields
}

func NewSafetyCultureExporter

func NewSafetyCultureExporter(cfg *ExporterConfiguration, version *AppVersion) (*SafetyCultureExporter, error)

NewSafetyCultureExporter builds a SafetyCultureExporter with clients inferred from own configuration

func (*SafetyCultureExporter) CancelExport

func (s *SafetyCultureExporter) CancelExport()

func (*SafetyCultureExporter) CheckDBConnection

func (s *SafetyCultureExporter) CheckDBConnection() error

func (*SafetyCultureExporter) CleanExportStatus

func (s *SafetyCultureExporter) CleanExportStatus()

CleanExportStatus will clean the status items. Used by the UI

func (*SafetyCultureExporter) GetExportStatus

func (s *SafetyCultureExporter) GetExportStatus() *ExportStatusResponse

GetExportStatus called by UI

func (*SafetyCultureExporter) GetTemplateList

func (s *SafetyCultureExporter) GetTemplateList() []TemplateResponseItem

func (*SafetyCultureExporter) RunCSV

func (s *SafetyCultureExporter) RunCSV() error

func (*SafetyCultureExporter) RunInspectionJSON

func (s *SafetyCultureExporter) RunInspectionJSON() error

func (*SafetyCultureExporter) RunInspectionReports

func (s *SafetyCultureExporter) RunInspectionReports() error

func (*SafetyCultureExporter) RunPrintSchema

func (s *SafetyCultureExporter) RunPrintSchema() error

func (*SafetyCultureExporter) RunSQL

func (s *SafetyCultureExporter) RunSQL() error

func (*SafetyCultureExporter) RunSQLite

func (s *SafetyCultureExporter) RunSQLite() error

RunSQLite - runs the export and will save into a local sqlite db file

func (*SafetyCultureExporter) SetApiClient

func (s *SafetyCultureExporter) SetApiClient(apiClient *httpapi.Client)

func (*SafetyCultureExporter) SetConfiguration

func (s *SafetyCultureExporter) SetConfiguration(cfg *ExporterConfiguration)

SetConfiguration will replace the configuration. Used by the UI to pass in the newly saved configuration

func (*SafetyCultureExporter) SetSheqsyApiClient

func (s *SafetyCultureExporter) SetSheqsyApiClient(apiClient *httpapi.Client)

type TemplateResponseItem

type TemplateResponseItem struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	ModifiedAt time.Time `json:"modified_at"`
}

TemplateResponseItem simple representation of a template date

Jump to

Keyboard shortcuts

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