slink

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: AGPL-3.0 Imports: 18 Imported by: 2

Documentation

Overview

Package slink provides tools for slink-based clients.

Index

Constants

View Source
const (
	Query = RequestType(iota)
	Procedure
)
View Source
const ISO8601 = "2006-01-02T15:04:05.000Z"

Variables

This section is empty.

Functions

func CastAnyToArray

func CastAnyToArray[T any](v *any) []*T

func CastAnyToStruct

func CastAnyToStruct[T any](v *any) *T

func CastBoolToPointer

func CastBoolToPointer(v bool) *bool

func CastInt64ToPointer

func CastInt64ToPointer(v int64) *int64

func CastStringToPointer

func CastStringToPointer(s string) *string

func GenerateAuthToken

func GenerateAuthToken(keybytes []byte, claims map[string]any, typ string) ([]byte, error)

func LexiconTypeFromJSONBytes

func LexiconTypeFromJSONBytes(data []byte) string

func MarshalWithLexiconType

func MarshalWithLexiconType(t string, v any) ([]byte, error)

func Now

func Now() string

func ReadJSONFile

func ReadJSONFile(name string) (*any, error)

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, response any)

func SetLogLevel

func SetLogLevel(level string) error

func TruncateShort

func TruncateShort(s string) string

func TruncateToLength

func TruncateToLength(s string, maxlen int) string

func VerifyAuthHeader

func VerifyAuthHeader(ctx context.Context, authHeader string) (*jwt.Token, error)

func VerifyAuthToken

func VerifyAuthToken(ctx context.Context, accessToken string) (*jwt.Token, error)

func Write

func Write(w io.Writer, output string, v any) error

Types

type Blob

type Blob struct {
	LexiconTypeID string `json:"$type,omitempty"`
	Ref           Link   `json:"ref,omitempty"`
	MimeType      string `json:"mimeType,omitempty"`
	Size          int64  `json:"size"`
}

type Client

type Client interface {
	Do(ctx context.Context,
		requestType RequestType,
		contentType string,
		xrpcMethod string,
		parameters map[string]any,
		input any,
		output any,
	) error
	Subscribe(ctx context.Context,
		xrpcMethod string,
		params map[string]any,
		callback func(b io.Reader) error,
	) error
}
type Link struct {
	LexiconLink string `json:"$link"`
}

type RequestType

type RequestType int

Jump to

Keyboard shortcuts

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