api

package
v0.0.0-...-45ae864 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveDidToHandle

func ResolveDidToHandle(ctx context.Context, atp *ATProto, pls *PLCServer, udid string) (string, string, error)

Types

type ATProto

type ATProto struct {
	C *xrpc.Client
}

func (*ATProto) CreateAccount

func (atp *ATProto) CreateAccount(ctx context.Context, email, handle, password string, invite *string) (*CreateAccountResp, error)

func (*ATProto) CreateSession

func (atp *ATProto) CreateSession(ctx context.Context, handle, password string) (*CreateSessionResp, error)

func (*ATProto) HandleResolve

func (atp *ATProto) HandleResolve(ctx context.Context, handle string) (string, error)

func (*ATProto) RepoCreateRecord

func (atp *ATProto) RepoCreateRecord(ctx context.Context, did, collection string, validate bool, rec interface{}) (*CreateRecordResponse, error)

func (*ATProto) RepoDeleteRecord

func (atp *ATProto) RepoDeleteRecord(ctx context.Context, did, collection, rkey string) error

func (*ATProto) SessionRefresh

func (atp *ATProto) SessionRefresh(ctx context.Context) (*xrpc.AuthInfo, error)

func (*ATProto) SyncGetRepo

func (atp *ATProto) SyncGetRepo(ctx context.Context, did string, from *string) ([]byte, error)

func (*ATProto) SyncGetRoot

func (atp *ATProto) SyncGetRoot(ctx context.Context, did string) (string, error)

type BskyApp

type BskyApp struct {
	C *xrpc.Client
}

func (*BskyApp) ActorGetSuggestions

func (b *BskyApp) ActorGetSuggestions(ctx context.Context, limit int, cursor *string) (*GetSuggestionsResp, error)

func (*BskyApp) FeedGetAuthorFeed

func (b *BskyApp) FeedGetAuthorFeed(ctx context.Context, author string, limit int, before *string) (*bsky.FeedGetAuthorFeed_Output, error)

func (*BskyApp) FeedGetTimeline

func (b *BskyApp) FeedGetTimeline(ctx context.Context, algo string, limit int, before *string) (*bsky.FeedGetTimeline_Output, error)

func (*BskyApp) FeedSetVote

func (b *BskyApp) FeedSetVote(ctx context.Context, subject *PostRef, direction string) error

func (*BskyApp) GraphGetFollows

func (b *BskyApp) GraphGetFollows(ctx context.Context, user string, limit int, before *string) (*GetFollowsResp, error)

type CreateAccountResp

type CreateAccountResp struct {
	AccessJwt      string `json:"accessJwt"`
	RefreshJwt     string `json:"refreshJwt"`
	Handle         string `json:"handle"`
	Did            string `json:"did"`
	DeclarationCid string `json:"declarationCid"`
}

type CreateOp

type CreateOp struct {
	Type        string  `json:"type" cborgen:"type"`
	SigningKey  string  `json:"signingKey" cborgen:"signingKey"`
	RecoveryKey string  `json:"recoveryKey" cborgen:"recoveryKey"`
	Handle      string  `json:"handle" cborgen:"handle"`
	Service     string  `json:"service" cborgen:"service"`
	Prev        *string `json:"prev" cborgen:"prev"`
	Sig         string  `json:"sig" cborgen:"sig,omitempty"`
}

func (*CreateOp) MarshalCBOR

func (t *CreateOp) MarshalCBOR(w io.Writer) error

func (*CreateOp) UnmarshalCBOR

func (t *CreateOp) UnmarshalCBOR(r io.Reader) (err error)

type CreateRecordResponse

type CreateRecordResponse struct {
	Uri string `json:"uri"`
	Cid string `json:"cid"`
}

type CreateSessionResp

type CreateSessionResp struct {
	AccessJwt  string `json:"accessJwt"`
	RefreshJwt string `json:"refreshJwt"`
	Handle     string `json:"handle"`
	Did        string `json:"did"`
}

type Declaration

type Declaration struct {
	Cid       string `json:"cid"`
	ActorType string `json:"actorType"`
}

type FeedItem

type FeedItem struct {
	Uri        string      `json:"uri"`
	Cid        string      `json:"cid"`
	Author     *User       `json:"author"`
	RepostedBy *User       `json:"repostedBy"`
	MyState    *MyState    `json:"myState"`
	Record     interface{} `json:"record"`
}

type GSADeclaration

