crosspost

package
v0.0.0-...-21a94a4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope"`
}

type GetAccountResponse

type GetAccountResponse struct {
	ID string `json:"id"`
}

type MastodonCrossPost

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

func NewMastodonCrossPost

func NewMastodonCrossPost(mastodonURL, accountID, redirectURI, clientID, clientSecret, consumerKey, consumerSecret, accessToken, accessTokenSecret, twitterAuthorizeUrl, twitterOAuth2TokenUrl, twitterPostTweetUrl, twitterMediaUploadUrl string) *MastodonCrossPost

NewMastodonCrossPost creates a new MastodonCrossPost.

Example:

mastodonCrossPost := NewMastodonCrossPost(
    "https://mastodon.social",
    "123456789", // Mastodon account ID
    "https://example.com/callback",
    "123456789", // Twitter OAuth 2 client ID
    "123456789", // Twitter OAuth 2 client secret
    "https://api.twitter.com/oauth2/authorize",
    "https://api.twitter.com/oauth2/token",
    "https://api.twitter.com/1.1/statuses/update.json",
)
mastodonCrossPost.CrossPostTweets()

func (*MastodonCrossPost) CrossPostTweets

func (m *MastodonCrossPost) CrossPostTweets()

type MediaAttachment

type MediaAttachment struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	URL  string `json:"url"`
}

type OauthRequest

type OauthRequest struct {
	GrantType    string `json:"grant_type"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	RedirectUri  string `json:"redirect_uri"`
}

type PostMediaRequest

type PostMediaRequest struct {
	MediaData string `json:"media_data"`
}

type PostMediaResponse

type PostMediaResponse struct {
	MediaIDString string `json:"media_id_string"`
}

type PostTweetData

type PostTweetData struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

type PostTweetReplyRequest

type PostTweetReplyRequest struct {
	InReplyToTweetID string `json:"in_reply_to_tweet_id,omitempty"`
}

type PostTweetRequest

type PostTweetRequest struct {
	Text  string                 `json:"text"`
	Reply *PostTweetReplyRequest `json:"reply,omitempty"`
	Media *TweetMediaRequest     `json:"media,omitempty"`
}

type PostTweetResponse

type PostTweetResponse struct {
	Data PostTweetData
}

type Toot

type Toot struct {
	ID                 string            `json:"id"`
	InReplyToID        string            `json:"in_reply_to_id"`
	InReplyToAccountID string            `json:"in_reply_to_account_id"`
	Content            string            `json:"content"`
	CreatedAt          time.Time         `json:"created_at"`
	Reblog             interface{}       `json:"reblog"`
	MediaAttachments   []MediaAttachment `json:"media_attachments"`
}

type TweetMediaRequest

type TweetMediaRequest struct {
	MediaIDs []string `json:"media_ids,omitempty"`
}

type TwitterOAuthTokenRequest

type TwitterOAuthTokenRequest struct {
	Code         string `json:"code"`
	GrantType    string `json:"grant_type"`
	RedirectUri  string `json:"redirect_uri"`
	CodeVerifier string `json:"code_verifier"`
	RefreshToken string `json:"refresh_token"`
}

type TwitterOAuthTokenResponse

type TwitterOAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

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