woodstock

package module
v0.0.0-...-b22c4f1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 11 Imported by: 0

README

woodstock

A client library for pnut.io written in Go

source code - issue tracker - releases - mailing list

Installation

go get git.sr.ht/~thrrgilag/woodstock

Examples

New post

package main

import (
    "fmt"
    "net/url"
    "git.sr.ht/~thrrgilag/woodstock"
)

func main() {
    client := woodstock.NewClient("<ClientID>","")
    client.SetAccessToken("<AccessToken>")
    text := "Hello pnut.io"
    v := url.Values{}
    v.Set("text", text)
    post, err := client.Post(v)
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(post.Data.Content.Text)
}

Contributing

Send patches to ~thrrgilag/woodstock@lists.sr.ht.

A nice tutorial on how to do that can be found at git-send-email.io.

Send bugs to ~thrrgilag/woodstock@todo.sr.ht.

Discussion

Mailing List: ~thrrgilag/woodstock@lists.sr.ht

Chat Room: #dev

Documentation

Index

Constants

View Source
const (
	AuthenticateURL       = "https://pnut.io/oauth/authenticate"
	APIBasesURL           = "https://api.pnut.io/v0/"
	OAuthAccessTokenAPI   = APIBasesURL + "oauth/access_token"
	PostAPI               = APIBasesURL + "posts"
	StreamBaseURL         = PostAPI + "/" + "streams"
	StreamMeAPI           = StreamBaseURL + "/me"
	StreamUnifiedAPI      = StreamBaseURL + "/unified"
	StreamGlobalAPI       = StreamBaseURL + "/global"
	StreamTabBaseURL      = PostAPI + "/" + "tag"
	UserAPI               = APIBasesURL + "users"
	UserMeAPI             = UserAPI + "/me"
	MeChannelsBaseURL     = UserMeAPI + "/channels"
	UnreadPMNumberAPI     = MeChannelsBaseURL + "/num_unread/pm"
	SubscribedChannelsAPI = MeChannelsBaseURL + "/subscribed"
	MutedChannelsAPI      = MeChannelsBaseURL + "/muted"
	MeMessagesAPI         = UserMeAPI + "/messages"
	ChannelAPI            = APIBasesURL + "channels"
	PresenceAPI           = APIBasesURL + "presence"
	ClientAPI             = APIBasesURL + "clients"
	MarkerAPI             = APIBasesURL + "markers"
	FileAPI               = APIBasesURL + "files"
)

pnut.io v0 API endpoints, see https://pnut.io/docs/implementation/overview

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Full  Full  `json:"full"`
	Write Write `json:"write"`
	Read  Read  `json:"read"`
}

ACL object definition

type API

type API struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

API definition

type AccessTokenResult

type AccessTokenResult struct {
	AccessToken string `json:"access_token"`
	Token       Token  `json:"token"`
	UserID      string `json:"user_id"`
	Username    string `json:"username"`
}

AccessTokenResult object

type Action

type Action struct {
	PaginationID string `json:"pagination_id"`
	EventDate    string `json:"event_date"`
	Action       string `json:"action"`
	Users        []User `json:"users"`
	Objects      []Post `json:"objects"`
}

Action object definition

type ActionsResult

type ActionsResult struct {
	*CommonResponse
	Data []Action `json:"data"`
}

ActionsResult response definition

type App

type App struct {
	ID   string `json:"id"`
	Link string `json:"link"`
	Name string `json:"name"`
}

App or client object, https://pnut.io/docs/resources/clients

type AudioInfo

type AudioInfo struct {
	Duration       int    `json:"duration"`
	DurationString string `json:"duration_string"`
	Bitrate        int    `json:"bitrate"`
}

AudioInfo object definition

type Channel

type Channel struct {
	CreatedAt     string          `json:"created_at"`
	ID            string          `json:"id"`
	Type          string          `json:"type"`
	Owner         User            `json:"owner"`
	ACL           ACL             `json:"acl"`
	Counts        CountsOfChannel `json:"counts"`
	YouSubscribed bool            `json:"you_subscribed"`
	YouMuted      bool            `json:"you_muted"`
	HasUnread     bool            `json:"has_unread"`
	PaginationID  string          `json:"pagination_id"`
}

Channel object definition

type ChannelResult

