trinity

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheBlob added in v0.3.0

func CacheBlob(url string, auth string, b []byte) (sasURL string, err error)

func CreateAuthorization

func CreateAuthorization(user, passwd string) (auth string)

func CreateAuthorizationToken added in v0.3.0

func CreateAuthorizationToken(user, token string) (auth string)

func ParseAuthorization added in v0.3.0

func ParseAuthorization(auth string) (user string, passwdS256 [sha256.Size]byte, err error)

func PasswdS256Token added in v0.3.0

func PasswdS256Token(passwdS256 [sha256.Size]byte) (token string)

func PasswdToken added in v0.3.0

func PasswdToken(passwd string) (token string)

func Request

func Request[Args any, Values any](url string, action Action, args Args, content atmt.Content) (vals Values, ret atmt.Content, err error)

func RequestCtx added in v0.3.0

func RequestCtx[Args any, Values any](ctx context.Context, url string, action Action, args Args, content atmt.Content) (vals Values, ret atmt.Content, err error)

Types

type Action

type Action uint8
const (
	ActionPostMessage Action = iota + 1
	ActionGetMessage
	ActionQueryMessageIdsLatestCount

	ActionGetBlobCacheURL
	ActionVerifyAuthorization
)

func (Action) String

func (act Action) String() (str string)

type ArgsGetBlobCacheURL added in v0.3.0

type ArgsGetBlobCacheURL struct {
	Auth     string `json:"auth"`
	BlobName string `json:"blob_name"`
}

type ArgsGetMessage added in v0.3.0

type ArgsGetMessage struct {
	Auth string    `json:"auth"`
	ID   MessageID `json:"id"`
}

type ArgsPostMessage added in v0.3.0

type ArgsPostMessage struct {
	Auth string `json:"auth"`
}

type ArgsQueryMessageIdsLatestCount added in v0.3.0

type ArgsQueryMessageIdsLatestCount struct {
	Auth  string `json:"auth"`
	Count int    `json:"count"`
}

type ArgsVerifyAuthorization added in v0.3.0

type ArgsVerifyAuthorization struct {
	Auth string `json:"auth"`
}

type MessageID added in v0.3.0

type MessageID = primitive.ObjectID

type RequestError added in v0.3.0

type RequestError interface {
	error
	Action() Action
	StatusCode() atmt.StatusCode
}

type ValuesGetBlobCacheURL added in v0.3.0

type ValuesGetBlobCacheURL struct {
	SasURL string `json:"sas_url"`
}

type ValuesGetMessage added in v0.3.0

type ValuesGetMessage struct {
	Sender    string    `json:"sender"`
	MessageID MessageID `json:"message_id"`
}

type ValuesPostMessage added in v0.3.0

type ValuesPostMessage struct {
	MessageID MessageID `json:"message_id"`
}

type ValuesQueryMessageIds added in v0.3.0

type ValuesQueryMessageIds struct {
	Ids []MessageID `json:"ids"`
}

type ValuesQueryMessageIdsLatestCount added in v0.3.0

type ValuesQueryMessageIdsLatestCount = ValuesQueryMessageIds

type ValuesVerifyAuthorization added in v0.3.0

type ValuesVerifyAuthorization struct {
	Pass bool `json:"pass"`
}

Jump to

Keyboard shortcuts

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