type GSADeclaration struct {
	Cid       string `json:"cid"`
	ActorType string `json:"actorType"`
}

type GetFollowsResp

type GetFollowsResp struct {
	Subject *User  `json:"subject"`
	Cursor  string `json:"cursor"`
	Follows []User `json:"follows"`
}

type GetSuggestionsActor

type GetSuggestionsActor struct {
	Did         string          `json:"did"`
	Declaration *GSADeclaration `json:"declaration"`
	Handle      string          `json:"handle"`
	DisplayName string          `json:"displayName"`
	Description string          `json:"description"`
	IndexedAt   string          `json:"indexedAt"`
}

type GetSuggestionsResp

type GetSuggestionsResp struct {
	Cursor string                `json:"cursor"`
	Actors []GetSuggestionsActor `json:"actors"`
}

type GetTimelineResp

type GetTimelineResp struct {
	Cursor string     `json:"cursor"`
	Feed   []FeedItem `json:"feed"`
}

type MyState

type MyState struct {
	Repost   string `json:"repost"`
	Upvote   string `json:"upvote"`
	Downvote string `json:"downvote"`
}

type PLCServer

type PLCServer struct {
	Host string
	C    *http.Client
}

func (*PLCServer) CreateDID

func (s *PLCServer) CreateDID(ctx context.Context, sigkey *key.Key, recovery string, handle string, service string) (string, error)

func (*PLCServer) GetDocument

func (s *PLCServer) GetDocument(ctx context.Context, didstr string) (*did.Document, error)

type PostEntity

type PostEntity struct {
	Index *TextSlice `json:"index" cborgen:"index"`
	Type  string     `json:"type" cborgen:"type"`
	Value string     `json:"value" cborgen:"value"`
}

func (*PostEntity) MarshalCBOR

func (t *PostEntity) MarshalCBOR(w io.Writer) error

func (*PostEntity) UnmarshalCBOR

func (t *PostEntity) UnmarshalCBOR(r io.Reader) (err error)

type PostRecord

type PostRecord struct {
	Type      string        `json:"$type,omitempty" cborgen:"$type"`
	Text      string        `json:"text" cborgen:"text"`
	Entities  []*PostEntity `json:"entities,omitempty" cborgen:"entities"`
	Reply     *ReplyRef     `json:"reply,omitempty" cborgen:"reply"`
	CreatedAt string        `json:"createdAt" cborgen:"createdAt"`
}

func (*PostRecord) MarshalCBOR

func (t *PostRecord) MarshalCBOR(w io.Writer) error

func (*PostRecord) UnmarshalCBOR

func (t *PostRecord) UnmarshalCBOR(r io.Reader) (err error)

type PostRef

type PostRef struct {
	Uri string `json:"uri"`
	Cid string `json:"cid"`
}

func (*PostRef) MarshalCBOR

func (t *PostRef) MarshalCBOR(w io.Writer) error

func (*PostRef) UnmarshalCBOR

func (t *PostRef) UnmarshalCBOR(r io.Reader) (err error)

type RecordResponse

type RecordResponse[T any] struct {
	Uri   string `json:"uri"`
	Cid   string `json:"cid"`
	Value T      `json:"value"`
}

func RepoGetRecord

func RepoGetRecord[T any](atp *ATProto, ctx context.Context, user string, collection string, rkey string) (*RecordResponse[T], error)

type ReplyRef

type ReplyRef struct {
	Root   PostRef `json:"root" cborgen:"root"`
	Parent PostRef `json:"parent" cborgen:"parent"`
}

func (*ReplyRef) MarshalCBOR

func (t *ReplyRef) MarshalCBOR(w io.Writer) error

func (*ReplyRef) UnmarshalCBOR

func (t *ReplyRef) UnmarshalCBOR(r io.Reader) (err error)

type TID

type TID string

type TextSlice

type TextSlice struct {
	Start int64 `json:"start" cborgen:"start"`
	End   int64 `json:"end" cborgen:"end"`
}

func (*TextSlice) MarshalCBOR

func (t *TextSlice) MarshalCBOR(w io.Writer) error

func (*TextSlice) UnmarshalCBOR

func (t *TextSlice) UnmarshalCBOR(r io.Reader) (err error)

type User

type User struct {
	Did         string       `json:"did"`
	Handle      string       `json:"handle"`
	DisplayName string       `json:"displayName"`
	Declaration *Declaration `json:"declaration"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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