filev1connect

package
v0.0.0-...-5eacf0a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileServiceName is the fully-qualified name of the FileService service.
	FileServiceName = "file.v1.FileService"
)

Variables

This section is empty.

Functions

func NewFileServiceHandler

func NewFileServiceHandler(svc FileServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler)

NewFileServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type FileServiceClient

type FileServiceClient interface {
	// GetFile returns a specific file given its ID.
	GetFile(context.Context, *connect_go.Request[v1.GetFileRequest]) (*connect_go.Response[v1.GetFileResponse], error)
	// ListFiles returns a list of files, paginated.
	ListFiles(context.Context, *connect_go.Request[v1.ListFilesRequest]) (*connect_go.Response[v1.ListFilesResponse], error)
	// CreateFile creates a new file.
	CreateFile(context.Context) *connect_go.ClientStreamForClient[v1.CreateFileRequest, v1.CreateFileResponse]
	// ImportFromURL imports a file from a URL. The file will be downloaded
	// and stored under a certain path.
	ImportFromURL(context.Context, *connect_go.Request[v1.ImportFromURLRequest]) (*connect_go.Response[v1.ImportFromURLResponse], error)
	// DeleteFile deletes a file.
	DeleteFile(context.Context, *connect_go.Request[v1.DeleteFileRequest]) (*connect_go.Response[v1.DeleteFileResponse], error)
	// UpdateFile updates a file.
	UpdateFile(context.Context, *connect_go.Request[v1.UpdateFileRequest]) (*connect_go.Response[v1.UpdateFileResponse], error)
	// ShareFile shares a file with another user.
	ShareFile(context.Context, *connect_go.Request[v1.ShareFileRequest]) (*connect_go.Response[v1.ShareFileResponse], error)
	// UnshareFile deletes an existing share of a file with another user.
	UnshareFile(context.Context, *connect_go.Request[v1.UnshareFileRequest]) (*connect_go.Response[v1.UnshareFileResponse], error)
	// AttachSync attaches a Sync to a file.
	// If the file isn't a folder, or the folder already has an attached Sync,
	// this operation will fail.
	AttachSync(context.Context, *connect_go.Request[v1.AttachSyncRequest]) (*connect_go.Response[v1.AttachSyncResponse], error)
	// DeleteSync deletes an Sync. The file contents of the folder
	// will be kept, but no further updates will be made.
	DeleteSync(context.Context, *connect_go.Request[v1.DeleteSyncRequest]) (*connect_go.Response[v1.DeleteSyncResponse], error)
}

FileServiceClient is a client for the file.v1.FileService service.

func NewFileServiceClient

func NewFileServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) FileServiceClient

NewFileServiceClient constructs a client for the file.v1.FileService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type FileServiceHandler

type FileServiceHandler interface {
	// GetFile returns a specific file given its ID.
	GetFile(context.Context, *connect_go.Request[v1.GetFileRequest]) (*connect_go.Response[v1.GetFileResponse], error)
	// ListFiles returns a list of files, paginated.
	ListFiles(context.Context, *connect_go.Request[v1.ListFilesRequest]) (*connect_go.Response[v1.ListFilesResponse], error)
	// CreateFile creates a new file.
	CreateFile(context.Context, *connect_go.ClientStream[v1.CreateFileRequest]) (*connect_go.Response[v1.CreateFileResponse], error)
	// ImportFromURL imports a file from a URL. The file will be downloaded
	// and stored under a certain path.
	ImportFromURL(context.Context, *connect_go.Request[v1.ImportFromURLRequest]) (*connect_go.Response[v1.ImportFromURLResponse], error)
	// DeleteFile deletes a file.
	DeleteFile(context.Context, *connect_go.Request[v1.DeleteFileRequest]) (*connect_go.Response[v1.DeleteFileResponse], error)
	// UpdateFile updates a file.
	UpdateFile(context.Context, *connect_go.Request[v1.UpdateFileRequest]) (*connect_go.Response[v1.UpdateFileResponse], error)
	// ShareFile shares a file with another user.
	ShareFile(context.Context, *connect_go.Request[v1.ShareFileRequest]) (*connect_go.Response[v1.ShareFileResponse], error)
	// UnshareFile deletes an existing share of a file with another user.
	UnshareFile(context.Context, *connect_go.Request[v1.UnshareFileRequest]) (*connect_go.Response[v1.UnshareFileResponse], error)
	// AttachSync attaches a Sync to a file.
	// If the file isn't a folder, or the folder already has an attached Sync,
	// this operation will fail.
	AttachSync(context.Context, *connect_go.Request[v1.AttachSyncRequest]) (*connect_go.Response[v1.AttachSyncResponse], error)
	// DeleteSync deletes an Sync. The file contents of the folder
	// will be kept, but no further updates will be made.
	DeleteSync(context.Context, *connect_go.Request[v1.DeleteSyncRequest]) (*connect_go.Response[v1.DeleteSyncResponse], error)
}

FileServiceHandler is an implementation of the file.v1.FileService service.

type UnimplementedFileServiceHandler

type UnimplementedFileServiceHandler struct{}

UnimplementedFileServiceHandler returns CodeUnimplemented from all methods.

Jump to

Keyboard shortcuts

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