Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

41.9 KB
Raw Blame
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: api/memo_service.proto

package apiconnect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	api "github.com/usememos/memos/proto/gen/api"
	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 (
	// MemoServiceName is the fully-qualified name of the MemoService service.
	MemoServiceName = "memos.api.MemoService"
)

// 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 (
	// MemoServiceListMemosProcedure is the fully-qualified name of the MemoService's ListMemos RPC.
	MemoServiceListMemosProcedure = "/memos.api.MemoService/ListMemos"
	// MemoServiceGetMemoProcedure is the fully-qualified name of the MemoService's GetMemo RPC.
	MemoServiceGetMemoProcedure = "/memos.api.MemoService/GetMemo"
	// MemoServiceCreateMemoProcedure is the fully-qualified name of the MemoService's CreateMemo RPC.
	MemoServiceCreateMemoProcedure = "/memos.api.MemoService/CreateMemo"
	// MemoServiceUpdateMemoProcedure is the fully-qualified name of the MemoService's UpdateMemo RPC.
	MemoServiceUpdateMemoProcedure = "/memos.api.MemoService/UpdateMemo"
	// MemoServiceDeleteMemoProcedure is the fully-qualified name of the MemoService's DeleteMemo RPC.
	MemoServiceDeleteMemoProcedure = "/memos.api.MemoService/DeleteMemo"
	// MemoServiceListMemoAttachmentsProcedure is the fully-qualified name of the MemoService's
	// ListMemoAttachments RPC.
	MemoServiceListMemoAttachmentsProcedure = "/memos.api.MemoService/ListMemoAttachments"
	// MemoServiceSetMemoAttachmentsProcedure is the fully-qualified name of the MemoService's
	// SetMemoAttachments RPC.
	MemoServiceSetMemoAttachmentsProcedure = "/memos.api.MemoService/SetMemoAttachments"
	// MemoServiceListMemoRelationsProcedure is the fully-qualified name of the MemoService's
	// ListMemoRelations RPC.
	MemoServiceListMemoRelationsProcedure = "/memos.api.MemoService/ListMemoRelations"
	// MemoServiceSetMemoRelationsProcedure is the fully-qualified name of the MemoService's
	// SetMemoRelations RPC.
	MemoServiceSetMemoRelationsProcedure = "/memos.api.MemoService/SetMemoRelations"
	// MemoServiceListMemoCommentsProcedure is the fully-qualified name of the MemoService's
	// ListMemoComments RPC.
	MemoServiceListMemoCommentsProcedure = "/memos.api.MemoService/ListMemoComments"
	// MemoServiceCreateMemoCommentProcedure is the fully-qualified name of the MemoService's
	// CreateMemoComment RPC.
	MemoServiceCreateMemoCommentProcedure = "/memos.api.MemoService/CreateMemoComment"
	// MemoServiceListMemoReactionsProcedure is the fully-qualified name of the MemoService's
	// ListMemoReactions RPC.
	MemoServiceListMemoReactionsProcedure = "/memos.api.MemoService/ListMemoReactions"
	// MemoServiceDeleteMemoReactionProcedure is the fully-qualified name of the MemoService's
	// DeleteMemoReaction RPC.
	MemoServiceDeleteMemoReactionProcedure = "/memos.api.MemoService/DeleteMemoReaction"
	// MemoServiceUpsertMemoReactionProcedure is the fully-qualified name of the MemoService's
	// UpsertMemoReaction RPC.
	MemoServiceUpsertMemoReactionProcedure = "/memos.api.MemoService/UpsertMemoReaction"
	// MemoServiceListMemoSharesProcedure is the fully-qualified name of the MemoService's
	// ListMemoShares RPC.
	MemoServiceListMemoSharesProcedure = "/memos.api.MemoService/ListMemoShares"
	// MemoServiceCreateMemoShareProcedure is the fully-qualified name of the MemoService's
	// CreateMemoShare RPC.
	MemoServiceCreateMemoShareProcedure = "/memos.api.MemoService/CreateMemoShare"
	// MemoServiceDeleteMemoShareProcedure is the fully-qualified name of the MemoService's
	// DeleteMemoShare RPC.
	MemoServiceDeleteMemoShareProcedure = "/memos.api.MemoService/DeleteMemoShare"
	// MemoServiceGetSharedMemoProcedure is the fully-qualified name of the MemoService's GetSharedMemo
	// RPC.
	MemoServiceGetSharedMemoProcedure = "/memos.api.MemoService/GetSharedMemo"
	// MemoServiceGetLinkMetadataProcedure is the fully-qualified name of the MemoService's
	// GetLinkMetadata RPC.
	MemoServiceGetLinkMetadataProcedure = "/memos.api.MemoService/GetLinkMetadata"
	// MemoServiceBatchGetLinkMetadataProcedure is the fully-qualified name of the MemoService's
	// BatchGetLinkMetadata RPC.
	MemoServiceBatchGetLinkMetadataProcedure = "/memos.api.MemoService/BatchGetLinkMetadata"
)