type ChannelResult struct {
	*CommonResponse
	Data Channel `json:"data"`
}

ChannelResult is a response containing a channel object

type ChannelsResult

type ChannelsResult struct {
	*CommonResponse
	Data []Channel `json:"data"`
}

ChannelsResult is a response containing multiple channel objects

type Client

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

Client object definition

func NewClient

func NewClient(clientID string, clientSecret string) *Client

NewClient returns a new client based on the specified ClientID and ClientSecret

func (*Client) AccessToken

func (c *Client) AccessToken(code string, redirectURI string) (result AccessTokenResult, err error)

AccessToken retrieves an access token using an authorization code https://pnut.io/docs/authentication/web-flows

func (*Client) AccessTokenFromPassword

func (c *Client) AccessTokenFromPassword(username string, password string, scope []string) (result AccessTokenResult, err error)

AccessTokenFromPassword retrieves an access token from using a password https://pnut.io/docs/authentication/password-flow

func (*Client) AuthURL

func (c *Client) AuthURL(redirectURI string, scope []string, responseType string) string

AuthURL generates an authorization url https://pnut.io/docs/authentication/web-flows

func (*Client) Block

func (c *Client) Block(id string) (result UserResult, err error)

Block a user https://pnut.io/docs/resources/users/blocking#put-users-id-block

func (*Client) Bookmark

func (c *Client) Bookmark(id string) (result PostResult, err error)

Bookmark creates a bookmark (stars) a post https://pnut.io/docs/resources/posts/bookmarks#put-posts-id-bookmark

func (*Client) CreateChannel

func (c *Client) CreateChannel(typeStr string, acl ACL) (result ChannelResult, err error)

CreateChannel creates a new channel https://pnut.io/docs/resources/channels/lifecycle#post-channels

func (*Client) CreateFile

func (c *Client) CreateFile(params map[string]string, reader io.Reader) (result FileResult, err error)

CreateFile upload a complete file https://pnut.io/docs/resources/files/lifecycle#post-files

func (*Client) CreateFilePlaceholder

func (c *Client) CreateFilePlaceholder(params File) (result FileResult, err error)

CreateFilePlaceholder create a file placeholder https://pnut.io/docs/resources/files/lifecycle#post-files

func (*Client) CreateMessage

func (c *Client) CreateMessage(id string, params NewMessage) (result PostResult, err error)

CreateMessage creates a new message https://pnut.io/docs/resources/messages/lifecycle#post-channels-id-messages

func (*Client) DeleteChannel

func (c *Client) DeleteChannel(id string) (result ChannelResult, err error)

DeleteChannel deletes an existing channel https://pnut.io/docs/resources/channels/lifecycle#delete-channels-id

func (*Client) DeleteFile

func (c *Client) DeleteFile(id string) (result FileResult, err error)

DeleteFile delete a file. This will not disassociate a file with any other objects (posts, messages...) https://pnut.io/docs/resources/files/lifecycle#delete-files-id

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(channelID string, messageID string) (result PostResult, err error)

DeleteMessage deletes a specific message https://pnut.io/docs/resources/messages/lifecycle#delete-channels-id-messages-id

func (*Client) DeletePost

func (c *Client) DeletePost(id string) (result PostResult, err error)

DeletePost deletes a post https://pnut.io/docs/resources/posts/lifecycle#delete-posts-id

func (*Client) Follow

func (c *Client) Follow(id string) (result UserResult, err error)

Follow a user https://pnut.io/docs/resources/users/following#put-users-id-follow

func (*Client) GetActions

func (c *Client) GetActions(id string, v ...url.Values) (result ActionsResult, err error)

GetActions retrieves actions https://pnut.io/docs/resources/posts/interactions#get-posts-id-interactions

func (*Client) GetActionsForMe

func (c *Client) GetActionsForMe(v ...url.Values) (result ActionsResult, err error)

GetActionsForMe retireve a users actions https://pnut.io/docs/resources/users/interactions#get-users-me-interactions

func (*Client) GetAvatarURL

func (c *Client) GetAvatarURL(id string, v ...url.Values) (url string, err error)

GetAvatarURL retrieves a users avatar URL https://pnut.io/docs/resources/users/profile#get-users-id-avatar

func (*Client) GetBlocked

func (c *Client) GetBlocked() (result UsersResult, err error)

