jike_sdk_go

package module
v0.0.0-...-7c7086a Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 14 Imported by: 0

README

jike

Documentation

Index

Constants

View Source
const (
	Posts = "/originalPosts"
)
View Source
const (
	Users = "/users"
)

Variables

View Source
var (
	ErrUnknown = errors.New("unknown error")
)

Functions

func GenRandString

func GenRandString(n int) string

Types

type AvatarImage

type AvatarImage struct {
	ThumbnailUrl string `json:"thumbnailUrl"`
	SmallPicUrl  string `json:"smallPicUrl"`
	MiddlePicUrl string `json:"middlePicUrl"`
	PicUrl       string `json:"picUrl"`
	Format       string `json:"format"`
}

type BackgroundImage

type BackgroundImage struct {
	PicUrl string `json:"picUrl"`
}

type Client

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

func NewClient

func NewClient(opts ...OptFunc) *Client

func (*Client) CreatePost

func (c *Client) CreatePost(ctx context.Context, req *CreatePostReq) (*CreatePostRsp, error)

func (*Client) LoginWithPhoneAndPassword

func (c *Client) LoginWithPhoneAndPassword(ctx context.Context, req *LoginWithPhoneAndPasswordReq) (
	*LoginWithPhoneAndPasswordRsp, error)

todo: 何时刷新 token?

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, req *UploadReq) (*UploadRsp, error)

func (*Client) UploadToken

func (c *Client) UploadToken(ctx context.Context, req *UploadTokenReq) (*UploadTokenRsp, error)

type CreatePostReq

type CreatePostReq struct {
	PictureKeys          []string `json:"pictureKeys"`
	SyncToPersonalUpdate bool     `json:"syncToPersonalUpdate"`
	SubmitToTopic        string   `json:"submitToTopic"`
	Content              string   `json:"content"`
}

type CreatePostRsp

type CreatePostRsp struct {
	Success bool              `json:"success"`
	Toast   string            `json:"toast"`
	Data    CreatePostRspData `json:"data"`
}

type CreatePostRspData

type CreatePostRspData struct {
	Id      string `json:"id"`
	Type    string `json:"type"`
	Content string `json:"content"`

	UrlsInText json.RawMessage `json:"urlsInText"`

	Status             string `json:"status"`
	IsCommentForbidden bool   `json:"isCommentForbidden"`
	LikeCount          int    `json:"likeCount"`
	CommentCount       int    `json:"commentCount"`
	RepostCount        int    `json:"repostCount"`
	ShareCount         int    `json:"shareCount"`

	Topic    Topic     `json:"topic"`
	Pictures []Picture `json:"pictures"`

	Collected bool `json:"collected"`

	CollectTime json.RawMessage `json:"collectTime"`
	User        LatestVisitor   `json:"user"`

	CreatedAt             time.Time `json:"createdAt"`
	IsFeatured            bool      `json:"isFeatured"`
	EnablePictureComments bool      `json:"enablePictureComments"`
	Repostable            bool      `json:"repostable"`

	Rollouts           Rollouts            `json:"rollouts"`
	ScrollingSubtitles []ScrollingSubtitle `json:"scrollingSubtitles"`
}

type Decorations

type Decorations = json.RawMessage

type LatestVisitor

