xomologisou

package module
v0.0.0-...-66a253c Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCarrier

func DeleteCarrier(db orm.DB, carrier *Carrier) error

func DeleteCarrierHashtag

func DeleteCarrierHashtag(db orm.DB, CarrierHashtag *CarrierHashtag) error

func DeleteCarrierPlan

func DeleteCarrierPlan(db orm.DB, CarrierPlan *CarrierPlan) error

func DeleteReport

func DeleteReport(db orm.DB, Report *Report) error

func DeleteRequest

func DeleteRequest(db orm.DB, Request *Request) error

func InsertCarrier

func InsertCarrier(db orm.DB, carrier *Carrier) error

func InsertCarrierHashtag

func InsertCarrierHashtag(db orm.DB, CarrierHashtag *CarrierHashtag) error

func InsertCarrierPlan

func InsertCarrierPlan(db orm.DB, CarrierPlan *CarrierPlan) error

func InsertPublishable

func InsertPublishable(db orm.DB, publishable *Publishable) error

func InsertReport

func InsertReport(db orm.DB, Report *Report) error

func InsertRequest

func InsertRequest(db orm.DB, Request *Request) error

func RandomId

func RandomId(len int) string

func SaveCarrier

func SaveCarrier(db orm.DB, carrier *Carrier) error

func SaveCarrierHashtag

func SaveCarrierHashtag(db orm.DB, CarrierHashtag *CarrierHashtag) error

func SaveCarrierPlan

func SaveCarrierPlan(db orm.DB, CarrierPlan *CarrierPlan) error

func SavePublishable

func SavePublishable(db orm.DB, publishable *Publishable) error

func SaveReport

func SaveReport(db orm.DB, Report *Report) error

func SaveRequest

func SaveRequest(db orm.DB, Request *Request) error

Types

type ArchivedPublishable

type ArchivedPublishable struct {
	Publishable
	ArchivedAt time.Time
}

func ArchivePublishable

func ArchivePublishable(db *pg.DB, p *Publishable) (*ArchivedPublishable, error)

type Carrier

type Carrier struct {
	Id   string `sql:",pk"`
	Name string

	Suspended bool `json:"suspended"`

	FacebookPage string               `json:"facebook_page"`
	FacebookInfo *CarrierFacebookInfo `json:"facebook_info"`
	Form         *CarrierForm         `json:"form"`
	Posting      *CarrierPosting      `json:"posting"`

	Statistics map[string]interface{} `json:"statistics"`
}

func FindCarrier

func FindCarrier(db orm.DB, id string) (*Carrier, error)

func FindCarrierByFacebookPage

func FindCarrierByFacebookPage(db orm.DB, page string) (*Carrier, error)

func FindCarriers

func FindCarriers(db orm.DB) ([]*Carrier, error)

func FindFrondCarriers

func FindFrondCarriers(db orm.DB) ([]*Carrier, error)

func (*Carrier) NextHashtag

func (c *Carrier) NextHashtag() string

type CarrierFacebookInfo

type CarrierFacebookInfo struct {
	PageName  string
	UserName  string
	UserToken *oauth2.Token
	PageToken *oauth2.Token
	HasToken  bool
}

type CarrierForm

type CarrierForm struct {
	Enabled bool `json:"enabled"`

	Title    string `json:"title"`
	Subtitle string `json:"subtitle"`
	Terms    string `json:"terms"`

	SecretPrompt  string `json:"secret_prompt"`
	ImagePrompt   string `json:"image_prompt"`
	SentMessage   string `json:"sent_message"`
	BackgroundUrl string `json:"background_url"`

	Dark         bool   `json:"dark"`
	AcceptsImage bool   `json:"accepts_image"`
	CustomCss    string `json:"custom_css"`

	OptionSets map[string]CarrierOptions `json:"option_sets"`
}

type CarrierHashtag

type CarrierHashtag struct {
	Carrier   string `json:"carrier"`
	Hashtag   string `json:"hashtag" sql:",pk"`
	MinNumber int    `json:"min_number"`
}

func FindCarrierHashtag

func FindCarrierHashtag(db orm.DB, carrier, hashtag string) (*CarrierHashtag, error)

type CarrierOptions

type CarrierOptions struct {
	Name        string            `json:"name"`
	Options     map[string]string `json:"options"`
	AllowCustom bool              `json:"allow_custom"`
}

type CarrierPlan

type CarrierPlan struct {
	Id      string      `json:"id"`
	Carrier string      `json:"carrier"`
	Type    PaymentType `json:"type"`

	ExpiresAt      time.Time `json:"expires_at"`
	QuotaReset     time.Time `json:"quota_reset"`
	QuotaTotal     int       `json:"quota_total"`
	QuotaAvailable int       `json:"quota_available"`
}