GetBlocked retrieve blocked users https://pnut.io/docs/resources/users/muting#get-users-id-blocked

func (*Client) GetBookmarks

func (c *Client) GetBookmarks(id string, count ...int) (result PostsResult, err error)

GetBookmarks retrieve a users bookmarks https://pnut.io/docs/resources/posts/bookmarks#get-users-id-bookmarks

func (*Client) GetChannel

func (c *Client) GetChannel(id string) (result ChannelResult, err error)

GetChannel retrieves the channel object from the channel ID https://pnut.io/docs/resources/channels/lookup#get-channels-id

func (*Client) GetChannels

func (c *Client) GetChannels(ids []string) (result UsersResult, err error)

GetChannels retrieves a list of channels from the provided channel IDs https://pnut.io/docs/resources/channels/lookup#get-channels

func (*Client) GetChannelsByMe

func (c *Client) GetChannelsByMe() (result ChannelsResult, err error)

GetChannelsByMe retireves channels created by user https://pnut.io/docs/resources/channels/lookup#get-users-me-channels

func (*Client) GetClient

func (c *Client) GetClient(id string) (result ClientInfoResult, err error)

GetClient retrieves client object based on the id https://pnut.io/docs/resources/clients#get-clients-id

func (*Client) GetClients

func (c *Client) GetClients(id string) (result ClientInfosResult, err error)

GetClients retrieves client information https://pnut.io/docs/resources/clients#get-users-id-clients

func (*Client) GetCoverURL

func (c *Client) GetCoverURL(id string, v ...url.Values) (url string, err error)

GetCoverURL retireves a cover URL https://pnut.io/docs/resources/users/profile#get-users-id-cover

func (*Client) GetFile

func (c *Client) GetFile(id string) (result FileResult, err error)

GetFile retrieve a file object https://pnut.io/docs/resources/files/lookup#get-files-id

func (*Client) GetFiles

func (c *Client) GetFiles(ids []string) (result FilesResult, err error)

GetFiles retrieve multiple file objects https://pnut.io/docs/resources/files/lookup#get-files

func (*Client) GetFollowers

func (c *Client) GetFollowers(id string, count ...int) (result UsersResult, err error)

GetFollowers retrieve followers list https://pnut.io/docs/resources/users/followers#get-users-id-followers

func (*Client) GetFollowing

func (c *Client) GetFollowing(id string, count ...int) (result UsersResult, err error)

GetFollowing retrieve following list https://pnut.io/docs/resources/users/following#get-users-id-following

func (*Client) GetMentions

func (c *Client) GetMentions(id string, count ...int) (result PostsResult, err error)

GetMentions retrieves mentions https://pnut.io/docs/resources/posts/streams#get-users-id-mentions

func (*Client) GetMessage

func (c *Client) GetMessage(channelID string, messageID string) (result PostResult, err error)

GetMessage retrieves a specific message from a channel https://pnut.io/docs/resources/messages/lookup#get-channels-id-messages-id

func (*Client) GetMessages

func (c *Client) GetMessages(ids []string) (result PostsResult, err error)

GetMessages retrieves multiple messages https://pnut.io/docs/resources/messages/lookup#get-messages

func (*Client) GetMessagesByMe

func (c *Client) GetMessagesByMe() (result MessagesResult, err error)

GetMessagesByMe retireves messages created by user https://pnut.io/docs/resources/messages/lookup#get-users-me-messages

func (*Client) GetMessagesInThread

func (c *Client) GetMessagesInThread(channelID string, messageID string) (result PostsResult, err error)

GetMessagesInThread retrieves messages in a thread from a channel https://pnut.io/docs/resources/messages/lookup#get-channels-id-messages-id-thread

func (*Client) GetMessagesOfChannel

func (c *Client) GetMessagesOfChannel(id string) (result PostsResult, err error)

GetMessagesOfChannel retrieves messages bashed on channel ID https://pnut.io/docs/resources/messages/lookup#get-channels-id-messages

func (*Client) GetMuted

func (c *Client) GetMuted() (result UsersResult, err error)

GetMuted retrieve muted users https://pnut.io/docs/resources/users/muting#get-users-id-muted

func (*Client) GetMutedChannels

func (c *Client) GetMutedChannels() (result ChannelsResult, err error)

GetMutedChannels retrieves list of muted channels https://pnut.io/docs/resources/channels/muting#get-users-me-channels-muted

