240 lines
12 KiB
Go
240 lines
12 KiB
Go
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
|
//
|
|
// Source: api/v1/memo_view_service.proto
|
|
|
|
package apiv1connect
|
|
|
|
import (
|
|
connect "connectrpc.com/connect"
|
|
context "context"
|
|
errors "errors"
|
|
v1 "github.com/usememos/memos/proto/gen/api/v1"
|
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
http "net/http"
|
|
strings "strings"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file and the connect package are
|
|
// compatible. If you get a compiler error that this constant is not defined, this code was
|
|
// generated with a version of connect newer than the one compiled into your binary. You can fix the
|
|
// problem by either regenerating this code with an older version of connect or updating the connect
|
|
// version compiled into your binary.
|
|
const _ = connect.IsAtLeastVersion1_13_0
|
|
|
|
const (
|
|
// MemoViewServiceName is the fully-qualified name of the MemoViewService service.
|
|
MemoViewServiceName = "memos.api.v1.MemoViewService"
|
|
)
|
|
|
|
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
|
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
|
|
//
|
|
// Note that these are different from the fully-qualified method names used by
|
|
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
|
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
|
// period.
|
|
const (
|
|
// MemoViewServiceListMemoViewsProcedure is the fully-qualified name of the MemoViewService's
|
|
// ListMemoViews RPC.
|
|
MemoViewServiceListMemoViewsProcedure = "/memos.api.v1.MemoViewService/ListMemoViews"
|
|
// MemoViewServiceGetMemoViewProcedure is the fully-qualified name of the MemoViewService's
|
|
// GetMemoView RPC.
|
|
MemoViewServiceGetMemoViewProcedure = "/memos.api.v1.MemoViewService/GetMemoView"
|
|
// MemoViewServiceCreateMemoViewProcedure is the fully-qualified name of the MemoViewService's
|
|
// CreateMemoView RPC.
|
|
MemoViewServiceCreateMemoViewProcedure = "/memos.api.v1.MemoViewService/CreateMemoView"
|
|
// MemoViewServiceUpdateMemoViewProcedure is the fully-qualified name of the MemoViewService's
|
|
// UpdateMemoView RPC.
|
|
MemoViewServiceUpdateMemoViewProcedure = "/memos.api.v1.MemoViewService/UpdateMemoView"
|
|
// MemoViewServiceDeleteMemoViewProcedure is the fully-qualified name of the MemoViewService's
|
|
// DeleteMemoView RPC.
|
|
MemoViewServiceDeleteMemoViewProcedure = "/memos.api.v1.MemoViewService/DeleteMemoView"
|
|
)
|
|
|
|
// MemoViewServiceClient is a client for the memos.api.v1.MemoViewService service.
|
|
type MemoViewServiceClient interface {
|
|
// ListMemoViews returns a user's memo views. Each view is a named, reusable
|
|
// CEL filter (see MemoView.filter); pass its filter string directly to the
|
|
// ListMemos `filter` argument.
|
|
ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error)
|
|
// GetMemoView gets a memo view by name.
|
|
GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// CreateMemoView creates a new memo view for a user.
|
|
CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// UpdateMemoView updates a memo view for a user.
|
|
UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// DeleteMemoView deletes a memo view for a user.
|
|
DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error)
|
|
}
|
|
|
|
// NewMemoViewServiceClient constructs a client for the memos.api.v1.MemoViewService 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).
|
|
func NewMemoViewServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) MemoViewServiceClient {
|
|
baseURL = strings.TrimRight(baseURL, "/")
|
|
memoViewServiceMethods := v1.File_api_v1_memo_view_service_proto.Services().ByName("MemoViewService").Methods()
|
|
return &memoViewServiceClient{
|
|
listMemoViews: connect.NewClient[v1.ListMemoViewsRequest, v1.ListMemoViewsResponse](
|
|
httpClient,
|
|
baseURL+MemoViewServiceListMemoViewsProcedure,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("ListMemoViews")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getMemoView: connect.NewClient[v1.GetMemoViewRequest, v1.MemoView](
|
|
httpClient,
|
|
baseURL+MemoViewServiceGetMemoViewProcedure,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("GetMemoView")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
createMemoView: connect.NewClient[v1.CreateMemoViewRequest, v1.MemoView](
|
|
httpClient,
|
|
baseURL+MemoViewServiceCreateMemoViewProcedure,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("CreateMemoView")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
updateMemoView: connect.NewClient[v1.UpdateMemoViewRequest, v1.MemoView](
|
|
httpClient,
|
|
baseURL+MemoViewServiceUpdateMemoViewProcedure,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("UpdateMemoView")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
deleteMemoView: connect.NewClient[v1.DeleteMemoViewRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+MemoViewServiceDeleteMemoViewProcedure,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("DeleteMemoView")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
}
|
|
}
|
|
|
|
// memoViewServiceClient implements MemoViewServiceClient.
|
|
type memoViewServiceClient struct {
|
|
listMemoViews *connect.Client[v1.ListMemoViewsRequest, v1.ListMemoViewsResponse]
|
|
getMemoView *connect.Client[v1.GetMemoViewRequest, v1.MemoView]
|
|
createMemoView *connect.Client[v1.CreateMemoViewRequest, v1.MemoView]
|
|
updateMemoView *connect.Client[v1.UpdateMemoViewRequest, v1.MemoView]
|
|
deleteMemoView *connect.Client[v1.DeleteMemoViewRequest, emptypb.Empty]
|
|
}
|
|
|
|
// ListMemoViews calls memos.api.v1.MemoViewService.ListMemoViews.
|
|
func (c *memoViewServiceClient) ListMemoViews(ctx context.Context, req *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) {
|
|
return c.listMemoViews.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetMemoView calls memos.api.v1.MemoViewService.GetMemoView.
|
|
func (c *memoViewServiceClient) GetMemoView(ctx context.Context, req *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return c.getMemoView.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CreateMemoView calls memos.api.v1.MemoViewService.CreateMemoView.
|
|
func (c *memoViewServiceClient) CreateMemoView(ctx context.Context, req *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return c.createMemoView.CallUnary(ctx, req)
|
|
}
|
|
|
|
// UpdateMemoView calls memos.api.v1.MemoViewService.UpdateMemoView.
|
|
func (c *memoViewServiceClient) UpdateMemoView(ctx context.Context, req *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return c.updateMemoView.CallUnary(ctx, req)
|
|
}
|
|
|
|
// DeleteMemoView calls memos.api.v1.MemoViewService.DeleteMemoView.
|
|
func (c *memoViewServiceClient) DeleteMemoView(ctx context.Context, req *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.deleteMemoView.CallUnary(ctx, req)
|
|
}
|
|
|
|
// MemoViewServiceHandler is an implementation of the memos.api.v1.MemoViewService service.
|
|
type MemoViewServiceHandler interface {
|
|
// ListMemoViews returns a user's memo views. Each view is a named, reusable
|
|
// CEL filter (see MemoView.filter); pass its filter string directly to the
|
|
// ListMemos `filter` argument.
|
|
ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error)
|
|
// GetMemoView gets a memo view by name.
|
|
GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// CreateMemoView creates a new memo view for a user.
|
|
CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// UpdateMemoView updates a memo view for a user.
|
|
UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error)
|
|
// DeleteMemoView deletes a memo view for a user.
|
|
DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error)
|
|
}
|
|
|
|
// NewMemoViewServiceHandler 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.
|
|
func NewMemoViewServiceHandler(svc MemoViewServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
|
memoViewServiceMethods := v1.File_api_v1_memo_view_service_proto.Services().ByName("MemoViewService").Methods()
|
|
memoViewServiceListMemoViewsHandler := connect.NewUnaryHandler(
|
|
MemoViewServiceListMemoViewsProcedure,
|
|
svc.ListMemoViews,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("ListMemoViews")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
memoViewServiceGetMemoViewHandler := connect.NewUnaryHandler(
|
|
MemoViewServiceGetMemoViewProcedure,
|
|
svc.GetMemoView,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("GetMemoView")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
memoViewServiceCreateMemoViewHandler := connect.NewUnaryHandler(
|
|
MemoViewServiceCreateMemoViewProcedure,
|
|
svc.CreateMemoView,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("CreateMemoView")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
memoViewServiceUpdateMemoViewHandler := connect.NewUnaryHandler(
|
|
MemoViewServiceUpdateMemoViewProcedure,
|
|
svc.UpdateMemoView,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("UpdateMemoView")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
memoViewServiceDeleteMemoViewHandler := connect.NewUnaryHandler(
|
|
MemoViewServiceDeleteMemoViewProcedure,
|
|
svc.DeleteMemoView,
|
|
connect.WithSchema(memoViewServiceMethods.ByName("DeleteMemoView")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
return "/memos.api.v1.MemoViewService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case MemoViewServiceListMemoViewsProcedure:
|
|
memoViewServiceListMemoViewsHandler.ServeHTTP(w, r)
|
|
case MemoViewServiceGetMemoViewProcedure:
|
|
memoViewServiceGetMemoViewHandler.ServeHTTP(w, r)
|
|
case MemoViewServiceCreateMemoViewProcedure:
|
|
memoViewServiceCreateMemoViewHandler.ServeHTTP(w, r)
|
|
case MemoViewServiceUpdateMemoViewProcedure:
|
|
memoViewServiceUpdateMemoViewHandler.ServeHTTP(w, r)
|
|
case MemoViewServiceDeleteMemoViewProcedure:
|
|
memoViewServiceDeleteMemoViewHandler.ServeHTTP(w, r)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
}
|
|
|
|
// UnimplementedMemoViewServiceHandler returns CodeUnimplemented from all methods.
|
|
type UnimplementedMemoViewServiceHandler struct{}
|
|
|
|
func (UnimplementedMemoViewServiceHandler) ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoViewService.ListMemoViews is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedMemoViewServiceHandler) GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoViewService.GetMemoView is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedMemoViewServiceHandler) CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoViewService.CreateMemoView is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedMemoViewServiceHandler) UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoViewService.UpdateMemoView is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedMemoViewServiceHandler) DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoViewService.DeleteMemoView is not implemented"))
|
|
}
|