tapestry

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

README

Tapestry Bindings for Go

API tests

Bindings for the Tapestry API.

Tapestry documentation: https://docs.usetapestry.dev/documentation/what-is-tapestry

Tapestry API reference: https://tapestry.apidocumentation.com/reference

Completness

All current endpoints are implemented.

API tests cover endpoints except for:

  • GET /api/v1/profiles/__ID__/following-who-follow
  • GET /api/v1/profiles/suggested/__ADDRESS__

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Namespace string `json:"namespace"`
	ID        string `json:"id"`
	Username  string `json:"username"`
	Bio       string `json:"bio"`
	Image     string `json:"image"`
}

type AuthorProfile

type AuthorProfile struct {
	ID        string        `json:"id"`
	Username  string        `json:"username"`
	Bio       string        `json:"bio"`
	Image     string        `json:"image"`
	CreatedAt UnixTimestamp `json:"created_at"`
}

type BatchResponseContentListItem added in v0.2.1

type BatchResponseContentListItem struct {
	Content      Content      `json:"content"`
	SocialCounts SocialCounts `json:"socialCounts"`
}

type Comment

type Comment struct {
	Namespace string        `json:"namespace"`
	CreatedAt UnixTimestamp `json:"created_at"`
	Text      string        `json:"text"`
	ID        string        `json:"id"`
}

type CommentData

type CommentData struct {
	Comment                     Comment                `json:"comment"`
	ContentID                   string                 `json:"contentId"`
	Author                      Author                 `json:"author"`
	SocialCounts                SocialCounts           `json:"socialCounts"`
	RequestingProfileSocialInfo map[string]interface{} `json:"requestingProfileSocialInfo"`
	RecentReplies               []CommentData          `json:"recentReplies,omitempty"`
}

type CommentProperty

type CommentProperty struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Content

type Content struct {
	Namespace   string        `json:"namespace"`
	ID          string        `json:"id"`
	Description string        `json:"description"`
	Title       string        `json:"title"`
	CreatedAt   UnixTimestamp `json:"created_at"`
}

type ContentListItem

type ContentListItem struct {
	AuthorProfile               AuthorProfile               `json:"authorProfile"`
	Content                     Content                     `json:"content"`
	SocialCounts                SocialCounts                `json:"socialCounts"`
	RequestingProfileSocialInfo RequestingProfileSocialInfo `json:"requestingProfileSocialInfo"`
}

type ContentProperty

type ContentProperty struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type CreateCommentOptions

type CreateCommentOptions struct {
	ContentID  string            `json:"contentId"`
	ProfileID  string            `json:"profileId"`
	Text       string            `json:"text"`
	CommentID  string            `json:"commentId"`
	Properties []CommentProperty `json:"properties"`
}

type CreateCommentRequest

type CreateCommentRequest struct {
	CreateCommentOptions
	Execution string `json:"execution"`
}

type CreateCommentResponse

type CreateCommentResponse struct {
	Comment
}

type CreateLikeRequest

type CreateLikeRequest struct {
	StartId   string `json:"startId"`
	Execution string `json:"execution"`
}

type CreateOrUpdateContentResponse

type CreateOrUpdateContentResponse struct{ Content }

type DeleteLikeRequest

type DeleteLikeRequest struct {
	StartId string `json:"startId"`
}

type Execution added in v0.1.1

type Execution string
const (
	ExecutionFastUnconfirmed Execution = "FAST_UNCONFIRMED"
	ExecutionQuickSignature  Execution = "QUICK_SIGNATURE"
	ExecutionConfirmedParsed Execution = "CONFIRMED_AND_PARSED"
)

type FindOrCreateContentRequest added in v0.1.1

type FindOrCreateContentRequest struct {
	ProfileID  string            `json:"profileId"`
	ID         string            `json:"id,omitempty"`
	Properties []ContentProperty `json:"properties"`
}

type FindOrCreateProfileParameters

type FindOrCreateProfileParameters struct {
	WalletAddress string `json:"walletAddress"`
	Username      string `json:"username"`
	Bio           string `json:"bio,omitempty"`
	Image         string `json:"image,omitempty"`
	ID            string `json:"id,omitempty"`
}

type FindOrCreateProfileRequest

type FindOrCreateProfileRequest struct {
	FindOrCreateProfileParameters
	Execution  string `json:"execution,omitempty"`
	Blockchain string `json:"blockchain,omitempty"`
}

type FollowRequest added in v0.1.2

type FollowRequest struct {
	StartID string `json:"startId"`
	EndID   string `json:"endId"`
}

