tcommons

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CWSettingsFileName = "copywriter.%s.json"

Variables

View Source
var TplSettings string

Functions

func GetSettingsFileName

func GetSettingsFileName(mode string) string

func NormalizeFileName

func NormalizeFileName(filename, mode string) string

Types

type CWHeader

type CWHeader struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

type CWSettings

type CWSettings struct {
	Lang          string                   `json:"lang"`
	Producers     *CWSettingsProducers     `json:"producers"`
	Publishing    *CWSettingsPublishing    `json:"publishing"`
	Scheduler     *CWSettingsScheduler     `json:"scheduler"`
	EditorialPlan *CWSettingsEditorialPlan `json:"editorial_plan"`
}

func InitSettings

func InitSettings(mode string, args ...interface{}) (settings *CWSettings, err error)

func (*CWSettings) LoadFromFile

func (instance *CWSettings) LoadFromFile(filename string) (err error)

func (*CWSettings) LoadFromJson

func (instance *CWSettings) LoadFromJson(text string) (err error)

func (*CWSettings) LoadFromMap

func (instance *CWSettings) LoadFromMap(m map[string]interface{}) (err error)

func (*CWSettings) Map

func (instance *CWSettings) Map() map[string]interface{}

func (*CWSettings) String

func (instance *CWSettings) String() string

type CWSettingsEditorialPlan

type CWSettingsEditorialPlan struct {
	Specials   []*CWSettingsEditorialPlanSpecial  `json:"specials"`
	Categories []*CWSettingsEditorialPlanCategory `json:"categories"`
	// contains filtered or unexported fields
}

func (*CWSettingsEditorialPlan) AutoClassify

func (instance *CWSettingsEditorialPlan) AutoClassify(text string, maxCount int) (response []*CWSettingsEditorialPlanCategory)

AutoClassify Classify a text searching into editorial plan categories

func (*CWSettingsEditorialPlan) BuildClassificationOptionsFromCategories

func (instance *CWSettingsEditorialPlan) BuildClassificationOptionsFromCategories(detectLanguage bool) (response *nlp_classifier.NlpClassificationOptions)

func (*CWSettingsEditorialPlan) GetCategoryByUID

func (instance *CWSettingsEditorialPlan) GetCategoryByUID(uid string) (response *CWSettingsEditorialPlanCategory)

func (*CWSettingsEditorialPlan) GetFirstCategory

func (instance *CWSettingsEditorialPlan) GetFirstCategory() (response *CWSettingsEditorialPlanCategory)

func (*CWSettingsEditorialPlan) GetNowSpecial

func (instance *CWSettingsEditorialPlan) GetNowSpecial() (special *CWSettingsEditorialPlanSpecial)

func (*CWSettingsEditorialPlan) ListAllCategories

func (instance *CWSettingsEditorialPlan) ListAllCategories() (response []*CWSettingsEditorialPlanCategory)

type CWSettingsEditorialPlanCategory

type CWSettingsEditorialPlanCategory struct {
	Uid                 string                             `json:"uid"`
	Name                string                             `json:"name"`
	Description         string                             `json:"description"`
	TextPrompt          *CWSettingsPrompt                  `json:"txt-prompt"`
	Hashtags            []string                           `json:"hashtags"`
	SeoEnabled          bool                               `json:"seo_enabled,omitempty"`
	ClassificationRules []string                           `json:"classification_rules,omitempty"` // use classification rules tu auto categorize a post to fit in plan
	Children            []*CWSettingsEditorialPlanCategory `json:"children,omitempty"`
}

func (*CWSettingsEditorialPlanCategory) Get

func (instance *CWSettingsEditorialPlanCategory) Get() (headers []*CWHeader)

func (*CWSettingsEditorialPlanCategory) GetRnd

func (instance *CWSettingsEditorialPlanCategory) GetRnd() (header *CWHeader)

type CWSettingsEditorialPlanSpecial

type CWSettingsEditorialPlanSpecial struct {
	Uid       string            `json:"uid"`
	Date      string            `json:"date"`
	Category  string            `json:"category"`
	TxtPrompt *CWSettingsPrompt `json:"txt-prompt"`
	Hashtags  []string          `json:"hashtags"`
}

func (*CWSettingsEditorialPlanSpecial) IsNow

func (instance *CWSettingsEditorialPlanSpecial) IsNow() bool

func (*CWSettingsEditorialPlanSpecial) String

func (instance *CWSettingsEditorialPlanSpecial) String() string

type CWSettingsProducers

type CWSettingsProducers struct {
	ProducerText  *CWSettingsPublishingProducerText  `json:"producer_text,omitempty"`
	ProducerImage *CWSettingsPublishingProducerImage `json:"producer_image,omitempty"`
	Localization  *CWSettingsPublishingLocalization  `json:"localization,omitempty"`
}

type CWSettingsPrompt

type CWSettingsPrompt struct {
	Title   string   `json:"title"`
	Content string   `json:"content"`
	Params  []string `json:"params"`
	Mode    string   `json:"mode"` // "all", "one
}

func (*CWSettingsPrompt) Get

func (instance *CWSettingsPrompt) Get() (headers []*CWHeader)

func (*CWSettingsPrompt) GetAll

func (instance *CWSettingsPrompt) GetAll() (headers []*CWHeader)

func (*CWSettingsPrompt) GetRnd

func (instance *CWSettingsPrompt) GetRnd() (header *CWHeader)

type CWSettingsPublishing

type CWSettingsPublishing struct {
	Targets []*CWSettingsPublishingTarget `json:"targets,omitempty"`
}

type CWSettingsPublishingLocalization

type CWSettingsPublishingLocalization struct {
	Languages []string `json:"langs"`
	Mode      string   `json:"mode"`      // ex: "multiple" or "" (publish one article for each lang)
	Separator string   `json:"separator"` // content separator for articles with a translation in same content
}

type CWSettingsPublishingProducerImage

type CWSettingsPublishingProducerImage struct {
	*commons.SettingsExternal
}

type CWSettingsPublishingProducerText

type CWSettingsPublishingProducerText struct {
	*commons.SettingsExternal
}

type CWSettingsPublishingTarget

type CWSettingsPublishingTarget struct {
	*commons.SettingsExternal
}

type CWSettingsScheduler

type CWSettingsScheduler struct {
	Timers *gg_scheduler.SchedulerSettings `json:"timers"`
}

Jump to

Keyboard shortcuts

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