Documentation
¶
Index ¶
- Constants
- Variables
- func IsAuthError(err error) bool
- type Client
- func (c *Client) Connect() error
- func (c *Client) DeleteConversation(conversationID string, payload *payload.DMRequestQuery) error
- func (c *Client) DeleteMessageForMe(variables *payload.DMMessageDeleteMutationVariables) (*response.DMMessageDeleteMutationResponse, error)
- func (c *Client) Disconnect() error
- func (c *Client) EditDirectMessage(payload *payload.EditDirectMessagePayload) (*types.Message, error)
- func (c *Client) FetchConversationContext(conversationID string, params *payload.DMRequestQuery, ...) (*response.ConversationDMResponse, error)
- func (c *Client) FetchTrustedThreads(params *payload.DMRequestQuery) (*response.InboxTimelineResponse, error)
- func (c *Client) GetAccountSettings(params payload.AccountSettingsQuery) (*response.AccountSettingsResponse, error)
- func (c *Client) GetCookieString() string
- func (c *Client) GetCurrentUser() *response.AccountSettingsResponse
- func (c *Client) GetCurrentUserID() string
- func (c *Client) GetDMPermissions(params payload.GetDMPermissionsQuery) (*response.GetDMPermissionsResponse, error)
- func (c *Client) GetDMUserUpdates(params *payload.DMRequestQuery) (*response.GetDMUserUpdatesResponse, error)
- func (c *Client) GetInitialInboxState(params *payload.DMRequestQuery) (*response.InboxInitialStateResponse, error)
- func (c *Client) GetMediaUploadStatus(mediaID string, h http.Header) (*response.FinalizedUploadMediaResponse, []byte, error)
- func (c *Client) IsLoggedIn() bool
- func (c *Client) LoadMessagesPage() (*response.InboxInitialStateResponse, *response.AccountSettingsResponse, error)
- func (c *Client) Login() error
- func (c *Client) Logout() (bool, error)
- func (c *Client) MakeRequest(url string, method string, headers http.Header, payload []byte, ...) (*http.Response, []byte, error)
- func (c *Client) MarkConversationRead(params *payload.MarkConversationReadQuery) error
- func (c *Client) PinConversation(conversationID string) (*response.PinConversationResponse, error)
- func (c *Client) React(reactionPayload *payload.ReactionActionPayload, remove bool) (*response.ReactionResponse, error)
- func (c *Client) Search(params payload.SearchQuery) (*response.SearchResponse, error)
- func (c *Client) SendDirectMessage(pl *payload.SendDirectMessagePayload) (*response.XInboxData, error)
- func (c *Client) SendTypingNotification(conversationID string) error
- func (c *Client) SetEventHandler(handler EventHandler)
- func (c *Client) SetProxy(proxyAddr string) error
- func (c *Client) SetPushNotificationConfig(setting PushNotificationSetting, config WebPushConfig) error
- func (c *Client) UnpinConversation(conversationID string) (*response.UnpinConversationResponse, error)
- func (c *Client) UploadMedia(params *payload.UploadMediaQuery, mediaBytes []byte) (*response.FinalizedUploadMediaResponse, error)
- type ClientOpts
- type EventHandler
- type HeaderOpts
- type JotClient
- type OnboardingClient
- type PollingClient
- type PushNotificationSetting
- type SessionAuthTokens
- type SessionLoader
- func (s *SessionLoader) CalculateAnimationToken()
- func (s *SessionLoader) GetAuthTokens() *SessionAuthTokens
- func (s *SessionLoader) GetCountry() string
- func (s *SessionLoader) GetCurrentUser() *response.AccountSettingsResponse
- func (s *SessionLoader) GetVerificationToken() string
- func (s *SessionLoader) LoadPage(url string) error
- func (s *SessionLoader) SetAuthTokens(authenticatedToken, notAuthenticatedToken string)
- func (s *SessionLoader) SetCountry(country string)
- func (s *SessionLoader) SetCurrentUser(data *response.AccountSettingsResponse)
- func (s *SessionLoader) SetVariableIndexes(indexes *[4]int)
- func (s *SessionLoader) SetVerificationToken(verificationToken string, anims *[4][16][11]int)
- type TwitterError
- type TwitterErrors
- type WebPushConfig
Constants ¶
View Source
const BrowserName = "Chrome"
View Source
const ChromeVersion = "131"
View Source
const ChromeVersionFull = ChromeVersion + ".0.6778.85"
View Source
const MaxHTTPRetries = 5
View Source
const OSName = "Linux"
View Source
const OSVersion = "6.8.0"
View Source
const SecCHFullVersionList = `"Chromium";v="` + ChromeVersionFull + `", "Google Chrome";v="` + ChromeVersionFull + `", "Not-A.Brand";v="99.0.0.0"`
View Source
const SecCHMobile = "?0"
View Source
const SecCHModel = ""
View Source
const SecCHPlatform = `"` + OSName + `"`
View Source
const SecCHPlatformVersion = `"` + OSVersion + `"`
View Source
const SecCHPrefersColorScheme = "light"
View Source
const SecCHUserAgent = `"Chromium";v="` + ChromeVersion + `", "Google Chrome";v="` + ChromeVersion + `", "Not-A.Brand";v="99"`
View Source
const UDID = OSName + "/" + BrowserName
View Source
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + ChromeVersion + ".0.0.0 Safari/537.36"
Variables ¶
View Source
var ( ErrConnectSetEventHandler = errors.New("event handler must be set before connecting") ErrNotAuthenticatedYet = errors.New("client has not been authenticated yet") ErrAlreadyPollingUpdates = errors.New("client is already polling for user updates") ErrNotPollingUpdates = errors.New("client is not polling for user updates") )
View Source
var ( ErrCouldNotAuthenticate error = TwitterError{Code: 32} ErrUserSuspended error = TwitterError{Code: 63} ErrAccountSuspended error = TwitterError{Code: 63} ErrNotActive error = TwitterError{Code: 141} ErrAccountTemporarilyLocked error = TwitterError{Code: 326} )
View Source
var ( ErrRedirectAttempted = errors.New("redirect attempted") ErrRequestCreateFailed = errors.New("failed to create request") ErrRequestFailed = errors.New("failed to send request") ErrResponseReadFailed = errors.New("failed to read response body") ErrMaxRetriesReached = errors.New("maximum retries reached") )
View Source
var BaseHeaders = http.Header{ "Accept": []string{"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"}, "Accept-Language": []string{"en-US,en;q=0.9"}, "User-Agent": []string{UserAgent}, "Sec-Ch-Ua": []string{SecCHUserAgent}, "Sec-Ch-Ua-Platform": []string{SecCHPlatform}, "Sec-Ch-Ua-Mobile": []string{SecCHMobile}, "Referer": []string{endpoints.BASE_URL + "/"}, "Origin": []string{endpoints.BASE_URL}, }
Functions ¶
func IsAuthError ¶
Types ¶
type Client ¶
type Client struct { Logger zerolog.Logger HTTP *http.Client // contains filtered or unexported fields }
func (*Client) DeleteConversation ¶
func (c *Client) DeleteConversation(conversationID string, payload *payload.DMRequestQuery) error
func (*Client) DeleteMessageForMe ¶
func (c *Client) DeleteMessageForMe(variables *payload.DMMessageDeleteMutationVariables) (*response.DMMessageDeleteMutationResponse, error)
keep in mind this only deletes the message for you
func (*Client) Disconnect ¶
func (*Client) EditDirectMessage ¶
func (*Client) FetchConversationContext ¶
func (c *Client) FetchConversationContext(conversationID string, params *payload.DMRequestQuery, context payload.ContextInfo) (*response.ConversationDMResponse, error)
func (*Client) FetchTrustedThreads ¶
func (c *Client) FetchTrustedThreads(params *payload.DMRequestQuery) (*response.InboxTimelineResponse, error)
func (*Client) GetAccountSettings ¶
func (c *Client) GetAccountSettings(params payload.AccountSettingsQuery) (*response.AccountSettingsResponse, error)
func (*Client) GetCookieString ¶
func (*Client) GetCurrentUser ¶
func (c *Client) GetCurrentUser() *response.AccountSettingsResponse
func (*Client) GetCurrentUserID ¶
func (*Client) GetDMPermissions ¶
func (c *Client) GetDMPermissions(params payload.GetDMPermissionsQuery) (*response.GetDMPermissionsResponse, error)
func (*Client) GetDMUserUpdates ¶
func (c *Client) GetDMUserUpdates(params *payload.DMRequestQuery) (*response.GetDMUserUpdatesResponse, error)
func (*Client) GetInitialInboxState ¶
func (c *Client) GetInitialInboxState(params *payload.DMRequestQuery) (*response.InboxInitialStateResponse, error)
func (*Client) GetMediaUploadStatus ¶
func (*Client) IsLoggedIn ¶
func (*Client) LoadMessagesPage ¶
func (c *Client) LoadMessagesPage() (*response.InboxInitialStateResponse, *response.AccountSettingsResponse, error)
func (*Client) MakeRequest ¶
func (*Client) MarkConversationRead ¶
func (c *Client) MarkConversationRead(params *payload.MarkConversationReadQuery) error
func (*Client) PinConversation ¶
func (c *Client) PinConversation(conversationID string) (*response.PinConversationResponse, error)
func (*Client) React ¶
func (c *Client) React(reactionPayload *payload.ReactionActionPayload, remove bool) (*response.ReactionResponse, error)
func (*Client) Search ¶
func (c *Client) Search(params payload.SearchQuery) (*response.SearchResponse, error)
func (*Client) SendDirectMessage ¶
func (c *Client) SendDirectMessage(pl *payload.SendDirectMessagePayload) (*response.XInboxData, error)
func (*Client) SendTypingNotification ¶
func (*Client) SetEventHandler ¶
func (c *Client) SetEventHandler(handler EventHandler)
func (*Client) SetPushNotificationConfig ¶
func (c *Client) SetPushNotificationConfig(setting PushNotificationSetting, config WebPushConfig) error
func (*Client) UnpinConversation ¶
func (c *Client) UnpinConversation(conversationID string) (*response.UnpinConversationResponse, error)
func (*Client) UploadMedia ¶
func (c *Client) UploadMedia(params *payload.UploadMediaQuery, mediaBytes []byte) (*response.FinalizedUploadMediaResponse, error)
type ClientOpts ¶
type ClientOpts struct { PollingInterval *time.Duration Cookies *cookies.Cookies Session *SessionLoader EventHandler EventHandler WithJOTClient bool }
type EventHandler ¶
type EventHandler func(evt any)
type HeaderOpts ¶
type OnboardingClient ¶
type OnboardingClient struct {
// contains filtered or unexported fields
}
func (*OnboardingClient) SetCurrentTasks ¶
func (o *OnboardingClient) SetCurrentTasks(tasks *types.TaskResponse)
func (*OnboardingClient) SetFlowToken ¶
func (o *OnboardingClient) SetFlowToken(flowToken string) *OnboardingClient
type PollingClient ¶
type PollingClient struct {
// contains filtered or unexported fields
}
func (*PollingClient) SetCurrentCursor ¶
func (pc *PollingClient) SetCurrentCursor(cursor string)
type PushNotificationSetting ¶
type PushNotificationSetting int
const ( REGISTER_PUSH PushNotificationSetting = 0 UNREGISTER_PUSH PushNotificationSetting = 1 )
type SessionAuthTokens ¶
type SessionAuthTokens struct {
// contains filtered or unexported fields
}
type SessionLoader ¶
type SessionLoader struct {
// contains filtered or unexported fields
}
func (*SessionLoader) CalculateAnimationToken ¶ added in v0.2.1
func (s *SessionLoader) CalculateAnimationToken()
func (*SessionLoader) GetAuthTokens ¶
func (s *SessionLoader) GetAuthTokens() *SessionAuthTokens
func (*SessionLoader) GetCountry ¶
func (s *SessionLoader) GetCountry() string
func (*SessionLoader) GetCurrentUser ¶
func (s *SessionLoader) GetCurrentUser() *response.AccountSettingsResponse
func (*SessionLoader) GetVerificationToken ¶
func (s *SessionLoader) GetVerificationToken() string
func (*SessionLoader) LoadPage ¶
func (s *SessionLoader) LoadPage(url string) error
func (*SessionLoader) SetAuthTokens ¶
func (s *SessionLoader) SetAuthTokens(authenticatedToken, notAuthenticatedToken string)
func (*SessionLoader) SetCountry ¶
func (s *SessionLoader) SetCountry(country string)
func (*SessionLoader) SetCurrentUser ¶
func (s *SessionLoader) SetCurrentUser(data *response.AccountSettingsResponse)
func (*SessionLoader) SetVariableIndexes ¶ added in v0.2.1
func (s *SessionLoader) SetVariableIndexes(indexes *[4]int)
func (*SessionLoader) SetVerificationToken ¶
func (s *SessionLoader) SetVerificationToken(verificationToken string, anims *[4][16][11]int)
type TwitterError ¶
func (TwitterError) Error ¶
func (te TwitterError) Error() string
func (TwitterError) Is ¶
func (te TwitterError) Is(other error) bool
type TwitterErrors ¶
type TwitterErrors struct {
Errors []TwitterError `json:"errors"`
}
func (*TwitterErrors) Error ¶
func (te *TwitterErrors) Error() string
func (*TwitterErrors) Unwrap ¶
func (te *TwitterErrors) Unwrap() []error
type WebPushConfig ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.