type GetCommentByIdResponse

type GetCommentByIdResponse struct {
	CommentData
}

type GetCommentRepliesOptions added in v0.2.2

type GetCommentRepliesOptions struct {
	RequestingProfileID string
	Page                int
	PageSize            int
}

type GetCommentsOptions

type GetCommentsOptions struct {
	ContentID           string
	CommentID           string
	ProfileID           string
	RequestingProfileID string
	Page                int
	PageSize            int
}

type GetCommentsResponse

type GetCommentsResponse struct {
	Comments []CommentData `json:"comments"`
}

type GetContentResponse

type GetContentResponse struct {
	Content      Content      `json:"content"`
	SocialCounts SocialCounts `json:"socialCounts"`
}

type GetContentsByBatchIDsResponse added in v0.2.1

type GetContentsByBatchIDsResponse struct {
	Successful []BatchResponseContentListItem `json:"successful"`
	Failed     []struct {
		ID    string `json:"id"`
		Error string `json:"error"`
	} `json:"failed"`
}

type GetContentsOption

type GetContentsOption func(*getContentsParams)

Option pattern for configurable parameters

func WithOrderBy

func WithOrderBy(field string, direction GetContentsSortDirection) GetContentsOption

func WithPagination

func WithPagination(page, pageSize string) GetContentsOption

func WithProfileID

func WithProfileID(profileID string) GetContentsOption

func WithRequestingProfileID

func WithRequestingProfileID(requestingProfileID string) GetContentsOption

type GetContentsResponse

type GetContentsResponse struct {
	Contents []ContentListItem `json:"contents"`
	Page     int               `json:"page"`
	PageSize int               `json:"pageSize"`
}

type GetContentsSortDirection

type GetContentsSortDirection string
const (
	GetContentsSortDirectionAsc  GetContentsSortDirection = "ASC"
	GetContentsSortDirectionDesc GetContentsSortDirection = "DESC"
)

type GetFollowersResponse added in v0.1.2

type GetFollowersResponse struct {
	Profiles []ProfileDetails `json:"profiles"`
}

type GetFollowingResponse added in v0.1.2

type GetFollowingResponse struct {
	Profiles []ProfileDetails `json:"profiles"`
}

type GetFollowingWhoFollowResponse added in v0.1.2

type GetFollowingWhoFollowResponse struct {
	Profiles []ProfileDetails `json:"profiles"`
}

type GetSuggestedProfilesResponse added in v0.1.2

type GetSuggestedProfilesResponse struct {
	Profiles map[string]SuggestedProfileValue
}

type Profile

type Profile struct {
	Namespace  string `json:"namespace"`
	ID         string `json:"id"`
	Blockchain string `json:"blockchain"`
	Username   string `json:"username"`
}

type ProfileDetails added in v0.1.2

type ProfileDetails struct {
	ID        string        `json:"id"`
	Username  string        `json:"username"`
	Bio       string        `json:"bio,omitempty"`
	Image     string        `json:"image,omitempty"`
	CreatedAt UnixTimestamp `json:"created_at"`
}

type ProfileResponse

type ProfileResponse struct {
	Profile       Profile `json:"profile"`
	WalletAddress string  `json:"walletAddress"`
}

type RequestingProfileSocialInfo

type RequestingProfileSocialInfo struct {
	HasLiked bool `json:"hasLiked"`
}

type SocialCounts

type SocialCounts struct {
	LikeCount    int `json:"likeCount"`
	CommentCount int `json:"commentCount"`
}

type SuggestedProfileValue added in v0.1.2

type SuggestedProfileValue struct {
	Namespaces []struct {
		Name         string `json:"name"`
		ReadableName string `json:"readableName,omitempty"`
		FaviconURL   string `json:"faviconURL,omitempty"`
	} `json:"namespaces"`
	Profile ProfileDetails `json:"profile"`
	Wallet  struct {
		Address string `json:"address"`
	} `json:"wallet"`
}

type TapestryClient

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

func NewTapestryClient

func NewTapestryClient(apiKey string, tapestryApiBaseUrl string, execution Execution, blockchain string) TapestryClient

func (*TapestryClient) AddFollower added in v0.1.2

func (c *TapestryClient) AddFollower(ctx context.Context, startID, endID string) error

func (*TapestryClient) CreateComment

func (*TapestryClient) CreateLike

func (c *TapestryClient) CreateLike(ctx context.Context, contentID string, profile Profile) error

func (*TapestryClient) DeleteComment

func (c *TapestryClient) DeleteComment(ctx context.Context, commentID string) error

