woodstock

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 11 Imported by: 0

README

woodstock

A client library for pnut.io written in Go

source code - issue tracker - releases

Installation

go get mcmillian.dev/go/woodstock

Examples

New post

package main

import (
    "fmt"
    "net/url"
    "mcmillian.dev/go/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

You can open issues and merge requests to this project on GitLab.

Documentation

Index

Constants

View Source
const (
	AuthenticateURL        = "https://pnut.io/oauth/authenticate"
	APIBasesURL            = "https://api.pnut.io/v1/"
	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"
	UnreadChannelNumberAPI = MeChannelsBaseURL + "/num_unread"
	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"`
	URL  string `json:"url"`
	Name string `json:"name"`
}

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

type AttachedTo

type AttachedTo struct {
	Messages []string `json:"messages"`
	Polls    []string `json:"polls"`
	Posts    []string `json:"posts"`
}

AttachedTo object definition

type AudioEmbed added in v0.4.0

type AudioEmbed struct {
	*RawEmbed
	Genere        string `json:"genere"`
	License       string `json:"license"`
	Release       string `json:"release"`
	TrackType     string `json:"track_type"`
	EmbeddableURL string `json:"embeddable_url"`
	Duration      int    `json:"duration"`
	Bitrate       int    `json:"bitrate"`
	Title         string `json:"title"`
	ProviderName  string `json:"provider_name"`
	ProviderURL   string `json:"provider_url"`
	FileID        string `json:"file_id"`
	FileTokenRead string `json:"file_token_read"`
	URLExpiresAt  string `json:"url_expires_at"`
	URL           string `json:"url"`
}

AudioEmbed object definition

type AudioInfo

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

AudioInfo object definition

type Badge

type Badge struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Badge object definition https://pnut.io/docs/resources/users

type Channel

type Channel struct {
	ACL                    ACL                      `json:"acl"`
	Counts                 CountsOfChannel          `json:"counts"`
	CreatedAt              string                   `json:"created_at"`
	HasStickyMessages      bool                     `json:"has_sticky_messages"`
	HasUnread              bool                     `json:"has_unread"`
	ID                     string                   `json:"id"`
	IsActive               bool                     `json:"is_active"`
	Raw                    map[string][]interface{} `json:"raw"`
	RecentDeletedMessage   Message                  `json:"recent_deleted_message"`
	RecentDeletedMessageID string                   `json:"recent_deleted_message_id"`
	RecentMessage          Message                  `json:"recent_message"`
	RecentMessageID        string                   `json:"recent_message_id"`
	Type                   string                   `json:"type"`
	YouMuted               bool                     `json:"you_muted"`
	YouSubscribed          bool                     `json:"you_subscribed"`
	User                   User                     `json:"user"`
	UserID                 string                   `json:"user_id"`
}

Channel object definition https://pnut.io/docs/resources/channels

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, msg NewMessage, qparams url.Values) (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, qparams 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(qparams 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, qparams 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(qparams url.Values) (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, qparams url.Values) (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(qparams url.Values) (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, qparams 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, qparams url.Values) (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(qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (result PostsResult, err error)

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

func (*Client) GetMessagesByMe

func (c *Client) GetMessagesByMe(qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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(qparams url.Values) (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(qparams url.Values) (result ChannelsResult, err error)

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

func (*Client) GetNumberOfUnreadChannels

func (c *Client) GetNumberOfUnreadChannels(qparams url.Values) (result NumberResult, err error)

GetNumberOfUnreadChannels 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, qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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(qparams url.Values) (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, qparams url.Values) (result UsersResult, err error)

GetSubscribersOfChannel retrieves 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, qparams url.Values) (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, qparams url.Values) (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(qparams url.Values) (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, qparams url.Values) (result UsersResult, err error)

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

func (*Client) GlobalStream

func (c *Client) GlobalStream(qparams url.Values) (result PostsResult, err error)

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

func (*Client) MarkReadChannels

func (c *Client) MarkReadChannels(chantypes []string) (result NumberResult, err error)

MarkReadChannels 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(qparams url.Values) (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, qparams url.Values) (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, qparams url.Values) (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(qparams url.Values) (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"`
	User      User            `json:"created_by"`
	ID        string          `json:"id"`
	URL       string          `json:"url"`
	LogoImage string          `json:"logo_image"`
	Name      string          `json:"name"`
	Posts     int             `json:"posts"`
	Content   ContentOfClient `json:"content"`
}

ClientInfo object definition https://pnut.io/docs/resources/clients

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"`
}

ContentOfPost object definition

type ContentOfUser

type ContentOfUser struct {
	Text         string   `json:"text"`
	HTML         string   `json:"html"`
	MarkdownText string   `json:"markdown_text"`
	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"`
}

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 {
	AttachedTo       AttachedTo               `json:"attached_to"`
	AudioInfo        AudioInfo                `json:"audio_info"`
	CreatedAt        string                   `json:"created_at"`
	DerivedFiles     interface{}              `json:"derived_files"`
	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"`
	MimeType         string                   `json:"mime_type"`
	Name             string                   `json:"name"`
	Raw              map[string][]interface{} `json:"raw"`
	Sha256           string                   `json:"sha256"`
	Size             int                      `json:"size"`
	Source           Source                   `json:"source"`
	TotalSize        int                      `json:"total_size"`
	Type             string                   `json:"type"`
	User             User                     `json:"user"`
	UserID           string                   `json:"user_id"`
	URL              string                   `json:"url"`
	URLExpiresAt     string                   `json:"url_expires_at"`
	URLShort         string                   `json:"url_short"`
	UploadParameters UploadParameters         `json:"upload_parameters"`
	VideoInfo        VideoInfo                `json:"video_info"`
}

File object definition https://pnut.io/docs/resources/files

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"`
	Users     []User   `json:"users"`
}

Full object definition

type HTML5VideoEmbed added in v0.4.0

type HTML5VideoEmbed struct {
	*PhotoEmbed
	Sources []VideoSource `json:"sources"`
}

HTML5VideoEmbed object definition

type Image

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

Image object definition

type Links struct {
	AmendedLen int    `json:"amended_len"`
	Len        int    `json:"len"`
	Pos        int    `json:"pos"`
	Text       string `json:"text"`
	Title      string `json:"title"`
	URL        string `json:"url"`
}

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"`
	IsCopy    bool   `json:"is_copy"`
	IsLeading bool   `json:"is_leading"`
	Len       int    `json:"len"`
	Pos       int    `json:"pos"`
	Text      string `json:"text"`
}

Mentions object definition

type Message

type Message struct {
	ChannelID string                   `json:"channel_id"`
	Counts    CountsOfMessage          `json:"counts"`
	CreatedAt string                   `json:"created_at"`
	DeletedBy string                   `json:"deleted_by"`
	ID        string                   `json:"id"`
	IsDeleted bool                     `json:"is_deleted"`
	IsSticky  bool                     `json:"is_sticky"`
	Source    Source                   `json:"source"`
	ReplyTo   string                   `json:"reply_to"`
	ThreadID  string                   `json:"thread_id"`
	User      User                     `json:"user"`
	UserID    string                   `json:"user_id"`
	Content   ContentOfMessage         `json:"content"`
	Raw       map[string][]interface{} `json:"raw"`
}

Message object definition https://pnut.io/docs/resources/messages

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                interface{} `json:"raw"`
	ReplyTo            string      `json:"reply_to,omitempty"`
}

NewMessage object definition

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                interface{} `json:"raw"`
	ReplyTo            string      `json:"reply_to,omitempty"`
}

NewPost object definition

type NumberResult

type NumberResult struct {
	*CommonResponse
	Data map[string]int `json:"data"`
}

NumberResult response object

type PhotoEmbed added in v0.4.0

type PhotoEmbed struct {
	*RawEmbed
	Width         int    `json:"width"`
	Height        int    `json:"height"`
	Title         string `json:"title"`
	URL           string `json:"url"`
	AuthorName    string `json:"author_name"`
	AuthorURL     string `json:"author_url"`
	ProviderName  string `json:"provider_name"`
	ProviderURL   string `json:"provider_url"`
	EmbeddableURL string `json:"embeddable_url"`
}

PhotoEmbed object definition

type Poll

type Poll struct {
	ClosedAt    string                   `json:"closed_at"`
	CreatedAt   string                   `json:"created_at"`
	ID          string                   `json:"id"`
	IsAnonymous bool                     `json:"is_anonymous"`
	IsPublic    bool                     `json:"is_public"`
	MaxOptions  int                      `json:"max_options"`
	Options     []PollOption             `json:"options"`
	PollToken   string                   `json:"poll_token"`
	Prompt      string                   `json:"prompt"`
	Source      Source                   `json:"source"`
	Type        string                   `json:"type"`
	User        User                     `json:"user"`
	UserID      string                   `json:"user_id"`
	Raw         map[string][]interface{} `json:"raw"`
}

Poll object definition https://pnut.io/docs/resources/polls

type PollOption

type PollOption struct {
	Text           string   `json:"text"`
	Position       int      `json:"position"`
	IsYourResponse bool     `json:"is_your_response"`
	Respondents    int      `json:"respondents"`
	RespondentIDS  []string `json:"repondent_ids"`
}

PollOption definition

type Post

type Post struct {
	BookmarkedBy  []User                   `json:"bookmarked_by"`
	Content       ContentOfPost            `json:"content"`
	Counts        CountsOfPost             `json:"counts"`
	CreatedAt     string                   `json:"created_at"`
	ID            string                   `json:"id"`
	IsDeleted     bool                     `json:"is_deleted"`
	IsNsfw        bool                     `json:"is_nsfw"`
	IsRevised     bool                     `json:"is_revised"`
	Raw           map[string][]interface{} `json:"raw"`
	ReplyTo       string                   `json:"reply_to"`
	RepostOf      *Post                    `json:"repost_of"`
	ReposedBy     []User                   `json:"reposed_by"`
	Revision      int                      `json:"revision"`
	Source        Source                   `json:"source"`
	ThreadID      string                   `json:"thread_id"`
	User          User                     `json:"user"`
	UserID        string                   `json:"user_id"`
	YouBookmarked bool                     `json:"you_bookmarked"`
	YouReposted   bool                     `json:"you_reposted"`
}

Post object definition https://pnut.io/docs/resources/posts

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 RawEmbed added in v0.4.0

type RawEmbed struct {
	Version string `json:"version"`
	Type    string `json:"type"`
}

RawEmbed object definition common across other embed objects

type Read

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

Read object definition

type Source

type Source struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	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 {
	Badge        Badge                    `json:"badge"`
	Content      ContentOfUser            `json:"content"`
	Counts       CountsOfUser             `json:"counts"`
	CreatedAt    string                   `json:"created_at"`
	FollowsYou   bool                     `json:"follows_you"`
	ID           string                   `json:"id"`
	Locale       string                   `json:"locale"`
	Name         string                   `json:"name"`
	Timezone     string                   `json:"timezone"`
	Type         string                   `json:"type"`
	Username     string                   `json:"username"`
	YouBlocked   bool                     `json:"you_blocked"`
	YouCanFollow bool                     `json:"you_can_follow"`
	YouFollow    bool                     `json:"you_follow"`
	YouMuted     bool                     `json:"you_muted"`
	Verified     Verified                 `json:"verified"`
	Presence     string                   `json:"presence"`
	Raw          map[string][]interface{} `json:"raw"`
}

User object definition https://pnut.io/docs/resources/users

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"`
	URL    string `json:"url"`
}

Verified object definition

type VideoEmbed added in v0.4.0

type VideoEmbed struct {
	*PhotoEmbed
	HTML string `json:"html"`
}

VideoEmbed 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 VideoSource added in v0.4.0

type VideoSource struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

VideoSource 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