rules

package
v0.0.0-...-17e3d52 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRulesRequest

type CreateRulesRequest struct {
	Add []*RuleValue `json:"add"`
}

CreateRulesRequest is a struct used to create the payload for creating rules.

type DataRule

type DataRule struct {
	Value string `json:"Value"`
	Tag   string `json:"Tag"`
	Id    string `json:"id"`
}

DataRule is what is returned as "Data" when adding or deleting a rule.

type DeleteRulesRequest

type DeleteRulesRequest struct {
	Delete struct {
		Ids []int `json:"ids"`
	} `json:"delete"`
}

DeleteRulesRequest is a struct used to create the payload for deleting rules.

func NewDeleteRulesRequest

func NewDeleteRulesRequest(ids ...int) DeleteRulesRequest

NewDeleteRulesRequest will create an instance of DeleteRulesRequest.

type ErrorRule

type ErrorRule struct {
	Value string `json:"Value"`
	Id    string `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

ErrorRule is what is returned as "Errors" when adding or deleting a rule.

type IRuleBuilder

type IRuleBuilder interface {
	AddRule(value string, tag string) *RuleBuilder
	Build() CreateRulesRequest
}

IRuleBuilder is an interface that describers how to implement a RuleBuilder.

type IRules

type IRules interface {
	Create(rules CreateRulesRequest, dryRun bool) (*TwitterRuleResponse, error)
	Delete(req DeleteRulesRequest, dryRun bool) (*TwitterRuleResponse, error)
	Get() (*TwitterRuleResponse, error)
}

IRules is the interface the rules struct implements.

func NewRules

func NewRules(httpClient httpclient.IHttpClient) IRules

NewRules creates a "rules" instance. This is used to create Twitter Filtered Stream rules. https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/build-a-rule.

type MetaRule

type MetaRule struct {
	Sent    string      `json:"sent"`
	Summary MetaSummary `json:"summary"`
}

MetaRule is what is returned as "Meta" when adding or deleting a rule.

type MetaSummary

type MetaSummary struct {
	Created    uint `json:"created"`
	NotCreated uint `json:"not_created"`
}

MetaSummary is what is returned as "Summary" in "Meta" when adding or deleting a rule.

type RuleBuilder

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

RuleBuilder is struct used to help create twitter stream rules.

func NewRuleBuilder

func NewRuleBuilder() *RuleBuilder

NewRuleBuilder will create an instance of `RuleBuilder`.

func (*RuleBuilder) AddRule

func (r *RuleBuilder) AddRule(value string, tag string) *RuleBuilder

AddRule will create a rule to be build for filtered-stream. Read more about rule limitations here https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/introduction.

func (*RuleBuilder) Build

func (r *RuleBuilder) Build() CreateRulesRequest

type RuleValue

type RuleValue struct {
	Value *string `json:"value,omitempty"`
	Tag   *string `json:"tag,omitempty"`
}

RuleValue is a struct used to help create twitter stream rules. It takes in a value and a tag.

type TwitterRuleResponse

type TwitterRuleResponse struct {
	Data   []DataRule
	Meta   MetaRule
	Errors []ErrorRule
}

TwitterRuleResponse is what is returned from twitter when adding or deleting a rule.

Jump to

Keyboard shortcuts

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