v2

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPageSize  = 10
	MaxContentLength = 8 * 1024
	ChunkSize        = 64 * 1024 // 64 KiB
)
View Source
const (
	WorkspaceSettingNamePrefix = "settings/"
	UserNamePrefix             = "users/"
	MemoNamePrefix             = "memos/"
	ResourceNamePrefix         = "resources/"
	InboxNamePrefix            = "inboxes/"
	StorageNamePrefix          = "storages/"
	IdentityProviderNamePrefix = "identityProviders/"
)
View Source
const (
	// The upload memory buffer is 32 MiB.
	// It should be kept low, so RAM usage doesn't get out of control.
	// This is unrelated to maximum upload size limit, which is now set through system setting.
	MaxUploadBufferSizeBytes = 32 << 20
	MebiByte                 = 1024 * 1024
)

Variables

View Source
var SearchMemosFilterCELAttributes = []cel.EnvOption{
	cel.Variable("content_search", cel.ListType(cel.StringType)),
	cel.Variable("visibilities", cel.ListType(cel.StringType)),
	cel.Variable("order_by_pinned", cel.BoolType),
	cel.Variable("display_time_before", cel.IntType),
	cel.Variable("display_time_after", cel.IntType),
	cel.Variable("creator", cel.StringType),
	cel.Variable("uid", cel.StringType),
	cel.Variable("row_status", cel.StringType),
	cel.Variable("random", cel.BoolType),
	cel.Variable("limit", cel.IntType),
	cel.Variable("include_comments", cel.BoolType),
}

SearchMemosFilterCELAttributes are the CEL attributes.

View Source
var SearchResourcesFilterCELAttributes = []cel.EnvOption{
	cel.Variable("uid", cel.StringType),
}

SearchResourcesFilterCELAttributes are the CEL attributes for SearchResourcesFilter.

View Source
var SearchUsersFilterCELAttributes = []cel.EnvOption{
	cel.Variable("username", cel.StringType),
	cel.Variable("random", cel.BoolType),
	cel.Variable("limit", cel.IntType),
}

SearchUsersFilterCELAttributes are the CEL attributes for SearchUsersFilter.

Functions

func ConvertStorageFromStore added in v0.21.1

func ConvertStorageFromStore(storage *storepb.Storage) *apiv2pb.Storage

func ExtractIdentityProviderIDFromName added in v0.21.1

func ExtractIdentityProviderIDFromName(name string) (int32, error)

func ExtractInboxIDFromName

func ExtractInboxIDFromName(name string) (int32, error)

ExtractInboxIDFromName returns the inbox ID from a resource name.

func ExtractMemoIDFromName added in v0.21.0

func ExtractMemoIDFromName(name string) (int32, error)

ExtractMemoIDFromName returns the memo ID from a resource name.

func ExtractResourceIDFromName added in v0.21.0

func ExtractResourceIDFromName(name string) (int32, error)

ExtractResourceIDFromName returns the resource ID from a resource name.

func ExtractStorageIDFromName added in v0.21.1

func ExtractStorageIDFromName(name string) (int32, error)

ExtractStorageIDFromName returns the storage ID from a resource name.

func ExtractUserIDFromName added in v0.21.0

func ExtractUserIDFromName(name string) (int32, error)

ExtractUserIDFromName returns the uid from a resource name.

func ExtractWorkspaceSettingKeyFromName

func ExtractWorkspaceSettingKeyFromName(name string) (string, error)

func GetNameParentTokens

func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error)

GetNameParentTokens returns the tokens from a resource name.

func SaveResourceBlob added in v0.21.1

func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resource) error

SaveResourceBlob save the blob of resource based on the storage config.

func TraverseASTNodes added in v0.21.0

func TraverseASTNodes(nodes []ast.Node, fn func(ast.Node))

Types

type APIV2Service

func NewAPIV2Service

func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store, grpcServer *grpc.Server) *APIV2Service

func (*APIV2Service) BatchUpsertTag

func (*APIV2Service) CreateIdentityProvider added in v0.21.1

func (*APIV2Service) CreateMemo

func (*APIV2Service) CreateMemoComment

func (*APIV2Service) CreateResource

func (*APIV2Service) CreateStorage added in v0.21.1

func (*APIV2Service) CreateUser

func (*APIV2Service) CreateWebhook

func (*APIV2Service) DeleteIdentityProvider added in v0.21.1

func (*APIV2Service) DeleteInbox

func (*APIV2Service) DeleteMemo

func (*APIV2Service) DeleteMemoReaction

func (*APIV2Service) DeleteResource

func (*APIV2Service) DeleteStorage added in v0.21.1

func (*APIV2Service) DeleteTag

func (*APIV2Service) DeleteUser

func (*APIV2Service) DeleteWebhook

func (*APIV2Service) DispatchMemoCreatedWebhook

func (s *APIV2Service) DispatchMemoCreatedWebhook(ctx context.Context, memo *apiv2pb.Memo) error

DispatchMemoCreatedWebhook dispatches webhook when memo is created.

func (*APIV2Service) DispatchMemoDeletedWebhook