func (*Client) GetNumberOfUnreadPM

func (c *Client) GetNumberOfUnreadPM() (result NumberResult, err error)

GetNumberOfUnreadPM retireves the number of unread private messages https://pnut.io/docs/resources/channels/lookup#get-users-me-channels-num_unread-pm

func (*Client) GetPost

func (c *Client) GetPost(id string) (result PostResult, err error)

GetPost retrieves a post https://pnut.io/docs/resources/posts/lookup#get-posts-id

func (*Client) GetPostRevisions

func (c *Client) GetPostRevisions(id string) (result PostsResult, err error)

GetPostRevisions retrieves a list of reviesions of a post https://pnut.io/docs/resources/posts/lookup#get-posts-id-revisions

func (*Client) GetPosts

func (c *Client) GetPosts(ids []string) (result PostsResult, err error)

GetPosts retrieves mutliple posts https://pnut.io/docs/resources/posts/lookup#get-posts

func (*Client) GetPostsFromUser

func (c *Client) GetPostsFromUser(id string, count ...int) (result PostsResult, err error)

GetPostsFromUser retrieve posts from a user https://pnut.io/docs/resources/posts/streams#get-users-id-posts

func (*Client) GetPresence

func (c *Client) GetPresence(id string) (result PresenceResult, err error)

GetPresence retrieve presence user https://pnut.io/docs/resources/users/presence#get-users-id-presence

func (*Client) GetPresences

func (c *Client) GetPresences() (result PresencesResult, err error)

GetPresences retrieves precense https://pnut.io/docs/resources/users/presence#get-presence

func (*Client) GetStickyMessages

func (c *Client) GetStickyMessages(id string) (result PostsResult, err error)

GetStickyMessages retrives sticky messages https://pnut.io/docs/resources/messages/sticky#get-channels-id-sticky_messages

func (*Client) GetSubscribedChannels

func (c *Client) GetSubscribedChannels() (result ChannelsResult, err error)

GetSubscribedChannels retrieves list of subscribed channels https://pnut.io/docs/resources/channels/subscribing#get-users-me-channels-subscribed

func (*Client) GetSubscribersOfChannel

func (c *Client) GetSubscribersOfChannel(id string) (result UsersResult, err error)

GetSubscribersOfChannel retrives a list of subscribers from a channel ID https://pnut.io/docs/resources/channels/subscribing#get-channels-id-subscribers

func (*Client) GetThread

func (c *Client) GetThread(id string) (result PostsResult, err error)

GetThread retrieves post in a given thread https://pnut.io/docs/resources/posts/threads#get-posts-id-thread

func (*Client) GetUser

func (c *Client) GetUser(id string) (result UserResult, err error)

GetUser retrieves a user https://pnut.io/docs/resources/users/lookup#get-users-id

func (*Client) GetUserFiles

func (c *Client) GetUserFiles() (result FilesResult, err error)

GetUserFiles retrieve the authenticated users file objects https://pnut.io/docs/resources/files/lookup#get-users-me-files

func (*Client) GetUsers

func (c *Client) GetUsers(ids []string) (result UsersResult, err error)

GetUsers retrieves multiple users https://pnut.io/docs/resources/users/lookup#get-users

func (*Client) GlobalStream

func (c *Client) GlobalStream(count ...int) (result PostsResult, err error)

GlobalStream retrieves the global stream https://pnut.io/docs/resources/posts/streams#get-posts-streams-unified

func (*Client) MarkReadPM

func (c *Client) MarkReadPM() (result NumberResult, err error)

MarkReadPM marks private messages as read https://pnut.io/docs/resources/channels/lookup#delete-users-me-channels-num_unread-pm

func (*Client) MeStream

func (c *Client) MeStream(count ...int) (result PostsResult, err error)

MeStream retrieves a personal stream https://pnut.io/docs/resources/posts/streams#get-posts-streams-me

func (*Client) Mute

func (c *Client) Mute(id string) (result UserResult, err error)

Mute a user https://pnut.io/docs/resources/users/muteing#put-users-id-mute

func (*Client) MuteChannel

func (c *Client) MuteChannel(id string) (result ChannelResult, err error)

MuteChannel mutes notifications for a channel https://pnut.io/docs/resources/channels/muting#put-channels-id-mute

