Documentation ¶
Index ¶
- Constants
- func InitConf(c *SysConf)
- type BlockChainConf
- type DbManager
- func (dm *DbManager) BindingWeb3ID(bindData *Web3Binding, twMeta *TWUserInfo) (*NinjaUsrInfo, error)
- func (dm *DbManager) GetTwAccessToken(twitterId string) (*TwUserAccessToken, error)
- func (dm *DbManager) GetTwAccessTokenV2(twitterId string) (*TwUserAccessTokenV2, error)
- func (dm *DbManager) NjTweetDetails(createAt int64) (*NinjaTweet, error)
- func (dm *DbManager) NjUserSignIn(ethAddr string) *NinjaUsrInfo
- func (dm *DbManager) QueryGlobalLatestTweets(pageSize int, id int64, readNewest bool, callback func(tweet *NinjaTweet)) error
- func (dm *DbManager) QueryTweetStatus(createTimes []int64) (map[int64]*NjTweetStatus, error)
- func (dm *DbManager) SaveTwAccessToken(token *TwUserAccessToken) error
- func (dm *DbManager) SaveTwAccessTokenV2(token *TwUserAccessTokenV2) error
- func (dm *DbManager) SaveTweet(content *NinjaTweet) error
- func (dm *DbManager) TwitterBasicInfo(TID string) (*TWUserInfo, error)
- func (dm *DbManager) UpdateBasicInfo(twData *TWUserInfo) error
- func (dm *DbManager) UpdateTweetPaymentStatus(createAt int64, s TxStatus) error
- func (dm *DbManager) UpdateTweetVoteStatic(createAt int64, amount int) (int, error)
- type FileStoreConf
- type Geo
- type HttpConf
- type LogicAction
- type MainService
- type Media
- type NinjaTweet
- type NinjaUsrInfo
- type NjTweetStatus
- type Poll
- type Reply
- type SessionManager
- type SignDataByEth
- type SignInObj
- type StatusQuery
- type SysConf
- type TWUserInfo
- type TwAPIResponse
- type TwUserAccessToken
- type TwUserAccessTokenV2
- type TweetPaymentStatus
- type TweetPostResult
- type TweetRequest
- type TweetResponse
- type TweetVoteAction
- type TweetsOfUser
- type TwitterConf
- type TxStatus
- type VerifiedTwitterUser
- type Web3Binding
- type Web3BindingData
Constants ¶
View Source
const ( DefaultTwitterProjectID = "dessage" DefaultDBTimeOut = 10 * time.Second DBTableNJUser = "ninja-user" DBTableTWUser = "twitter-user" DBTableTWUserAccToken = "twitter-user-access-token" DBTableTWUserAccTokenV2 = "twitter-user-access-token_v2" DBTableWeb3Bindings = "twitter-eth-binding" DBTableTweetsPosted = "tweets-posted" DBTableTweetsStatus = "tweets-status" )
View Source
const (
BuyRightsUrlKey = "twOwner"
)
View Source
const (
SessionNameSystem = "session-name-for-ninja"
)
View Source
const (
Web3IDProfile = "Dessage-Web3-ID:"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockChainConf ¶
type BlockChainConf struct { TweeTVoteContractAddress string `json:"tweet_vote_contract_address"` GameContract string `json:"game_contract"` KolKeyContractAddress string `json:"kol_key_contract_address"` InfuraUrl string `json:"infura_url"` GameTimeInMinute int `json:"game_time_in_minute,omitempty"` TxCheckerInSeconds int `json:"tx_checker_in_seconds,omitempty"` ChainID int64 `json:"chain_id,omitempty"` }
func (*BlockChainConf) String ¶
func (c *BlockChainConf) String() string
type DbManager ¶
type DbManager struct {
// contains filtered or unexported fields
}
func (*DbManager) BindingWeb3ID ¶
func (dm *DbManager) BindingWeb3ID(bindData *Web3Binding, twMeta *TWUserInfo) (*NinjaUsrInfo, error)
func (*DbManager) GetTwAccessToken ¶
func (dm *DbManager) GetTwAccessToken(twitterId string) (*TwUserAccessToken, error)
func (*DbManager) GetTwAccessTokenV2 ¶
func (dm *DbManager) GetTwAccessTokenV2(twitterId string) (*TwUserAccessTokenV2, error)
func (*DbManager) NjTweetDetails ¶
func (dm *DbManager) NjTweetDetails(createAt int64) (*NinjaTweet, error)
func (*DbManager) NjUserSignIn ¶
func (dm *DbManager) NjUserSignIn(ethAddr string) *NinjaUsrInfo
func (*DbManager) QueryGlobalLatestTweets ¶
func (*DbManager) QueryTweetStatus ¶
func (dm *DbManager) QueryTweetStatus(createTimes []int64) (map[int64]*NjTweetStatus, error)
func (*DbManager) SaveTwAccessToken ¶
func (dm *DbManager) SaveTwAccessToken(token *TwUserAccessToken) error
func (*DbManager) SaveTwAccessTokenV2 ¶
func (dm *DbManager) SaveTwAccessTokenV2(token *TwUserAccessTokenV2) error
func (*DbManager) SaveTweet ¶
func (dm *DbManager) SaveTweet(content *NinjaTweet) error
func (*DbManager) TwitterBasicInfo ¶
func (dm *DbManager) TwitterBasicInfo(TID string) (*TWUserInfo, error)
func (*DbManager) UpdateBasicInfo ¶
func (dm *DbManager) UpdateBasicInfo(twData *TWUserInfo) error
func (*DbManager) UpdateTweetPaymentStatus ¶
type FileStoreConf ¶
type FileStoreConf struct { ProjectID string `json:"project_id"` KeyFilePath string `json:"key_file_path"` TweetsPageSize int `json:"tweets_page_size"` }
func (*FileStoreConf) String ¶
func (c *FileStoreConf) String() string
type HttpConf ¶
type LogicAction ¶
type LogicAction struct { Action func(w http.ResponseWriter, r *http.Request, token *NinjaUsrInfo) NeedToken bool }
type MainService ¶
type MainService struct { }
func NewMainService ¶
func NewMainService() *MainService
func (*MainService) Start ¶
func (bh *MainService) Start()
type NinjaTweet ¶
type NinjaTweet struct { Txt string `json:"text" firestore:"text"` CreateAt int64 `json:"create_time" firestore:"create_time"` Web3ID string `json:"web3_id" firestore:"web3_id"` TweetUsrId string `json:"twitter_id" firestore:"twitter_id"` TweetId string `json:"tweet_id,omitempty" firestore:"tweet_id"` Signature string `json:"signature,omitempty" firestore:"signature"` PrefixedHash string `json:"prefixed_hash" firestore:"prefixed_hash"` PaymentStatus TxStatus `json:"payment_status" firestore:"payment_status"` }
func (*NinjaTweet) IsValid ¶
func (nt *NinjaTweet) IsValid() bool
func (*NinjaTweet) String ¶
func (nt *NinjaTweet) String() string
type NinjaUsrInfo ¶
type NinjaUsrInfo struct { Address string `json:"address" firestore:"address"` EthAddr string `json:"eth_addr" firestore:"eth_addr"` CreateAt int64 `json:"create_at" firestore:"create_at"` TwID string `json:"tw_id" firestore:"tw_id"` UpdateAt int64 }
func NJUsrInfoMust ¶
func NJUsrInfoMust(data []byte) (*NinjaUsrInfo, error)
func (*NinjaUsrInfo) RawData ¶
func (nu *NinjaUsrInfo) RawData() []byte
func (*NinjaUsrInfo) RefreshSession ¶
func (nu *NinjaUsrInfo) RefreshSession()
func (*NinjaUsrInfo) String ¶
func (nu *NinjaUsrInfo) String() string
type NjTweetStatus ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func SMInst ¶
func SMInst() *SessionManager
func (*SessionManager) Del ¶
func (sm *SessionManager) Del(key string, r *http.Request, w http.ResponseWriter) error
func (*SessionManager) Set ¶
func (sm *SessionManager) Set(r *http.Request, w http.ResponseWriter, key string, val any) error
type SignDataByEth ¶
type SignDataByEth struct { Message string `json:"message"` Signature string `json:"signature"` PayLoad any `json:"pay_load,omitempty"` }
func (*SignDataByEth) ParseNinjaTweet ¶
func (sp *SignDataByEth) ParseNinjaTweet() (*NinjaTweet, error)
func (*SignDataByEth) RawData ¶
func (sp *SignDataByEth) RawData() string
type SignInObj ¶
func MustSignInData ¶
type StatusQuery ¶
type StatusQuery struct {
CreateTime []int64 `json:"create_time"`
}
type SysConf ¶
type SysConf struct { LogLevel string `json:"log_level"` LocalRun bool `json:"local_run"` UrlHome string `json:"url_home"` HttpPort string `json:"http_port"` *HttpConf *TwitterConf *FileStoreConf *BlockChainConf // contains filtered or unexported fields }
func (*SysConf) GetNjProtocolAd ¶
type TWUserInfo ¶
type TWUserInfo struct { ID string `json:"id" firestore:"id"` Name string `json:"name" firestore:"name"` ScreenName string `json:"username" firestore:"username"` Description string `json:"description" firestore:"description"` ProfileImageUrlHttps string `json:"profile_image_url" firestore:"profile_image_url"` Verified bool `json:"verified" firestore:"verified"` }
func (*TWUserInfo) RawData ¶
func (t *TWUserInfo) RawData() []byte
func (*TWUserInfo) String ¶
func (t *TWUserInfo) String() string
type TwAPIResponse ¶
type TwAPIResponse struct { TwitterData *TWUserInfo `json:"data"` EthAddr string `json:"eth_addr"` SignUpAt int64 `json:"sign_up_at"` }
type TwUserAccessToken ¶
type TwUserAccessToken struct { OauthToken string `json:"oauth_token" firestore:"oauth_token"` OauthTokenSecret string `json:"oauth_token_secret" firestore:"oauth_token_secret"` UserId string `json:"user_id" firestore:"user_id"` ScreenName string `json:"screen_name" firestore:"screen_name"` }
func (*TwUserAccessToken) GetToken ¶
func (ut *TwUserAccessToken) GetToken() *oauth1.Token
func (*TwUserAccessToken) String ¶
func (ut *TwUserAccessToken) String() string
type TwUserAccessTokenV2 ¶
type TweetPaymentStatus ¶
type TweetPostResult ¶
type TweetRequest ¶
type TweetRequest struct { Text string `json:"text,omitempty"` DirectMessageDeepLink string `json:"direct_message_deep_link,omitempty"` ForSuperFollowersOnly bool `json:"for_super_followers_only,omitempty"` Geo *Geo `json:"geo,omitempty"` Media *Media `json:"media,omitempty"` Poll *Poll `json:"poll,omitempty"` QuoteTweetID string `json:"quote_tweet_id,omitempty"` Reply *Reply `json:"reply,omitempty"` ReplySettings string `json:"reply_settings,omitempty"` }
type TweetResponse ¶
type TweetResponse struct {
Data TweetPostResult `json:"data"`
}
type TweetVoteAction ¶
type TweetsOfUser ¶
type TweetsOfUser struct {
Tweets map[string]struct{} `json:"tweets" firestore:"tweets"`
}
type TwitterConf ¶
type TwitterConf struct { FontSize float64 `json:"font_size"` FontPath string `json:"font_path"` MaxTxtPerImg int `json:"max_txt_per_img"` ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` ConsumerKey string `json:"consumer_key"` ConsumerSecret string `json:"consumer_secret"` // contains filtered or unexported fields }
func (*TwitterConf) String ¶
func (c *TwitterConf) String() string
type VerifiedTwitterUser ¶
type VerifiedTwitterUser struct { ContributorsEnabled bool `json:"contributors_enabled"` CreatedAt string `json:"created_at"` DefaultProfile bool `json:"default_profile"` DefaultProfileImage bool `json:"default_profile_image"` Description string `json:"description"` FavouritesCount int `json:"favourites_count"` FollowersCount int `json:"followers_count"` FriendsCount int `json:"friends_count"` GeoEnabled bool `json:"geo_enabled"` ID int64 `json:"id"` IDStr string `json:"id_str"` IsTranslator bool `json:"is_translator"` Lang string `json:"lang"` ListedCount int `json:"listed_count"` Location string `json:"location"` Name string `json:"name"` ProfileBackgroundColor string `json:"profile_background_color"` ProfileBackgroundImageUrl string `json:"profile_background_image_url"` ProfileBackgroundImageUrlHttps string `json:"profile_background_image_url_https"` ProfileBackgroundTile bool `json:"profile_background_tile"` ProfileImageUrl string `json:"profile_image_url"` ProfileImageUrlHttps string `json:"profile_image_url_https"` ProfileLinkColor string `json:"profile_link_color"` ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"` ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"` ProfileTextColor string `json:"profile_text_color"` ProfileUseBackgroundImage bool `json:"profile_use_background_image"` Protected bool `json:"protected"` ScreenName string `json:"screen_name"` ShowAllInlineMedia bool `json:"show_all_inline_media"` StatusesCount int `json:"statuses_count"` TimeZone string `json:"time_zone"` URL string `json:"url"` UtcOffset int `json:"utc_offset"` Verified bool `json:"verified"` }
type Web3Binding ¶
type Web3BindingData ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.