func (s *APIV2Service) DispatchMemoDeletedWebhook(ctx context.Context, memo *apiv2pb.Memo) error

DispatchMemoDeletedWebhook dispatches webhook when memo is deleted.

func (*APIV2Service) DispatchMemoUpdatedWebhook

func (s *APIV2Service) DispatchMemoUpdatedWebhook(ctx context.Context, memo *apiv2pb.Memo) error

DispatchMemoUpdatedWebhook dispatches webhook when memo is updated.

func (*APIV2Service) ExportMemos

func (*APIV2Service) GetActivity

func (*APIV2Service) GetAuthStatus

func (*APIV2Service) GetIdentityProvider added in v0.21.1

func (*APIV2Service) GetInstanceOwner added in v0.21.0

func (s *APIV2Service) GetInstanceOwner(ctx context.Context) (*apiv2pb.User, error)

func (*APIV2Service) GetLinkMetadata added in v0.21.0

func (*APIV2Service) GetMemo

func (*APIV2Service) GetResource

func (*APIV2Service) GetStorage added in v0.21.1

func (*APIV2Service) GetTagSuggestions

func (*APIV2Service) GetUser

func (*APIV2Service) GetUserMemosStats

func (*APIV2Service) GetUserSetting

func (*APIV2Service) GetWebhook

func (*APIV2Service) GetWorkspaceSetting

func (*APIV2Service) ListIdentityProviders added in v0.21.1

func (*APIV2Service) ListInboxes

func (*APIV2Service) ListMemoComments

func (*APIV2Service) ListMemoReactions

func (*APIV2Service) ListMemoRelations

func (*APIV2Service) ListMemoResources

func (*APIV2Service) ListMemos

func (*APIV2Service) ListResources

func (*APIV2Service) ListStorages added in v0.21.1

func (*APIV2Service) ListTags

func (*APIV2Service) ListUsers

func (*APIV2Service) ListWebhooks

func (*APIV2Service) ListWorkspaceSettings added in v0.21.1

func (*APIV2Service) RegisterGateway

func (s *APIV2Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error

RegisterGateway registers the gRPC-Gateway with the given Echo instance.

func (*APIV2Service) RenameTag

func (*APIV2Service) SearchMemos added in v0.21.0

func (*APIV2Service) SearchResources added in v0.21.0

func (*APIV2Service) SearchUsers added in v0.21.0

func (*APIV2Service) SetMemoRelations

func (*APIV2Service) SetMemoResources

func (*APIV2Service) SetWorkspaceSetting

func (*APIV2Service) SignIn

func (*APIV2Service) SignInWithSSO

func (*APIV2Service) SignOut

func (*APIV2Service) SignUp

func (*APIV2Service) UpdateIdentityProvider added in v0.21.1

func (*APIV2Service) UpdateInbox

func (*APIV2Service) UpdateMemo

func (*APIV2Service) UpdateResource

func (*APIV2Service) UpdateStorage added in v0.21.1

func (*APIV2Service) UpdateUser

func (*APIV2Service) UpdateUserSetting

func (*APIV2Service) UpdateWebhook

func (*APIV2Service) UpsertAccessTokenToStore

func (s *APIV2Service) UpsertAccessTokenToStore(ctx context.Context, user *store.User, accessToken, description string) error

func (*APIV2Service) UpsertMemoReaction

func (*APIV2Service) UpsertTag

type ContextKey

type ContextKey int

ContextKey is the key type of context value.

type GRPCAuthInterceptor

type GRPCAuthInterceptor struct {
	Store *store.Store
	// contains filtered or unexported fields
}

GRPCAuthInterceptor is the auth interceptor for gRPC server.

func NewGRPCAuthInterceptor

func NewGRPCAuthInterceptor(store *store.Store, secret string) *GRPCAuthInterceptor

NewGRPCAuthInterceptor returns a new API auth interceptor.

func (*GRPCAuthInterceptor) AuthenticationInterceptor

func (in *GRPCAuthInterceptor) AuthenticationInterceptor(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

AuthenticationInterceptor is the unary interceptor for gRPC API.

type LoggerInterceptor

type LoggerInterceptor struct {
}

func NewLoggerInterceptor

func NewLoggerInterceptor() *LoggerInterceptor

func (*LoggerInterceptor) LoggerInterceptor

func (in *LoggerInterceptor) LoggerInterceptor(ctx context.Context, request any, serverInfo *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

type SearchMemosFilter added in v0.21.0

type SearchMemosFilter struct {
	ContentSearch     []string
	Visibilities      []store.Visibility
	OrderByPinned     bool
	DisplayTimeBefore *int64
	DisplayTimeAfter  *int64
	Creator           *string
	UID               *string
	RowStatus         *store.RowStatus
	Random            bool
	Limit             *int
	IncludeComments   bool
}

type SearchResourcesFilter added in v0.21.0

type SearchResourcesFilter struct {
	UID *string
}

type SearchUsersFilter added in v0.21.0

type SearchUsersFilter struct {
	Username *string
	Random   bool
	Limit    *int
}

Jump to

Keyboard shortcuts

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