func (*Client) Post

func (c *Client) Post(params NewPost) (result PostResult, err error)

Post creates a post https://pnut.io/docs/resources/posts/lifecycle#post-posts

func (*Client) ReplaceProfile

func (c *Client) ReplaceProfile(json string) (result UserResult, err error)

ReplaceProfile replaces a user profile this func will be updated https://pnut.io/docs/resources/users/profile#put-users-me

func (*Client) Repost

func (c *Client) Repost(id string) (result PostResult, err error)

Repost repeats a post https://pnut.io/docs/resources/posts/reposts#put-posts-id-repost

func (*Client) RevisePost

func (c *Client) RevisePost(id string, params NewPost) (result PostResult, err error)

RevisePost updates an existing post https://pnut.io/docs/resources/posts/lifecycle#put-posts-id

func (*Client) SetAccessToken

func (c *Client) SetAccessToken(accessToken string)

SetAccessToken sets the access token for use by the client https://pnut.io/docs/authentication/web-flows https://pnut.io/docs/authentication/password-flow

func (*Client) SetMarker

func (c *Client) SetMarker(json string) (result MarkersResult, err error)

SetMarker sets the current read marker this func will be updated https://pnut.io/docs/resources/stream-marker https://pnut.io/docs/resources/stream-marker#post-markers

func (*Client) SetPasswordGrantSecret

func (c *Client) SetPasswordGrantSecret(passwordGrantSecret string)

SetPasswordGrantSecret sets the password grant secret needed for password flow authentication https://pnut.io/docs/authentication/password-flow

func (*Client) SetPresence

func (c *Client) SetPresence(presence string) (result PresenceResult, err error)

SetPresence for user https://pnut.io/docs/resources/users/presence#put-users-id-presence

func (*Client) Sticky

func (c *Client) Sticky(channelID string, messageID string) (result PostResult, err error)

Sticky sets a message as sticky https://pnut.io/docs/resources/messages/sticky#put-channels-id-messages-id-sticky

func (*Client) SubscribeChannel

func (c *Client) SubscribeChannel(id string) (result ChannelResult, err error)

SubscribeChannel subscribes the authenticated user to a channel https://pnut.io/docs/resources/channels/subscribing#put-channels-id-subscribe

func (*Client) TagStream

func (c *Client) TagStream(tag string, count ...int) (result PostsResult, err error)

TagStream retrieves a stream for a given tag https://pnut.io/docs/resources/posts/streams#get-posts-tag-tag

func (*Client) UnBlock

func (c *Client) UnBlock(id string) (result UserResult, err error)

UnBlock a user https://pnut.io/docs/resources/posts/bookmarks#delete-posts-id-bookmark

func (*Client) UnBookmark

func (c *Client) UnBookmark(id string) (result PostResult, err error)

UnBookmark deletes a bookmark (unstars) a post https://pnut.io/docs/resources/posts/bookmarks#put-posts-id-bookmark

func (*Client) UnFollow

func (c *Client) UnFollow(id string) (result UserResult, err error)

UnFollow a user https://pnut.io/docs/resources/users/following#delete-users-id-follow

func (*Client) UnMute

func (c *Client) UnMute(id string) (result UserResult, err error)

UnMute a user https://pnut.io/docs/resources/users/muting#delete-users-id-mute

func (*Client) UnMuteChannel

func (c *Client) UnMuteChannel(id string) (result ChannelResult, err error)

UnMuteChannel unmutes notifications for a channel https://pnut.io/docs/resources/channels/muting#delete-channels-id-mute

func (*Client) UnRepost

func (c *Client) UnRepost(id string) (result PostResult, err error)

UnRepost removes a repeated post https://pnut.io/docs/resources/posts/reposts#delete-posts-id-repost

func (*Client) UnSticky

func (c *Client) UnSticky(channelID string, messageID string) (result PostResult, err error)

UnSticky unsets a message as sticky https://pnut.io/docs/resources/messages/sticky#delete-channels-id-messages-id-sticky

func (*Client) UnSubscribeChannel

func (c *Client) UnSubscribeChannel(id string) (result ChannelResult, err error)

UnSubscribeChannel unsubscribes the authenticated user from a channel https://pnut.io/docs/resources/channels/subscribing#delete-channels-id-subscribe

func (*Client) UnifiedStream

