api

package
v0.0.0-...-7f00f21 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// firestore collection
	Users     = "users"
	Accounts  = "accounts"
	Rules     = "rules"
	Posts     = "posts"
	Schedules = "schedules"

	// bind key for map
	RTOKEN       = "request_token"
	RTOKENSECRET = "request_token_secret"

	ACCESSTOKEN       = "access_token"
	ACCESSTOKENSECRET = "access_token_secret"
)

Variables

This section is empty.

Functions

func GetMe

func GetMe(accesstoken, secret string) (userid string, err error)

func Routers

func Routers(e *echo.Echo)

Types

type Client

type Client struct {
	ProjectID  string
	GUIURL     string
	POSTAPIURL string

	Key         string
	Secret      string
	CallbackURL string

	PasswordController []byte

	CredentialFile string

	// SheetID @MasterFile
	SpreadID    string
	SheetUserID string
	SheetPostID string
	RangeKey    string

	Firestore *models.ClientForFirestore
}

func New

func New() *Client

func (*Client) Auth

func (p *Client) Auth(c echo.Context) error

func (*Client) Callback

func (p *Client) Callback(c echo.Context) error

Callback is a handler for the OAuth callback

func (*Client) CreatePost

func (p *Client) CreatePost(c echo.Context) error

CreatePost Postを新規作成 from form values

func (*Client) CreatePosts

func (p *Client) CreatePosts(c echo.Context) error

CreatePosts Postsを新規作成 query: spread_id

func (*Client) CreateScheduleForPost

func (p *Client) CreateScheduleForPost(c echo.Context) error

CreateScheduleForPost Postを新規作成 from form values

func (*Client) DeletePost

func (p *Client) DeletePost(c echo.Context) error

DeletePost Postを削除

func (*Client) DeleteScheduleForPost

func (p *Client) DeleteScheduleForPost(c echo.Context) error

DeleteScheduleForPost Postを削除

func (*Client) GetAccount

func (p *Client) GetAccount(c echo.Context) error

func (*Client) GetAccounts

func (p *Client) GetAccounts(c echo.Context) error

GetAccounts 現在時刻に合致したアカウントを取得

func (*Client) GetPost

func (p *Client) GetPost(c echo.Context) error

GetPost Postを取得 query: post_id

func (*Client) GetPosts

func (p *Client) GetPosts(c echo.Context) error

GetPost Postを取得 query: token, username

func (*Client) GetScheduleForPost

func (p *Client) GetScheduleForPost(c echo.Context) error

GetScheduleForPost Postを取得 query: post_id

func (*Client) Health

func (p *Client) Health(c echo.Context) error

func (*Client) IsUserChecker

func (p *Client) IsUserChecker(ctx context.Context, token, username string) error

func (*Client) PostUpload

func (p *Client) PostUpload(c echo.Context) error

func (*Client) PutAccount

func (p *Client) PutAccount(c echo.Context) error

PutAccount アカウントを更新

func (*Client) PutAccountForAuth

func (p *Client) PutAccountForAuth(ctx context.Context, account models.Account) error

func (*Client) PutPost

func (p *Client) PutPost(c echo.Context) error

PutPost Postを更新 主にchecked, priorityの更新(削除除く)

func (*Client) PutRule

func (p *Client) PutRule(c echo.Context) error

PutRule ルールを更新

func (*Client) PutScheduleForPost

func (p *Client) PutScheduleForPost(c echo.Context) error

PutScheduleForPost Postを更新 主にchecked, priorityの更新(削除除く)

func (*Client) ReadSpreadsheetForPost

func (p *Client) ReadSpreadsheetForPost(id string) ([]models.Post, error)

func (*Client) Registor

func (p *Client) Registor(c echo.Context) error

Registor handles the form submission

1. フロントエンドからSpreadsheetIDを取得 2. セッションからアクセストークンを取得 3. 顧客のSpreadsheetIDの投稿データを読み込み 4. 顧客のSpreadsheetIDの投稿データ型式を確認 5. マスターファイルのユーザーデータを読み込み 6. 顧客SpreadsheetID及びTwitter/Xアカウントの重複チェックがマスターファイルにすでに存在しないかチェック 7. マスターファイルの投稿データを取得 8. マスターファイルの投稿データ末尾へ追記し更新

func (*Client) RequestForPost

func (p *Client) RequestForPost(v url.Values) error

func (*Client) ScheduleProcess

func (p *Client) ScheduleProcess(c echo.Context) error

ScheduleProcess handles the form submission 1. 現在時刻を取得 2. 指定時間が合致するアカウントを取得 3. アカウントに紐づく投稿データを取得 4. 投稿データを選別 5. 投稿処理をリクエスト(別インスタンス 6. 投稿データを更新

func (*Client) ToGCS

func (p *Client) ToGCS(c echo.Context) (string, error)

func (*Client) Usage

func (p *Client) Usage(c echo.Context) error

type Response

type Response struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

Jump to

Keyboard shortcuts

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