func (*TapestryClient) DeleteContent

func (c *TapestryClient) DeleteContent(ctx context.Context, contentId string) error

func (*TapestryClient) DeleteLike

func (c *TapestryClient) DeleteLike(ctx context.Context, contentID string, profile Profile) error

func (*TapestryClient) FindOrCreateContent

func (c *TapestryClient) FindOrCreateContent(ctx context.Context, profileId, id string, properties []ContentProperty) (*CreateOrUpdateContentResponse, error)

func (*TapestryClient) FindOrCreateProfile

func (c *TapestryClient) FindOrCreateProfile(ctx context.Context, params FindOrCreateProfileParameters) (*ProfileResponse, error)

func (*TapestryClient) GetCommentByID

func (c *TapestryClient) GetCommentByID(ctx context.Context, commentID string, requestingProfileID string) (*GetCommentByIdResponse, error)

func (*TapestryClient) GetCommentReplies added in v0.2.2

func (c *TapestryClient) GetCommentReplies(ctx context.Context, commentID string, options GetCommentRepliesOptions) (*GetCommentsResponse, error)

func (*TapestryClient) GetComments

func (c *TapestryClient) GetComments(ctx context.Context, options GetCommentsOptions) (*GetCommentsResponse, error)

func (*TapestryClient) GetContentByID

func (c *TapestryClient) GetContentByID(ctx context.Context, contentId string) (*GetContentResponse, error)

func (*TapestryClient) GetContents

func (c *TapestryClient) GetContents(ctx context.Context, opts ...GetContentsOption) (*GetContentsResponse, error)

func (*TapestryClient) GetContentsByBatchIDs added in v0.2.1

func (c *TapestryClient) GetContentsByBatchIDs(ctx context.Context, batchIDs []string) (*GetContentsByBatchIDsResponse, error)

func (*TapestryClient) GetFollowers added in v0.1.2

func (c *TapestryClient) GetFollowers(ctx context.Context, profileID string) (*GetFollowersResponse, error)

func (*TapestryClient) GetFollowing added in v0.1.2

func (c *TapestryClient) GetFollowing(ctx context.Context, profileID string) (*GetFollowingResponse, error)

func (*TapestryClient) GetFollowingWhoFollow added in v0.1.2

func (c *TapestryClient) GetFollowingWhoFollow(ctx context.Context, profileID string, requestorID string) (*GetFollowingWhoFollowResponse, error)

func (*TapestryClient) GetProfileByID

func (c *TapestryClient) GetProfileByID(ctx context.Context, id string) (*ProfileResponse, error)

func (*TapestryClient) GetSuggestedProfiles added in v0.1.2

func (c *TapestryClient) GetSuggestedProfiles(ctx context.Context, address string, ownAppOnly bool) (*GetSuggestedProfilesResponse, error)

func (*TapestryClient) RemoveFollower added in v0.1.2

func (c *TapestryClient) RemoveFollower(ctx context.Context, startID, endID string) error

func (*TapestryClient) UpdateComment

func (c *TapestryClient) UpdateComment(ctx context.Context, commentID string, properties []CommentProperty) (*UpdateCommentResponse, error)

func (*TapestryClient) UpdateContent

func (c *TapestryClient) UpdateContent(ctx context.Context, contentId string, properties []ContentProperty) (*CreateOrUpdateContentResponse, error)

func (*TapestryClient) UpdateProfile

func (c *TapestryClient) UpdateProfile(ctx context.Context, id string, reqData UpdateProfileParameters) error

type UnixTimestamp added in v0.1.5

type UnixTimestamp int64

UnixTimestamp represents a unix timestamp that can be unmarshaled from either an integer or a 64 bit integer representation in object format

func (*UnixTimestamp) UnmarshalJSON added in v0.1.5

func (t *UnixTimestamp) UnmarshalJSON(data []byte) error

type UpdateCommentRequest

type UpdateCommentRequest struct {
	Properties []CommentProperty `json:"properties"`
}

type UpdateCommentResponse

type UpdateCommentResponse struct {
	Comment
}

type UpdateContentRequest

type UpdateContentRequest struct {
	Properties []ContentProperty `json:"properties"`
}

type UpdateProfileParameters

type UpdateProfileParameters struct {
	Username string `json:"username"`
	Bio      string `json:"bio,omitempty"`
	Image    string `json:"image,omitempty"`
}

type UpdateProfileRequest

type UpdateProfileRequest struct {
	UpdateProfileParameters
	Execution string `json:"execution,omitempty"`
}

Jump to

Keyboard shortcuts

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