func (c *Client) UnifiedStream(count ...int) (result PostsResult, err error)

UnifiedStream retrieves a unified stream https://pnut.io/docs/resources/posts/streams#get-posts-streams-unified

func (*Client) UpdateChannel

func (c *Client) UpdateChannel(id string, acl ACL) (result ChannelResult, err error)

UpdateChannel updates an existing channel https://pnut.io/docs/resources/channels/lifecycle#put-channels-id

func (*Client) UpdateFileDetails

func (c *Client) UpdateFileDetails(id string, details FileDetails) (result FileResult, err error)

UpdateFileDetails updates a files details, only name, is_public, and raw https://pnut.io/docs/resources/files/lifecycle#put-files-id

func (*Client) UpdateProfile

func (c *Client) UpdateProfile(json string) (result UserResult, err error)

UpdateProfile updates a user profile this func will be updated https://pnut.io/docs/resources/users/profile#patch-users-me

func (*Client) UploadAvatar

func (c *Client) UploadAvatar(params map[string]string, reader io.Reader) (result UserResult, err error)

UploadAvatar updates a user avatar https://pnut.io/docs/resources/users/profile#post-users-me-avatar

func (*Client) UploadCover

func (c *Client) UploadCover(params map[string]string, reader io.Reader) (result UserResult, err error)

UploadCover updates a cover image https://pnut.io/docs/resources/users/profile#post-users-me-cover

type ClientInfo

type ClientInfo struct {
	CreatedAt string          `json:"created_at"`
	CreatedBy User            `json:"created_by"`
	ID        string          `json:"id"`
	Link      string          `json:"link"`
	Name      string          `json:"name"`
	Posts     int             `json:"posts"`
	Content   ContentOfClient `json:"content"`
}

ClientInfo object definition

type ClientInfoResult

type ClientInfoResult struct {
	*CommonResponse
	Data ClientInfo `json:"data"`
}

ClientInfoResult object, https://pnut.io/docs/resources/clients

type ClientInfosResult

type ClientInfosResult struct {
	*CommonResponse
	Data []ClientInfo `json:"data"`
}

ClientInfosResult response object

type CommonResponse

type CommonResponse struct {
	Meta Meta `json:"meta"`
}

CommonResponse response object

type ContentOfClient

type ContentOfClient struct {
	*ContentOfMessage
}

ContentOfClient object definition

type ContentOfMessage

type ContentOfMessage struct {
	HTML     string   `json:"html"`
	Text     string   `json:"text"`
	Entities Entities `json:"entities"`
}

ContentOfMessage object definition

type ContentOfPost

type ContentOfPost struct {
	Text           string   `json:"text"`
	HTML           string   `json:"html"`
	Entities       Entities `json:"entities"`
	LinksNotParsed bool     `json:"links_not_parsed"`
}

ContentOfPost object definition

type ContentOfUser

type ContentOfUser struct {
	Text        string   `json:"text"`
	HTML        string   `json:"html"`
	Entities    Entities `json:"entities"`
	AvatarImage Image    `json:"avatar_image"`
	CoverImage  Image    `json:"cover_image"`
}

ContentOfUser object definition

type CountsOfChannel

type CountsOfChannel struct {
	Messages    int `json:"messages"`
	Subscribers int `json:"subscribers"`
}

CountsOfChannel object definition

type CountsOfMessage

type CountsOfMessage struct {
	Replies int `json:"replies"`
}

CountsOfMessage object definition

type CountsOfPost

type CountsOfPost struct {
	Bookmarks int `json:"bookmarks"`
	Replies   int `json:"replies"`
	Reposts   int `json:"reposts"`
	Threads   int `json:"threads"`
}

CountsOfPost object definition

type CountsOfUser

type CountsOfUser struct {
	Bookmarks int `json:"bookmarks"`
	Clients   int `json:"clients"`
	Followers int `json:"followers"`
	Following int `json:"following"`
	Posts     int `json:"posts"`
	Users     int `json:"users"`
}

CountsOfUser object definition

type Entities

type Entities struct {
	Links    []Links    `json:"links"`
	Mentions []Mentions `json:"mentions"`
	Tags     []Tags     `json:"tags"`
}

Entities object definition

type File