// MemoServiceClient is a client for the memos.api.MemoService service.
type MemoServiceClient interface {
	// ListMemos lists the memos the caller can read, excluding comments.
	// Anonymous callers can list only when the instance allows public access.
	ListMemos(context.Context, *connect.Request[api.ListMemosRequest]) (*connect.Response[api.ListMemosResponse], error)
	// GetMemo gets a memo. Requires read access to the memo.
	GetMemo(context.Context, *connect.Request[api.GetMemoRequest]) (*connect.Response[api.Memo], error)
	// CreateMemo creates a memo owned by the authenticated user. The request body
	// is a Memo; set its Markdown content and visibility (defaults to PRIVATE).
	// Requires authentication.
	CreateMemo(context.Context, *connect.Request[api.CreateMemoRequest]) (*connect.Response[api.Memo], error)
	// UpdateMemo updates the memo fields listed in update_mask. Requires the memo
	// creator or an instance administrator.
	UpdateMemo(context.Context, *connect.Request[api.UpdateMemoRequest]) (*connect.Response[api.Memo], error)
	// DeleteMemo deletes the named memo and its comment subtree, including nested
	// replies and their owned resources. It removes incident relations for all
	// deleted memos. Requires the memo creator or an instance administrator.
	DeleteMemo(context.Context, *connect.Request[api.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoAttachments lists the attachments of a memo. Requires read access
	// to the memo.
	ListMemoAttachments(context.Context, *connect.Request[api.ListMemoAttachmentsRequest]) (*connect.Response[api.ListMemoAttachmentsResponse], error)
	// SetMemoAttachments replaces the full set of attachments on a memo with the
	// provided list (not an append). Pass the complete desired set; an empty list
	// clears all attachments. Idempotent. Requires the memo creator or an
	// instance administrator.
	SetMemoAttachments(context.Context, *connect.Request[api.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoRelations lists the relations of a memo in both directions.
	// Requires read access to the memo.
	ListMemoRelations(context.Context, *connect.Request[api.ListMemoRelationsRequest]) (*connect.Response[api.ListMemoRelationsResponse], error)
	// SetMemoRelations replaces the full set of mutable REFERENCE relations on a
	// memo. COMMENT relations are immutable creation context and are rejected by
	// this RPC. An empty list clears references without changing COMMENT.
	// Requires the memo creator or an instance administrator.
	SetMemoRelations(context.Context, *connect.Request[api.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoComments lists the active comments on a memo that the caller can
	// read. Requires read access to the memo.
	ListMemoComments(context.Context, *connect.Request[api.ListMemoCommentsRequest]) (*connect.Response[api.ListMemoCommentsResponse], error)
	// CreateMemoComment atomically creates an independent memo plus one immutable
	// COMMENT context relation to the named memo. The new memo keeps its own
	// placement, visibility, authorship, and lifecycle. The named memo must be
	// readable by the caller and not archived.
	CreateMemoComment(context.Context, *connect.Request[api.CreateMemoCommentRequest]) (*connect.Response[api.Memo], error)
	// ListMemoReactions lists the reactions on a memo. Requires read access to
	// the memo.
	ListMemoReactions(context.Context, *connect.Request[api.ListMemoReactionsRequest]) (*connect.Response[api.ListMemoReactionsResponse], error)
	// DeleteMemoReaction deletes a reaction. Requires the reaction creator or an
	// instance administrator.
	DeleteMemoReaction(context.Context, *connect.Request[api.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error)
	// UpsertMemoReaction adds or updates the authenticated user's reaction on a
	// memo. Requires read access to the memo.
	UpsertMemoReaction(context.Context, *connect.Request[api.UpsertMemoReactionRequest]) (*connect.Response[api.Reaction], error)
	// ListMemoShares lists all share links for a memo. Requires the memo creator
	// or an instance administrator.
	ListMemoShares(context.Context, *connect.Request[api.ListMemoSharesRequest]) (*connect.Response[api.ListMemoSharesResponse], error)
	// CreateMemoShare creates a share link for a memo. Requires the memo creator
	// or an instance administrator. Only active memos without SPACE visibility
	// can be shared.
	CreateMemoShare(context.Context, *connect.Request[api.CreateMemoShareRequest]) (*connect.Response[api.MemoShare], error)
	// DeleteMemoShare revokes a share link. Requires the memo creator or an
	// instance administrator.
	DeleteMemoShare(context.Context, *connect.Request[api.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error)
	// GetSharedMemo resolves a share token to its memo. No authentication is
	// required. Returns NOT_FOUND if the token is invalid or expired.
	GetSharedMemo(context.Context, *connect.Request[api.GetSharedMemoRequest]) (*connect.Response[api.Memo], error)
	// GetLinkMetadata fetches the title, description, and image of a link.
	GetLinkMetadata(context.Context, *connect.Request[api.GetLinkMetadataRequest]) (*connect.Response[api.LinkMetadata], error)
	// BatchGetLinkMetadata fetches the metadata of up to 10 links.
	BatchGetLinkMetadata(context.Context, *connect.Request[api.BatchGetLinkMetadataRequest]) (*connect.Response[api.BatchGetLinkMetadataResponse], error)
}

// NewMemoServiceClient constructs a client for the memos.api.MemoService 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 NewMemoServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) MemoServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	memoServiceMethods := api.File_api_memo_service_proto.Services().ByName("MemoService").Methods()
	return &memoServiceClient{
		listMemos: connect.NewClient[api.ListMemosRequest, api.ListMemosResponse](
			httpClient,
			baseURL+MemoServiceListMemosProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemos")),
			connect.WithClientOptions(opts...),
		),
		getMemo: connect.NewClient[api.GetMemoRequest, api.Memo](
			httpClient,
			baseURL+MemoServiceGetMemoProcedure,
			connect.WithSchema(memoServiceMethods.ByName("GetMemo")),
			connect.WithClientOptions(opts...),
		),
		createMemo: connect.NewClient[api.CreateMemoRequest, api.Memo](
			httpClient,
			baseURL+MemoServiceCreateMemoProcedure,
			connect.WithSchema(memoServiceMethods.ByName("CreateMemo")),
			connect.WithClientOptions(opts...),
		),
		updateMemo: connect.NewClient[api.UpdateMemoRequest, api.Memo](
			httpClient,
			baseURL+MemoServiceUpdateMemoProcedure,
			connect.WithSchema(memoServiceMethods.ByName("UpdateMemo")),
			connect.WithClientOptions(opts...),
		),
		deleteMemo: connect.NewClient[api.DeleteMemoRequest, emptypb.Empty](
			httpClient,
			baseURL+MemoServiceDeleteMemoProcedure,
			connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")),
			connect.WithClientOptions(opts...),
		),
		listMemoAttachments: connect.NewClient[api.ListMemoAttachmentsRequest, api.ListMemoAttachmentsResponse](
			httpClient,
			baseURL+MemoServiceListMemoAttachmentsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")),
			connect.WithClientOptions(opts...),
		),
		setMemoAttachments: connect.NewClient[api.SetMemoAttachmentsRequest, emptypb.Empty](
			httpClient,
			baseURL+MemoServiceSetMemoAttachmentsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")),
			connect.WithClientOptions(opts...),
		),
		listMemoRelations: connect.NewClient[api.ListMemoRelationsRequest, api.ListMemoRelationsResponse](
			httpClient,
			baseURL+MemoServiceListMemoRelationsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")),
			connect.WithClientOptions(opts...),
		),
		setMemoRelations: connect.NewClient[api.SetMemoRelationsRequest, emptypb.Empty](
			httpClient,
			baseURL+MemoServiceSetMemoRelationsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")),
			connect.WithClientOptions(opts...),
		),
		listMemoComments: connect.NewClient[api.ListMemoCommentsRequest, api.ListMemoCommentsResponse](
			httpClient,
			baseURL+MemoServiceListMemoCommentsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemoComments")),
			connect.WithClientOptions(opts...),
		),
		createMemoComment: connect.NewClient[api.CreateMemoCommentRequest, api.Memo](
			httpClient,
			baseURL+MemoServiceCreateMemoCommentProcedure,
			connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")),
			connect.WithClientOptions(opts...),
		),
		listMemoReactions: connect.NewClient[api.ListMemoReactionsRequest, api.ListMemoReactionsResponse](
			httpClient,
			baseURL+MemoServiceListMemoReactionsProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemoReactions")),
			connect.WithClientOptions(opts...),
		),
		deleteMemoReaction: connect.NewClient[api.DeleteMemoReactionRequest, emptypb.Empty](
			httpClient,
			baseURL+MemoServiceDeleteMemoReactionProcedure,
			connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")),
			connect.WithClientOptions(opts...),
		),
		upsertMemoReaction: connect.NewClient[api.UpsertMemoReactionRequest, api.Reaction](
			httpClient,
			baseURL+MemoServiceUpsertMemoReactionProcedure,
			connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")),
			connect.WithClientOptions(opts...),
		),
		listMemoShares: connect.NewClient[api.ListMemoSharesRequest, api.ListMemoSharesResponse](
			httpClient,
			baseURL+MemoServiceListMemoSharesProcedure,
			connect.WithSchema(memoServiceMethods.ByName("ListMemoShares")),
			connect.WithClientOptions(opts...),
		),
		createMemoShare: connect.NewClient[api.CreateMemoShareRequest, api.MemoShare](
			httpClient,
			baseURL+MemoServiceCreateMemoShareProcedure,
			connect.WithSchema(memoServiceMethods.ByName("CreateMemoShare")),
			connect.WithClientOptions(opts...),
		),
		deleteMemoShare: connect.NewClient[api.DeleteMemoShareRequest, emptypb.Empty](
			httpClient,
			baseURL+MemoServiceDeleteMemoShareProcedure,
			connect.WithSchema(memoServiceMethods.ByName("DeleteMemoShare")),
			connect.WithClientOptions(opts...),
		),
		getSharedMemo: connect.NewClient[api.GetSharedMemoRequest, api.Memo](
			httpClient,
			baseURL+MemoServiceGetSharedMemoProcedure,
			connect.WithSchema(memoServiceMethods.ByName("GetSharedMemo")),
			connect.WithClientOptions(opts...),
		),
		getLinkMetadata: connect.NewClient[api.GetLinkMetadataRequest, api.LinkMetadata](
			httpClient,
			baseURL+MemoServiceGetLinkMetadataProcedure,
			connect.WithSchema(memoServiceMethods.ByName("GetLinkMetadata")),
			connect.WithClientOptions(opts...),
		),
		batchGetLinkMetadata: connect.NewClient[api.BatchGetLinkMetadataRequest, api.BatchGetLinkMetadataResponse](
			httpClient,
			baseURL+MemoServiceBatchGetLinkMetadataProcedure,
			connect.WithSchema(memoServiceMethods.ByName("BatchGetLinkMetadata")),
			connect.WithClientOptions(opts...),
		),
	}
}

// memoServiceClient implements MemoServiceClient.
type memoServiceClient struct {
	listMemos            *connect.Client[api.ListMemosRequest, api.ListMemosResponse]
	getMemo              *connect.Client[api.GetMemoRequest, api.Memo]
	createMemo           *connect.Client[api.CreateMemoRequest, api.Memo]
	updateMemo           *connect.Client[api.UpdateMemoRequest, api.Memo]
	deleteMemo           *connect.Client[api.DeleteMemoRequest, emptypb.Empty]
	listMemoAttachments  *connect.Client[api.ListMemoAttachmentsRequest, api.ListMemoAttachmentsResponse]
	setMemoAttachments   *connect.Client[api.SetMemoAttachmentsRequest, emptypb.Empty]
	listMemoRelations    *connect.Client[api.ListMemoRelationsRequest, api.ListMemoRelationsResponse]
	setMemoRelations     *connect.Client[api.SetMemoRelationsRequest, emptypb.Empty]
	listMemoComments     *connect.Client[api.ListMemoCommentsRequest, api.ListMemoCommentsResponse]
	createMemoComment    *connect.Client[api.CreateMemoCommentRequest, api.Memo]
	listMemoReactions    *connect.Client[api.ListMemoReactionsRequest, api.ListMemoReactionsResponse]
	deleteMemoReaction   *connect.Client[api.DeleteMemoReactionRequest, emptypb.Empty]
	upsertMemoReaction   *connect.Client[api.UpsertMemoReactionRequest, api.Reaction]
	listMemoShares       *connect.Client[api.ListMemoSharesRequest, api.ListMemoSharesResponse]
	createMemoShare      *connect.Client[api.CreateMemoShareRequest, api.MemoShare]
	deleteMemoShare      *connect.Client[api.DeleteMemoShareRequest, emptypb.Empty]
	getSharedMemo        *connect.Client[api.GetSharedMemoRequest, api.Memo]
	getLinkMetadata      *connect.Client[api.GetLinkMetadataRequest, api.LinkMetadata]
	batchGetLinkMetadata *connect.Client[api.BatchGetLinkMetadataRequest, api.BatchGetLinkMetadataResponse]
}

// ListMemos calls memos.api.MemoService.ListMemos.
func (c *memoServiceClient) ListMemos(ctx context.Context, req *connect.Request[api.ListMemosRequest]) (*connect.Response[api.ListMemosResponse], error) {
	return c.listMemos.CallUnary(ctx, req)
}

// GetMemo calls memos.api.MemoService.GetMemo.
func (c *memoServiceClient) GetMemo(ctx context.Context, req *connect.Request[api.GetMemoRequest]) (*connect.Response[api.Memo], error) {
	return c.getMemo.CallUnary(ctx, req)
}

// CreateMemo calls memos.api.MemoService.CreateMemo.
func (c *memoServiceClient) CreateMemo(ctx context.Context, req *connect.Request[api.CreateMemoRequest]) (*connect.Response[api.Memo], error) {
	return c.createMemo.CallUnary(ctx, req)
}

// UpdateMemo calls memos.api.MemoService.UpdateMemo.
func (c *memoServiceClient) UpdateMemo(ctx context.Context, req *connect.Request[api.UpdateMemoRequest]) (*connect.Response[api.Memo], error) {
	return c.updateMemo.CallUnary(ctx, req)
}

// DeleteMemo calls memos.api.MemoService.DeleteMemo.
func (c *memoServiceClient) DeleteMemo(ctx context.Context, req *connect.Request[api.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) {
	return c.deleteMemo.CallUnary(ctx, req)
}

// ListMemoAttachments calls memos.api.MemoService.ListMemoAttachments.
func (c *memoServiceClient) ListMemoAttachments(ctx context.Context, req *connect.Request[api.ListMemoAttachmentsRequest]) (*connect.Response[api.ListMemoAttachmentsResponse], error) {
	return c.listMemoAttachments.CallUnary(ctx, req)
}

// SetMemoAttachments calls memos.api.MemoService.SetMemoAttachments.
func (c *memoServiceClient) SetMemoAttachments(ctx context.Context, req *connect.Request[api.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) {
	return c.setMemoAttachments.CallUnary(ctx, req)
}

// ListMemoRelations calls memos.api.MemoService.ListMemoRelations.
func (c *memoServiceClient) ListMemoRelations(ctx context.Context, req *connect.Request[api.ListMemoRelationsRequest]) (*connect.Response[api.ListMemoRelationsResponse], error) {
	return c.listMemoRelations.CallUnary(ctx, req)
}

// SetMemoRelations calls memos.api.MemoService.SetMemoRelations.
func (c *memoServiceClient) SetMemoRelations(ctx context.Context, req *connect.Request[api.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) {
	return c.setMemoRelations.CallUnary(ctx, req)
}

// ListMemoComments calls memos.api.MemoService.ListMemoComments.
func (c *memoServiceClient) ListMemoComments(ctx context.Context, req *connect.Request[api.ListMemoCommentsRequest]) (*connect.Response[api.ListMemoCommentsResponse], error) {
	return c.listMemoComments.CallUnary(ctx, req)
}

// CreateMemoComment calls memos.api.MemoService.CreateMemoComment.
func (c *memoServiceClient) CreateMemoComment(ctx context.Context, req *connect.Request[api.CreateMemoCommentRequest]) (*connect.Response[api.Memo], error) {
	return c.createMemoComment.CallUnary(ctx, req)
}

// ListMemoReactions calls memos.api.MemoService.ListMemoReactions.
func (c *memoServiceClient) ListMemoReactions(ctx context.Context, req *connect.Request[api.ListMemoReactionsRequest]) (*connect.Response[api.ListMemoReactionsResponse], error) {
	return c.listMemoReactions.CallUnary(ctx, req)
}

// DeleteMemoReaction calls memos.api.MemoService.DeleteMemoReaction.
func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, req *connect.Request[api.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) {
	return c.deleteMemoReaction.CallUnary(ctx, req)
}

// UpsertMemoReaction calls memos.api.MemoService.UpsertMemoReaction.
func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, req *connect.Request[api.UpsertMemoReactionRequest]) (*connect.Response[api.Reaction], error) {
	return c.upsertMemoReaction.CallUnary(ctx, req)
}

// ListMemoShares calls memos.api.MemoService.ListMemoShares.
func (c *memoServiceClient) ListMemoShares(ctx context.Context, req *connect.Request[api.ListMemoSharesRequest]) (*connect.Response[api.ListMemoSharesResponse], error) {
	return c.listMemoShares.CallUnary(ctx, req)
}

// CreateMemoShare calls memos.api.MemoService.CreateMemoShare.
func (c *memoServiceClient) CreateMemoShare(ctx context.Context, req *connect.Request[api.CreateMemoShareRequest]) (*connect.Response[api.MemoShare], error) {
	return c.createMemoShare.CallUnary(ctx, req)
}

// DeleteMemoShare calls memos.api.MemoService.DeleteMemoShare.
func (c *memoServiceClient) DeleteMemoShare(ctx context.Context, req *connect.Request[api.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) {
	return c.deleteMemoShare.CallUnary(ctx, req)
}

// GetSharedMemo calls memos.api.MemoService.GetSharedMemo.
func (c *memoServiceClient) GetSharedMemo(ctx context.Context, req *connect.Request[api.GetSharedMemoRequest]) (*connect.Response[api.Memo], error) {
	return c.getSharedMemo.CallUnary(ctx, req)
}

// GetLinkMetadata calls memos.api.MemoService.GetLinkMetadata.
func (c *memoServiceClient) GetLinkMetadata(ctx context.Context, req *connect.Request[api.GetLinkMetadataRequest]) (*connect.Response[api.LinkMetadata], error) {
	return c.getLinkMetadata.CallUnary(ctx, req)
}

// BatchGetLinkMetadata calls memos.api.MemoService.BatchGetLinkMetadata.
func (c *memoServiceClient) BatchGetLinkMetadata(ctx context.Context, req *connect.Request[api.BatchGetLinkMetadataRequest]) (*connect.Response[api.BatchGetLinkMetadataResponse], error) {
	return c.batchGetLinkMetadata.CallUnary(ctx, req)
}

// MemoServiceHandler is an implementation of the memos.api.MemoService service.
type MemoServiceHandler interface {
	// ListMemos lists the memos the caller can read, excluding comments.
	// Anonymous callers can list only when the instance allows public access.
	ListMemos(context.Context, *connect.Request[api.ListMemosRequest]) (*connect.Response[api.ListMemosResponse], error)
	// GetMemo gets a memo. Requires read access to the memo.
	GetMemo(context.Context, *connect.Request[api.GetMemoRequest]) (*connect.Response[api.Memo], error)
	// CreateMemo creates a memo owned by the authenticated user. The request body
	// is a Memo; set its Markdown content and visibility (defaults to PRIVATE).
	// Requires authentication.
	CreateMemo(context.Context, *connect.Request[api.CreateMemoRequest]) (*connect.Response[api.Memo], error)
	// UpdateMemo updates the memo fields listed in update_mask. Requires the memo
	// creator or an instance administrator.
	UpdateMemo(context.Context, *connect.Request[api.UpdateMemoRequest]) (*connect.Response[api.Memo], error)
	// DeleteMemo deletes the named memo and its comment subtree, including nested
	// replies and their owned resources. It removes incident relations for all
	// deleted memos. Requires the memo creator or an instance administrator.
	DeleteMemo(context.Context, *connect.Request[api.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoAttachments lists the attachments of a memo. Requires read access
	// to the memo.
	ListMemoAttachments(context.Context, *connect.Request[api.ListMemoAttachmentsRequest]) (*connect.Response[api.ListMemoAttachmentsResponse], error)
	// SetMemoAttachments replaces the full set of attachments on a memo with the
	// provided list (not an append). Pass the complete desired set; an empty list
	// clears all attachments. Idempotent. Requires the memo creator or an
	// instance administrator.
	SetMemoAttachments(context.Context, *connect.Request[api.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoRelations lists the relations of a memo in both directions.
	// Requires read access to the memo.
	ListMemoRelations(context.Context, *connect.Request[api.ListMemoRelationsRequest]) (*connect.Response[api.ListMemoRelationsResponse], error)
	// SetMemoRelations replaces the full set of mutable REFERENCE relations on a
	// memo. COMMENT relations are immutable creation context and are rejected by
	// this RPC. An empty list clears references without changing COMMENT.
	// Requires the memo creator or an instance administrator.
	SetMemoRelations(context.Context, *connect.Request[api.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error)
	// ListMemoComments lists the active comments on a memo that the caller can
	// read. Requires read access to the memo.
	ListMemoComments(context.Context, *connect.Request[api.ListMemoCommentsRequest]) (*connect.Response[api.ListMemoCommentsResponse], error)
	// CreateMemoComment atomically creates an independent memo plus one immutable
	// COMMENT context relation to the named memo. The new memo keeps its own
	// placement, visibility, authorship, and lifecycle. The named memo must be
	// readable by the caller and not archived.
	CreateMemoComment(context.Context, *connect.Request[api.CreateMemoCommentRequest]) (*connect.Response[api.Memo], error)
	// ListMemoReactions lists the reactions on a memo. Requires read access to
	// the memo.
	ListMemoReactions(context.Context, *connect.Request[api.ListMemoReactionsRequest]) (*connect.Response[api.ListMemoReactionsResponse], error)
	// DeleteMemoReaction deletes a reaction. Requires the reaction creator or an
	// instance administrator.
	DeleteMemoReaction(context.Context, *connect.Request[api.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error)
	// UpsertMemoReaction adds or updates the authenticated user's reaction on a
	// memo. Requires read access to the memo.
	UpsertMemoReaction(context.Context, *connect.Request[api.UpsertMemoReactionRequest]) (*connect.Response[api.Reaction], error)
	// ListMemoShares lists all share links for a memo. Requires the memo creator
	// or an instance administrator.
	ListMemoShares(context.Context, *connect.Request[api.ListMemoSharesRequest]) (*connect.Response[api.ListMemoSharesResponse], error)
	// CreateMemoShare creates a share link for a memo. Requires the memo creator
	// or an instance administrator. Only active memos without SPACE visibility
	// can be shared.
	CreateMemoShare(context.Context, *connect.Request[api.CreateMemoShareRequest]) (*connect.Response[api.MemoShare], error)
	// DeleteMemoShare revokes a share link. Requires the memo creator or an
	// instance administrator.
	DeleteMemoShare(context.Context, *connect.Request[api.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error)
	// GetSharedMemo resolves a share token to its memo. No authentication is
	// required. Returns NOT_FOUND if the token is invalid or expired.
	GetSharedMemo(context.Context, *connect.Request[api.GetSharedMemoRequest]) (*connect.Response[api.Memo], error)
	// GetLinkMetadata fetches the title, description, and image of a link.
	GetLinkMetadata(context.Context, *connect.Request[api.GetLinkMetadataRequest]) (*connect.Response[api.LinkMetadata], error)
	// BatchGetLinkMetadata fetches the metadata of up to 10 links.
	BatchGetLinkMetadata(context.Context, *connect.Request[api.BatchGetLinkMetadataRequest]) (*connect.Response[api.BatchGetLinkMetadataResponse], error)
}

// NewMemoServiceHandler 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 NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	memoServiceMethods := api.File_api_memo_service_proto.Services().ByName("MemoService").Methods()
	memoServiceListMemosHandler := connect.NewUnaryHandler(
		MemoServiceListMemosProcedure,
		svc.ListMemos,
		connect.WithSchema(memoServiceMethods.ByName("ListMemos")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceGetMemoHandler := connect.NewUnaryHandler(
		MemoServiceGetMemoProcedure,
		svc.GetMemo,
		connect.WithSchema(memoServiceMethods.ByName("GetMemo")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceCreateMemoHandler := connect.NewUnaryHandler(
		MemoServiceCreateMemoProcedure,
		svc.CreateMemo,
		connect.WithSchema(memoServiceMethods.ByName("CreateMemo")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceUpdateMemoHandler := connect.NewUnaryHandler(
		MemoServiceUpdateMemoProcedure,
		svc.UpdateMemo,
		connect.WithSchema(memoServiceMethods.ByName("UpdateMemo")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceDeleteMemoHandler := connect.NewUnaryHandler(
		MemoServiceDeleteMemoProcedure,
		svc.DeleteMemo,
		connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceListMemoAttachmentsHandler := connect.NewUnaryHandler(
		MemoServiceListMemoAttachmentsProcedure,
		svc.ListMemoAttachments,
		connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceSetMemoAttachmentsHandler := connect.NewUnaryHandler(
		MemoServiceSetMemoAttachmentsProcedure,
		svc.SetMemoAttachments,
		connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceListMemoRelationsHandler := connect.NewUnaryHandler(
		MemoServiceListMemoRelationsProcedure,
		svc.ListMemoRelations,
		connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceSetMemoRelationsHandler := connect.NewUnaryHandler(
		MemoServiceSetMemoRelationsProcedure,
		svc.SetMemoRelations,
		connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceListMemoCommentsHandler := connect.NewUnaryHandler(
		MemoServiceListMemoCommentsProcedure,
		svc.ListMemoComments,
		connect.WithSchema(memoServiceMethods.ByName("ListMemoComments")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceCreateMemoCommentHandler := connect.NewUnaryHandler(
		MemoServiceCreateMemoCommentProcedure,
		svc.CreateMemoComment,
		connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceListMemoReactionsHandler := connect.NewUnaryHandler(
		MemoServiceListMemoReactionsProcedure,
		svc.ListMemoReactions,
		connect.WithSchema(memoServiceMethods.ByName("ListMemoReactions")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceDeleteMemoReactionHandler := connect.NewUnaryHandler(
		MemoServiceDeleteMemoReactionProcedure,
		svc.DeleteMemoReaction,
		connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceUpsertMemoReactionHandler := connect.NewUnaryHandler(
		MemoServiceUpsertMemoReactionProcedure,
		svc.UpsertMemoReaction,
		connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceListMemoSharesHandler := connect.NewUnaryHandler(
		MemoServiceListMemoSharesProcedure,
		svc.ListMemoShares,
		connect.WithSchema(memoServiceMethods.ByName("ListMemoShares")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceCreateMemoShareHandler := connect.NewUnaryHandler(
		MemoServiceCreateMemoShareProcedure,
		svc.CreateMemoShare,
		connect.WithSchema(memoServiceMethods.ByName("CreateMemoShare")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceDeleteMemoShareHandler := connect.NewUnaryHandler(
		MemoServiceDeleteMemoShareProcedure,
		svc.DeleteMemoShare,
		connect.WithSchema(memoServiceMethods.ByName("DeleteMemoShare")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceGetSharedMemoHandler := connect.NewUnaryHandler(
		MemoServiceGetSharedMemoProcedure,
		svc.GetSharedMemo,
		connect.WithSchema(memoServiceMethods.ByName("GetSharedMemo")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceGetLinkMetadataHandler := connect.NewUnaryHandler(
		MemoServiceGetLinkMetadataProcedure,
		svc.GetLinkMetadata,
		connect.WithSchema(memoServiceMethods.ByName("GetLinkMetadata")),
		connect.WithHandlerOptions(opts...),
	)
	memoServiceBatchGetLinkMetadataHandler := connect.NewUnaryHandler(
		MemoServiceBatchGetLinkMetadataProcedure,
		svc.BatchGetLinkMetadata,
		connect.WithSchema(memoServiceMethods.ByName("BatchGetLinkMetadata")),
		connect.WithHandlerOptions(opts...),
	)
	return "/memos.api.MemoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case MemoServiceListMemosProcedure:
			memoServiceListMemosHandler.ServeHTTP(w, r)
		case MemoServiceGetMemoProcedure:
			memoServiceGetMemoHandler.ServeHTTP(w, r)
		case MemoServiceCreateMemoProcedure:
			memoServiceCreateMemoHandler.ServeHTTP(w, r)
		case MemoServiceUpdateMemoProcedure:
			memoServiceUpdateMemoHandler.ServeHTTP(w, r)
		case MemoServiceDeleteMemoProcedure:
			memoServiceDeleteMemoHandler.ServeHTTP(w, r)
		case MemoServiceListMemoAttachmentsProcedure:
			memoServiceListMemoAttachmentsHandler.ServeHTTP(w, r)
		case MemoServiceSetMemoAttachmentsProcedure:
			memoServiceSetMemoAttachmentsHandler.ServeHTTP(w, r)
		case MemoServiceListMemoRelationsProcedure:
			memoServiceListMemoRelationsHandler.ServeHTTP(w, r)
		case MemoServiceSetMemoRelationsProcedure:
			memoServiceSetMemoRelationsHandler.ServeHTTP(w, r)
		case MemoServiceListMemoCommentsProcedure:
			memoServiceListMemoCommentsHandler.ServeHTTP(w, r)
		case MemoServiceCreateMemoCommentProcedure:
			memoServiceCreateMemoCommentHandler.ServeHTTP(w, r)
		case MemoServiceListMemoReactionsProcedure:
			memoServiceListMemoReactionsHandler.ServeHTTP(w, r)
		case MemoServiceDeleteMemoReactionProcedure:
			memoServiceDeleteMemoReactionHandler.ServeHTTP(w, r)
		case MemoServiceUpsertMemoReactionProcedure:
			memoServiceUpsertMemoReactionHandler.ServeHTTP(w, r)
		case MemoServiceListMemoSharesProcedure:
			memoServiceListMemoSharesHandler.ServeHTTP(w, r)
		case MemoServiceCreateMemoShareProcedure:
			memoServiceCreateMemoShareHandler.ServeHTTP(w, r)
		case MemoServiceDeleteMemoShareProcedure:
			memoServiceDeleteMemoShareHandler.ServeHTTP(w, r)
		case MemoServiceGetSharedMemoProcedure:
			memoServiceGetSharedMemoHandler.ServeHTTP(w, r)
		case MemoServiceGetLinkMetadataProcedure:
			memoServiceGetLinkMetadataHandler.ServeHTTP(w, r)
		case MemoServiceBatchGetLinkMetadataProcedure:
			memoServiceBatchGetLinkMetadataHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

// UnimplementedMemoServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedMemoServiceHandler struct{}

func (UnimplementedMemoServiceHandler) ListMemos(context.Context, *connect.Request[api.ListMemosRequest]) (*connect.Response[api.ListMemosResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemos is not implemented"))
}

func (UnimplementedMemoServiceHandler) GetMemo(context.Context, *connect.Request[api.GetMemoRequest]) (*connect.Response[api.Memo], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.GetMemo is not implemented"))
}

func (UnimplementedMemoServiceHandler) CreateMemo(context.Context, *connect.Request[api.CreateMemoRequest]) (*connect.Response[api.Memo], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.CreateMemo is not implemented"))
}

func (UnimplementedMemoServiceHandler) UpdateMemo(context.Context, *connect.Request[api.UpdateMemoRequest]) (*connect.Response[api.Memo], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.UpdateMemo is not implemented"))
}

func (UnimplementedMemoServiceHandler) DeleteMemo(context.Context, *connect.Request[api.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.DeleteMemo is not implemented"))
}

func (UnimplementedMemoServiceHandler) ListMemoAttachments(context.Context, *connect.Request[api.ListMemoAttachmentsRequest]) (*connect.Response[api.ListMemoAttachmentsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemoAttachments is not implemented"))
}

func (UnimplementedMemoServiceHandler) SetMemoAttachments(context.Context, *connect.Request[api.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.SetMemoAttachments is not implemented"))
}

func (UnimplementedMemoServiceHandler) ListMemoRelations(context.Context, *connect.Request[api.ListMemoRelationsRequest]) (*connect.Response[api.ListMemoRelationsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemoRelations is not implemented"))
}

func (UnimplementedMemoServiceHandler) SetMemoRelations(context.Context, *connect.Request[api.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.SetMemoRelations is not implemented"))
}

func (UnimplementedMemoServiceHandler) ListMemoComments(context.Context, *connect.Request[api.ListMemoCommentsRequest]) (*connect.Response[api.ListMemoCommentsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemoComments is not implemented"))
}

func (UnimplementedMemoServiceHandler) CreateMemoComment(context.Context, *connect.Request[api.CreateMemoCommentRequest]) (*connect.Response[api.Memo], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.CreateMemoComment is not implemented"))
}

func (UnimplementedMemoServiceHandler) ListMemoReactions(context.Context, *connect.Request[api.ListMemoReactionsRequest]) (*connect.Response[api.ListMemoReactionsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemoReactions is not implemented"))
}

func (UnimplementedMemoServiceHandler) DeleteMemoReaction(context.Context, *connect.Request[api.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.DeleteMemoReaction is not implemented"))
}

func (UnimplementedMemoServiceHandler) UpsertMemoReaction(context.Context, *connect.Request[api.UpsertMemoReactionRequest]) (*connect.Response[api.Reaction], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.UpsertMemoReaction is not implemented"))
}

func (UnimplementedMemoServiceHandler) ListMemoShares(context.Context, *connect.Request[api.ListMemoSharesRequest]) (*connect.Response[api.ListMemoSharesResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.ListMemoShares is not implemented"))
}

func (UnimplementedMemoServiceHandler) CreateMemoShare(context.Context, *connect.Request[api.CreateMemoShareRequest]) (*connect.Response[api.MemoShare], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.CreateMemoShare is not implemented"))
}

func (UnimplementedMemoServiceHandler) DeleteMemoShare(context.Context, *connect.Request[api.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.DeleteMemoShare is not implemented"))
}

func (UnimplementedMemoServiceHandler) GetSharedMemo(context.Context, *connect.Request[api.GetSharedMemoRequest]) (*connect.Response[api.Memo], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.GetSharedMemo is not implemented"))
}

func (UnimplementedMemoServiceHandler) GetLinkMetadata(context.Context, *connect.Request[api.GetLinkMetadataRequest]) (*connect.Response[api.LinkMetadata], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.GetLinkMetadata is not implemented"))
}

func (UnimplementedMemoServiceHandler) BatchGetLinkMetadata(context.Context, *connect.Request[api.BatchGetLinkMetadataRequest]) (*connect.Response[api.BatchGetLinkMetadataResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.MemoService.BatchGetLinkMetadata is not implemented"))
}