type LatestVisitor struct {
	Id            string    `json:"id"`
	Username      string    `json:"username"`
	ScreenName    string    `json:"screenName"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	IsVerified    bool      `json:"isVerified"`
	VerifyMessage string    `json:"verifyMessage"`
	BriefIntro    string    `json:"briefIntro"`

	AvatarImage AvatarImage `json:"avatarImage"`
	Decorations Decorations `json:"decorations"`

	ProfileImageUrl string `json:"profileImageUrl"`

	StatsCount StatsCount `json:"statsCount"`

	IsBannedForever bool `json:"isBannedForever"`
	IsSponsor       bool `json:"isSponsor"`

	BackgroundImage BackgroundImage `json:"backgroundImage"`

	Bio      string `json:"bio"`
	Gender   string `json:"gender"`
	City     string `json:"city"`
	Country  string `json:"country"`
	Province string `json:"province"`

	RefRemark RefRemark `json:"refRemark"`
}

type LoginWithPhoneAndPasswordReq

type LoginWithPhoneAndPasswordReq struct {
	AreaCode          string `json:"areaCode"`
	MobilePhoneNumber string `json:"mobilePhoneNumber"`
	Password          string `json:"password"`
}

type LoginWithPhoneAndPasswordRsp

type LoginWithPhoneAndPasswordRsp struct {
	IsRegister      bool            `json:"isRegister"`
	User            User            `json:"user"`
	EnabledFeatures []string        `json:"enabledFeatures"`
	AgreedProtocol  json.RawMessage `json:"agreedProtocol"`
}

type OptFunc

type OptFunc func(*options)

func WithDebug

func WithDebug(debug bool) OptFunc

type Picture

type Picture struct {
	Key          string  `json:"key"`
	ThumbnailUrl string  `json:"thumbnailUrl"`
	SmallPicUrl  string  `json:"smallPicUrl"`
	MiddlePicUrl string  `json:"middlePicUrl"`
	PicUrl       string  `json:"picUrl"`
	Format       string  `json:"format"`
	CropperPosX  float64 `json:"cropperPosX"`
	CropperPosY  float64 `json:"cropperPosY"`
	Width        int     `json:"width"`
	Height       int     `json:"height"`
}

type Preferences

type Preferences struct {
	PersonalizedRecommendationOn  bool            `json:"personalizedRecommendationOn"`
	AutoPlayVideo                 bool            `json:"autoPlayVideo"`
	TopicTagGuideOn               bool            `json:"topicTagGuideOn"`
	DailyNotificationOn           bool            `json:"dailyNotificationOn"`
	FollowedNotificationOn        bool            `json:"followedNotificationOn"`
	ReplyNotificationAllowGroup   string          `json:"replyNotificationAllowGroup"`
	LikeNotificationOn            bool            `json:"likeNotificationOn"`
	RespectNotificationOn         bool            `json:"respectNotificationOn"`
	MentionNotificationOn         bool            `json:"mentionNotificationOn"`
	LiveNotificationOn            bool            `json:"liveNotificationOn"`
	SubscribeWeatherForecast      bool            `json:"subscribeWeatherForecast"`
	PrivateTopicSubscribe         bool            `json:"privateTopicSubscribe"`
	UndiscoverableByPhoneNumber   bool            `json:"undiscoverableByPhoneNumber"`
	SaveDataUsageMode             bool            `json:"saveDataUsageMode"`
	TopicPushSettings             string          `json:"topicPushSettings"`
	DebugLogOn                    bool            `json:"debugLogOn"`
	Env                           string          `json:"env"`
	SyncCommentToPersonalActivity bool            `json:"syncCommentToPersonalActivity"`
	RepostWithComment             bool            `json:"repostWithComment"`
	EnablePrivateChat             bool            `json:"enablePrivateChat"`
	BlockStrangerPoke             bool            `json:"blockStrangerPoke"`
	EnablePictureWatermark        bool            `json:"enablePictureWatermark"`
	EnableOperationPush           bool            `json:"enableOperationPush"`
	EnableChatSound               bool            `json:"enableChatSound"`
	HideSubscribeTab              bool            `json:"hideSubscribeTab"`
	OpenMessageTabOnLaunch        bool            `json:"openMessageTabOnLaunch"`
	TabOnLaunch                   string          `json:"tabOnLaunch"`
	UndiscoverableByWeiboUser     json.RawMessage `json:"undiscoverableByWeiboUser"`
	PaidMarket                    json.RawMessage `json:"paidMarket"`
	FollowingUpdatesSortBy        string          `json:"followingUpdatesSortBy"`
}

type ProfileTag

type ProfileTag struct {
	PicUrl string `json:"picUrl,omitempty"`
	Text   string `json:"text"`
	Type   string `json:"type"`
}

type ProfileVisitInfo

type ProfileVisitInfo struct {
	TodayCount    int           `json:"todayCount"`
	LatestVisitor LatestVisitor `json:"latestVisitor"`
}

type QqUserInfo

type QqUserInfo struct {
	Id           string `json:"id"`
	ExternalName string `json:"externalName"`
}

type RefRemark

type RefRemark struct {
	Type  string `json:"type"`
	RefId string `json:"refId"`
}

type RelationshipState

type RelationshipState struct {
	Id   string `json:"id"`
	Text string `json:"text"`
}

type RestrictedAvatarChange

type RestrictedAvatarChange struct {
	NextChangeDate string `json:"nextChangeDate"`
	Limits         int    `json:"limits"`
}

type RestrictedNameChange

type RestrictedNameChange struct {
	NextChangeDate string `json:"nextChangeDate"`
	Limits         int    `json:"limits"`
}

type Rollouts

type Rollouts struct {
	WmpShare WmpShare `json:"wmpShare"`
}

type School

type School struct {
	Id             string `json:"id"`
	Name           string `json:"name"`
	Major          string `json:"major"`
	EnrollmentYear int    `json:"enrollmentYear"`
	PrivacyType    string `json:"privacyType"`
}

type ScrollingSubtitle

type ScrollingSubtitle struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

type SquarePicture

type SquarePicture struct {
	Format       string `json:"format"`
	PicUrl       string `json:"picUrl"`
	MiddlePicUrl string `json:"middlePicUrl"`
	SmallPicUrl  string `json:"smallPicUrl"`
	ThumbnailUrl string `json:"thumbnailUrl"`

	LivePhoto json.RawMessage `json:"livePhoto"`
	Themes    json.RawMessage `json:"themes"`
	Nft       json.RawMessage `json:"nft"`
}

type StatsCount

type StatsCount struct {
	TopicSubscribed            int `json:"topicSubscribed"`
	TopicCreated               int `json:"topicCreated"`
	FollowedCount              int `json:"followedCount"`
	FollowingCount             int `json:"followingCount"`
	HighlightedPersonalUpdates int `json:"highlightedPersonalUpdates"`
	Liked                      int `json:"liked"`
	RespectedCount             int `json:"respectedCount"`
}

type Tips

type Tips struct {
	InDraft   string `json:"inDraft"`
	InComment string `json:"inComment"`
}

type Topic

type Topic struct {
	Id               string `json:"id"`
	Type             string `json:"type"`
	Content          string `json:"content"`
	SubscribersCount int    `json:"subscribersCount"`

	SquarePicture SquarePicture `json:"squarePicture"`

	BriefIntro    string `json:"briefIntro"`
	TopicType     string `json:"topicType"`
	OperateStatus string `json:"operateStatus"`
	IsValid       bool   `json:"isValid"`
	IsVerified    bool   `json:"isVerified"`
	TopicId       int    `json:"topicId"`
	IsSearchable  bool   `json:"isSearchable"`
	LikeIcon      string `json:"likeIcon"`
	MessagePrefix string `json:"messagePrefix"`

	InternalTags json.RawMessage `json:"internalTags"`
	CustomTags   json.RawMessage `json:"customTags"`

	AuditStatus string `json:"auditStatus"`

	NewCategory   json.RawMessage `json:"newCategory"`
	InvolvedUsers json.RawMessage `json:"involvedUsers"`

	EntryTab string `json:"entryTab"`

	Tabs             json.RawMessage `json:"tabs"`
	RectanglePicture json.RawMessage `json:"rectanglePicture"`

	PictureUrl               string    `json:"pictureUrl"`
	ThumbnailUrl             string    `json:"thumbnailUrl"`
	SubscribedStatusRawValue int       `json:"subscribedStatusRawValue"`
	SubscribedAt             string    `json:"subscribedAt"`
	Ref                      string    `json:"ref"`
	IsDreamTopic             bool      `json:"isDreamTopic"`
	IsAnonymous              bool      `json:"isAnonymous"`
	EnablePictureComments    bool      `json:"enablePictureComments"`
	EnablePictureWatermark   bool      `json:"enablePictureWatermark"`
	TimeForRank              string    `json:"timeForRank"`
	LastMessagePostTime      time.Time `json:"lastMessagePostTime"`
	CreatedAt                string    `json:"createdAt"`
	UpdatedAt                string    `json:"updatedAt"`
	SubscribersTextSuffix    string    `json:"subscribersTextSuffix"`
	SubscribersName          string    `json:"subscribersName"`
	FriendsAlsoSubscribe     string    `json:"friendsAlsoSubscribe"`

	Maintainer json.RawMessage `json:"maintainer"`

	IsUserTopicAdmin bool `json:"isUserTopicAdmin"`

	ActivitySection  json.RawMessage `json:"activitySection"`
	ActivitySections json.RawMessage `json:"activitySections"`
	Tips             Tips            `json:"tips"`
	ToppingArea      json.RawMessage `json:"toppingArea"`

	InShortcuts   bool   `json:"inShortcuts"`
	PreferSection string `json:"preferSection"`

	RelatedHashtags json.RawMessage `json:"relatedHashtags"`

	Intro                       string    `json:"intro"`
	SquarePostUpdateTime        time.Time `json:"squarePostUpdateTime"`
	SubscribersAction           string    `json:"subscribersAction"`
	ApproximateSubscribersCount string    `json:"approximateSubscribersCount"`
	SubscribersDescription      string    `json:"subscribersDescription"`
	IsCommentForbidden          bool      `json:"isCommentForbidden"`
	BotCount                    int       `json:"botCount"`
	RecentPost                  string    `json:"recentPost"`
	Source                      string    `json:"source"`
	EnableForUserPost           bool      `json:"enableForUserPost"`
}

type UploadReq

type UploadReq struct {
	UploadToken string
	Filename    string
}

type UploadRsp

type UploadRsp struct {
	FileURL string `json:"fileUrl"`
	ID      string `json:"id"`
	Key     string `json:"key"`
	Success bool   `json:"success"`
}

type UploadTokenReq

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

func NewUploadTokenReq

func NewUploadTokenReq(name string, ut UploadType) (*UploadTokenReq, error)

func (*UploadTokenReq) Map

func (utr *UploadTokenReq) Map() map[string]string

type UploadTokenRsp

type UploadTokenRsp struct {
	UpToken string `json:"uptoken"`
}

type UploadType

type UploadType = string
const (
	PIC UploadType = "PIC"
)

type User

type User struct {
	Id            string    `json:"id"`
	Username      string    `json:"username"`
	ScreenName    string    `json:"screenName"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	IsVerified    bool      `json:"isVerified"`
	VerifyMessage string    `json:"verifyMessage"`
	BriefIntro    string    `json:"briefIntro"`

	AvatarImage AvatarImage `json:"avatarImage"`
	Decorations Decorations `json:"decorations"`

	ProfileImageUrl string `json:"profileImageUrl"`

	StatsCount StatsCount `json:"statsCount"`

	IsBannedForever bool `json:"isBannedForever"`
	IsSponsor       bool `json:"isSponsor"`

	BackgroundImage BackgroundImage `json:"backgroundImage"`

	Bio    string `json:"bio"`
	Gender string `json:"gender"`

	Preferences Preferences `json:"preferences"`

	IsBetaUser        bool   `json:"isBetaUser"`
	UsernameSet       bool   `json:"usernameSet"`
	WechatOpenId      string `json:"wechatOpenId"`
	WechatUnionId     string `json:"wechatUnionId"`
	QqOpenId          string `json:"qqOpenId"`
	MobilePhoneNumber string `json:"mobilePhoneNumber"`
	AreaCode          string `json:"areaCode"`
	Birthday          string `json:"birthday"`

	QqUserInfo QqUserInfo `json:"qqUserInfo"`

	TopicRoles json.RawMessage `json:"topicRoles"`

	School School `json:"school"`

	Zodiac string `json:"zodiac"`

	RelationshipState RelationshipState `json:"relationshipState"`

	ShowRespect bool            `json:"showRespect"`
	Medals      json.RawMessage `json:"medals"`

	ProfileTags []ProfileTag `json:"profileTags"`

	BackgroundMaskColor string `json:"backgroundMaskColor"`
	IsLoginUser         bool   `json:"isLoginUser"`
	IsBanned            bool   `json:"isBanned"`
	UserHasPosted       bool   `json:"userHasPosted"`
	HasStories          bool   `json:"hasStories"`

	RestrictedAvatarChange RestrictedAvatarChange `json:"restrictedAvatarChange"`
	RestrictedNameChange   RestrictedNameChange   `json:"restrictedNameChange"`

	IsDefaultScreenName bool `json:"isDefaultScreenName"`

	ProfileVisitInfo ProfileVisitInfo `json:"profileVisitInfo"`
}

type WmpShare

type WmpShare struct {
	Id   string `json:"id"`
	Path string `json:"path"`
}

Jump to

Keyboard shortcuts

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