func FindCarrierPlan

func FindCarrierPlan(db orm.DB, id string) (*CarrierPlan, error)

func FindCarrierPlanByCarrier

func FindCarrierPlanByCarrier(db orm.DB, carrier string) (*CarrierPlan, error)

type CarrierPosting

type CarrierPosting struct {
	Format  string `json:"format"`
	Hashtag string `json:"hashtag"`
	Id      int    `json:"id"`
}

type PaymentType

type PaymentType int
const (
	PaymentFree PaymentType = iota
)

type Publishable

type Publishable struct {
	Carrier string `json:"carrier"`
	Id      string `json:"id" sql:",pk"`

	//Who created the post
	Source int `json:"source" sql:",notnull"`
	//The parent post ID
	Parent string `json:"parent"`
	//Disables custom formatting
	DisableFormat bool `json:"disable_format"`

	Status            PublishableStatus `json:"status" sql:",notnull"`
	StatusDescription string            `json:"status_description,omitempty"`

	//Source data
	PublishableSource

	QueuedTime  time.Time `json:"queued_time,omitempty"`
	PublishTime time.Time `json:"publish_time,omitempty"`
	Publisher   string    `json:"publisher,omitempty"`
	PublishTag  string    `json:"publish_tag,omitempty"`

	//Facebook post details
	FacebookPost string `json:"facebook_post,omitempty"`

	ChecksData []PublishableSource `json:"checks_data,omitempty"`

	Content         string `json:"content"`
	OriginalContent string `json:"original_content"`

	ImageId    string                 `json:"image_id,omitempty"`
	Options    map[string]string      `json:"options,omitempty"`
	Statistics map[string]interface{} `json:"statistics,omitempty"`

	FinalForm  string `json:"final_form" sql:"-"`
	Properties string `json:"properties" sql:"-"`
}

func FindPublishable

func FindPublishable(db orm.DB, id string) (*Publishable, error)

func FindPublishableByHashtag

func FindPublishableByHashtag(db orm.DB, hashtag string) (*Publishable, error)

func (*Publishable) BuildFormats

func (p *Publishable) BuildFormats(c *Carrier, similar int)

func (*Publishable) IsChild

func (p *Publishable) IsChild() bool

func (*Publishable) NoFormat

func (p *Publishable) NoFormat(carrier *Carrier) bool

type PublishableError

type PublishableError int
const (
	PublishableErrorNoQuota PublishableError = iota
)

func (PublishableError) Error

func (p PublishableError) Error() string

type PublishableSource

type PublishableSource struct {
	Timestamp time.Time `json:"timestamp,omitempty"`

	IpAddress string `json:"ip_address,omitempty"`

	Hostname      string `json:"hostname,omitempty"`
	ShortHostname string `json:"short_hostname,omitempty"`
	Country       string `json:"country,omitempty"`

	UserAgent string `json:"user_agent,omitempty"`
}

func (*PublishableSource) ClearSensitiveData

func (p *PublishableSource) ClearSensitiveData()

type PublishableStatus

type PublishableStatus int
const (
	PublishableSent PublishableStatus = iota
	PublishableQueued
	PublishablePublishing
	PublishablePublished
	PublishableDeleted
	PublishableDeclined
	PublishableHidden
	PublishableRemovedFB
	PublishableFailed
	PublishablePublishedManually
)

type Report

type Report struct {
	Id string `json:"id" sql:",pk"`

	ReportedId    string `json:"reported_id"`
	ReporterEmail string `json:"reporter_email"`

	ReportedCarrier string       `json:"reported_carrier"`
	ReportedSecret  string       `json:"reported_secret"`
	Reason          ReportReason `json:"reason"`
	Description     string       `json:"description"`

	Timestamp time.Time `json:"timestamp"`

	Status   ReportStatus `json:"status"`
	Resolver string       `json:"resolver"`
}

func FindReport

func FindReport(db orm.DB, id string) (*Report, error)

type ReportReason

type ReportReason int
const (
	ReportDefamation ReportReason = iota
	ReportSuicide
	ReportOffensive
	ReportSexism
	ReportExtremism
	ReportOther
)

type ReportStatus

type ReportStatus int
const (
	ReportSubmitted ReportStatus = iota
	ReportRevoked
	ReportAccepted
	ReportRejected
	ReportCompleted
	ReportElevated
)

type Request

type Request struct {
	Id string `json:"id" sql:",pk"`

	Status RequestStatus `json:"status"`
}

func FindRequest

func FindRequest(db orm.DB, id string) (*Request, error)

type RequestStatus

type RequestStatus int
const (
	RequestSubmitted RequestStatus = iota
	RequestRevoked
	RequestAccepted
	RequestRejected
)

Jump to

Keyboard shortcuts

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