admin

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package admin provides the client for the admin service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInterceptor added in v0.2.14

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

AuthInterceptor is an interceptor for authentication.

func NewAuthInterceptor added in v0.2.14

func NewAuthInterceptor(token string) *AuthInterceptor

NewAuthInterceptor creates a new instance of AuthInterceptor.

func (*AuthInterceptor) SetToken added in v0.2.14

func (i *AuthInterceptor) SetToken(token string)

SetToken sets the token of the client.

func (*AuthInterceptor) Stream added in v0.2.14

Stream creates a stream server interceptor for authorization.

func (*AuthInterceptor) Unary added in v0.2.14

Unary creates a unary server interceptor for authorization.

type Client

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

Client is a client for admin service.

func Dial

func Dial(adminAddr string, opts ...Option) (*Client, error)

Dial creates an instance of Client and dials to the admin service.

func New

func New(opts ...Option) (*Client, error)

New creates an instance of Client.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the admin service.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, name string) (*types.Project, error)

CreateProject creates a new project.

func (*Client) Dial

func (c *Client) Dial(adminAddr string) error

Dial dials to the admin service.

func (*Client) GetProject added in v0.2.16

func (c *Client) GetProject(ctx context.Context, name string) (*types.Project, error)

GetProject gets the project by name.

func (*Client) ListChangeSummaries added in v0.2.9

func (c *Client) ListChangeSummaries(
	ctx context.Context,
	projectName string,
	key key.Key,
	previousSeq int64,
	pageSize int32,
	isForward bool,
) ([]*types.ChangeSummary, error)

ListChangeSummaries returns the change summaries of the given document.

func (*Client) ListDocuments added in v0.2.13

func (c *Client) ListDocuments(ctx context.Context, projectName string) ([]*types.DocumentSummary, error)

ListDocuments lists documents.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context) ([]*types.Project, error)

ListProjects lists all projects.

func (*Client) LogIn added in v0.2.14

func (c *Client) LogIn(
	ctx context.Context,
	username,
	password string,
) (string, error)

LogIn logs in a user.

func (*Client) SignUp added in v0.2.14

func (c *Client) SignUp(
	ctx context.Context,
	username,
	password string,
) (*types.User, error)

SignUp signs up a new user.

func (*Client) UpdateProject

func (c *Client) UpdateProject(
	ctx context.Context,
	id string,
	fields *types.UpdatableProjectFields,
) (*types.Project, error)

UpdateProject updates an existing project.

type Option

type Option func(*Options)

Option configures Options.

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger configures the Logger of the client.

func WithToken added in v0.2.14

func WithToken(token string) Option

WithToken configures the token of the client.

type Options

type Options struct {
	// Token is the token of the user.
	Token string

	// Logger is the Logger of the client.
	Logger *zap.Logger
}

Options configures how we set up the client.

Jump to

Keyboard shortcuts

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