type File struct {
	AudioInfo        AudioInfo        `json:"audio_info"`
	CreatedAt        string           `json:"created_at"`
	FileToken        string           `json:"file_token"`
	FileTokenRead    string           `json:"file_token_read"`
	ID               string           `json:"id"`
	ImageInfo        Image            `json:"image_info"`
	IsComplete       bool             `json:"is_complete"`
	IsPublic         bool             `json:"is_public"`
	Kind             string           `json:"kind"`
	Link             string           `json:"link"`
	LinkExpiresAt    string           `json:"link_expires_at"`
	LinkShort        string           `json:"link_short"`
	MimeType         string           `json:"mime_type"`
	Name             string           `json:"name"`
	Sha256           string           `json:"sha256"`
	Size             int              `json:"size"`
	Source           Source           `json:"source"`
	Type             string           `json:"type"`
	UploadParameters UploadParameters `json:"upload_parameters"`
	User             User             `json:"user"`
	VideoInfo        VideoInfo        `json:"video_info"`
}

File object definition

type FileDetails

type FileDetails struct {
	Name     string `json:"name"`
	IsPublic bool   `json:"is_public"`
}

FileDetails object definition

type FileResult

type FileResult struct {
	*CommonResponse
	Data File `json:"data"`
}

FileResult response definition

type FilesResult

type FilesResult struct {
	*CommonResponse
	Data []File `json:"data"`
}

FilesResult response definition

type Full

type Full struct {
	Immutable bool     `json:"immutable"`
	You       bool     `json:"you"`
	UserIds   []string `json:"user_ids"`
}

Full object definition

type Image

type Image struct {
	Link      string `json:"link"`
	IsDefault bool   `json:"is_default"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
}

Image object definition

type Links struct {
	Link        string `json:"link"`
	Text        string `json:"text"`
	Len         int    `json:"len"`
	Pos         int    `json:"pos"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

Links object definition

type Marker

type Marker struct {
	ID         string `json:"id"`
	LastReadID string `json:"last_read_id"`
	Percentage int    `json:"percentage"`
	UpdatedAt  string `json:"updated_at"`
	Version    string `json:"version"`
	Name       string `json:"name"`
}

Marker object definition

type MarkersResult

type MarkersResult struct {
	*CommonResponse
	Data []Marker `json:"data"`
}

MarkersResult response object

type Mentions

type Mentions struct {
	ID        string `json:"id"`
	Len       int    `json:"len"`
	Pos       int    `json:"pos"`
	Text      string `json:"text"`
	IsLeading bool   `json:"is_leading"`
	IsCopy    bool   `json:"is_copy"`
}

Mentions object definition

type Message

type Message struct {
	ID           string           `json:"id"`
	ChannelID    string           `json:"channel_id"`
	CreatedAt    string           `json:"created_at"`
	Source       Source           `json:"source"`
	IsDeleted    bool             `json:"is_deleted"`
	IsSticky     bool             `json:"is_sticky"`
	ReplyTo      string           `json:"reply_to"`
	ThreadID     string           `json:"thread_id"`
	User         User             `json:"user"`
	Counts       CountsOfMessage  `json:"counts"`
	Content      ContentOfMessage `json:"content"`
	PaginationID string           `json:"pagination_id"`
}

Message object definition

type MessagesResult

type MessagesResult struct {
	*CommonResponse
	Data []Message `json:"data"`
}

MessagesResult response object

type Meta

type Meta struct {
	*StreamMeta
	Code         int    `json:"code"`
	Error        string `json:"error"`
	ErrorMessage string `json:"error_message"`
}

Meta object definiton

type NewMessage

type NewMessage struct {
	Text               string `json:"text"`
	ParseLinks         string `json:"entities.parse_links,omitempty"`
	ParseMarkdownLinks string `json:"entities.parse_markdown_links,omitempty"`
	Nsfw               string `json:"is_nsfw,omitempty"`
	Raw                []Raw  `json:"raw"`
	ReplyTo            string `json:"reply_to,omitempty"`
}

type NewPost

type NewPost struct {
	Text               string `json:"text"`
	ParseLinks         string `json:"entities.parse_links,omitempty"`
	ParseMarkdownLinks string `json:"entities.parse_markdown_links,omitempty"`
	Nsfw               string `json:"is_nsfw,omitempty"`
	Raw                []Raw  `json:"raw"`
	ReplyTo            string `json:"reply_to,omitempty"`
}

type NumberResult

type NumberResult struct {
	*CommonResponse
	Data int `json:"data"`
}

NumberResult response object

type Post

type Post struct {
	CreatedAt     string        `json:"created_at"`
	GUID          string        `json:"guid"`
	ID            string        `json:"id"`
	IsDeleted     bool          `json:"is_deleted"`
	Source        Source        `json:"source"`
	User          User          `json:"user"`
	ThreadID      string        `json:"thread_id"`
	IsRevised     bool          `json:"is_revised"`
	Revision      string        `json:"revision"`
	ReplyTo       string        `json:"reply_to"`
	RepostOf      *Post         `json:"repost_of"`
	Counts        CountsOfPost  `json:"counts"`
	Content       ContentOfPost `json:"content"`
	YouBookmarked bool          `json:"you_bookmarked"`
	YouReposted   bool          `json:"you_reposted"`
	PaginationID  string        `json:"pagination_id"`
}

Post object definition

type PostResult

type PostResult struct {
	*CommonResponse
	Data Post `json:"data"`
}

PostResult response definition

type PostsResult

type PostsResult struct {
	*CommonResponse
	Data []Post `json:"data"`
}

PostsResult response definition

type Presence

type Presence struct {
	ID         string `json:"id"`
	LastSeenAt string `json:"last_seen_at"`
	Presence   string `json:"presence"`
}

Presence object definition

type PresenceResult

type PresenceResult struct {
	*CommonResponse
	Data Presence `json:"data"`
}

PresenceResult response object

type PresencesResult

type PresencesResult struct {
	*CommonResponse
	Data []Presence `json:"data"`
}

PresencesResult response object

type Raw

type Raw struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

Raw object definition

type Read

type Read struct {
	*Write
	Public bool `json:"publicj"`
}

Read object definition

type Source

type Source struct {
	Name string `json:"name"`
	Link string `json:"link"`
	ID   string `json:"id"`
}

Source object definition

type StreamMeta

type StreamMeta struct {
	More  bool   `json:"more"`
	MaxID string `json:"max_id"`
	MinID string `json:"min_id"`
}

StreamMeta meta object definition

type StringResult

type StringResult struct {
	Data string `json:"data"`
}

StringResult resposne object

type Tags

type Tags struct {
	Len  int    `json:"len"`
	Pos  int    `json:"pos"`
	Text string `json:"text"`
}

Tags object definition

type Token

type Token struct {
	App      App      `json:"app"`
	Scopes   []string `json:"scopes"`
	User     User     `json:"user"`
	ClientID string   `json:"client_id"`
}

Token object, https://pnut.io/docs/resources/token

type UploadParameters

type UploadParameters struct {
	Method string `json:"method"`
	Url    string `json:"url"`
}

UploadParameters object definition

type User

type User struct {
	CreatedAt    string        `json:"created_at"`
	GUID         string        `json:"guid"`
	ID           string        `json:"id"`
	Locale       string        `json:"locale"`
	Timezone     string        `json:"timezon"`
	Type         string        `json:"type"`
	Username     string        `json:"username"`
	Name         string        `json:"name"`
	Content      ContentOfUser `json:"content"`
	Counts       CountsOfUser  `json:"counts"`
	FollowsYou   bool          `json:"follows_you"`
	YouBlocked   bool          `json:"you_blocked"`
	YouFollow    bool          `json:"you_follow"`
	YouMuted     bool          `json:"you_muted"`
	YouCanFollow bool          `json:"you_can_follow"`
	Verified     Verified      `json:"verified"`
}

User object definition

type UserResult

type UserResult struct {
	*CommonResponse
	Data User `json:"data"`
}

UserResult user response object

type UsersResult

type UsersResult struct {
	*CommonResponse
	Data []User `json:"data"`
}

UsersResult response object

type Verified

type Verified struct {
	Domain string `json:"domain"`
	Link   string `json:"link"`
}

Verified object definition

type VideoInfo

type VideoInfo struct {
	Duration       int    `json:"duration"`
	DurationString string `json:"duration_string"`
	Bitrate        int    `json:"bitrate"`
	Height         int    `json:"height"`
	Width          int    `json:"width"`
}

VideoInfo object definition

type Write

type Write struct {
	*Full
	AnyUser bool `json:"any_user"`
}

Write object definition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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