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.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: api/user_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 (
// UserServiceName is the fully-qualified name of the UserService service.
UserServiceName = "memos.api.UserService"
)
// 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 (
// UserServiceListUsersProcedure is the fully-qualified name of the UserService's ListUsers RPC.
UserServiceListUsersProcedure = "/memos.api.UserService/ListUsers"
// UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC.
UserServiceGetUserProcedure = "/memos.api.UserService/GetUser"
// UserServiceBatchGetUsersProcedure is the fully-qualified name of the UserService's BatchGetUsers
// RPC.
UserServiceBatchGetUsersProcedure = "/memos.api.UserService/BatchGetUsers"
// UserServiceCreateUserProcedure is the fully-qualified name of the UserService's CreateUser RPC.
UserServiceCreateUserProcedure = "/memos.api.UserService/CreateUser"
// UserServiceUpdateUserProcedure is the fully-qualified name of the UserService's UpdateUser RPC.
UserServiceUpdateUserProcedure = "/memos.api.UserService/UpdateUser"
// UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC.
UserServiceDeleteUserProcedure = "/memos.api.UserService/DeleteUser"
// UserServiceListUserSettingsProcedure is the fully-qualified name of the UserService's
// ListUserSettings RPC.
UserServiceListUserSettingsProcedure = "/memos.api.UserService/ListUserSettings"
// UserServiceGetUserSettingProcedure is the fully-qualified name of the UserService's
// GetUserSetting RPC.
UserServiceGetUserSettingProcedure = "/memos.api.UserService/GetUserSetting"
// UserServiceUpdateUserSettingProcedure is the fully-qualified name of the UserService's
// UpdateUserSetting RPC.
UserServiceUpdateUserSettingProcedure = "/memos.api.UserService/UpdateUserSetting"
// UserServiceListUserStatsProcedure is the fully-qualified name of the UserService's ListUserStats
// RPC.
UserServiceListUserStatsProcedure = "/memos.api.UserService/ListUserStats"
// UserServiceGetUserStatsProcedure is the fully-qualified name of the UserService's GetUserStats
// RPC.
UserServiceGetUserStatsProcedure = "/memos.api.UserService/GetUserStats"
// UserServiceGetUserUsageProcedure is the fully-qualified name of the UserService's GetUserUsage
// RPC.
UserServiceGetUserUsageProcedure = "/memos.api.UserService/GetUserUsage"
// UserServiceListMemoViewsProcedure is the fully-qualified name of the UserService's ListMemoViews
// RPC.
UserServiceListMemoViewsProcedure = "/memos.api.UserService/ListMemoViews"
// UserServiceGetMemoViewProcedure is the fully-qualified name of the UserService's GetMemoView RPC.
UserServiceGetMemoViewProcedure = "/memos.api.UserService/GetMemoView"
// UserServiceCreateMemoViewProcedure is the fully-qualified name of the UserService's
// CreateMemoView RPC.
UserServiceCreateMemoViewProcedure = "/memos.api.UserService/CreateMemoView"
// UserServiceUpdateMemoViewProcedure is the fully-qualified name of the UserService's
// UpdateMemoView RPC.
UserServiceUpdateMemoViewProcedure = "/memos.api.UserService/UpdateMemoView"
// UserServiceDeleteMemoViewProcedure is the fully-qualified name of the UserService's
// DeleteMemoView RPC.
UserServiceDeleteMemoViewProcedure = "/memos.api.UserService/DeleteMemoView"
// UserServiceListUserNotificationsProcedure is the fully-qualified name of the UserService's
// ListUserNotifications RPC.
UserServiceListUserNotificationsProcedure = "/memos.api.UserService/ListUserNotifications"
// UserServiceUpdateUserNotificationProcedure is the fully-qualified name of the UserService's
// UpdateUserNotification RPC.
UserServiceUpdateUserNotificationProcedure = "/memos.api.UserService/UpdateUserNotification"
// UserServiceDeleteUserNotificationProcedure is the fully-qualified name of the UserService's
// DeleteUserNotification RPC.
UserServiceDeleteUserNotificationProcedure = "/memos.api.UserService/DeleteUserNotification"
// UserServiceListUserWebhooksProcedure is the fully-qualified name of the UserService's
// ListUserWebhooks RPC.
UserServiceListUserWebhooksProcedure = "/memos.api.UserService/ListUserWebhooks"
// UserServiceCreateUserWebhookProcedure is the fully-qualified name of the UserService's
// CreateUserWebhook RPC.
UserServiceCreateUserWebhookProcedure = "/memos.api.UserService/CreateUserWebhook"
// UserServiceUpdateUserWebhookProcedure is the fully-qualified name of the UserService's
// UpdateUserWebhook RPC.
UserServiceUpdateUserWebhookProcedure = "/memos.api.UserService/UpdateUserWebhook"
// UserServiceDeleteUserWebhookProcedure is the fully-qualified name of the UserService's
// DeleteUserWebhook RPC.
UserServiceDeleteUserWebhookProcedure = "/memos.api.UserService/DeleteUserWebhook"
// UserServiceGetUserWebhookSigningSecretProcedure is the fully-qualified name of the UserService's
// GetUserWebhookSigningSecret RPC.
UserServiceGetUserWebhookSigningSecretProcedure = "/memos.api.UserService/GetUserWebhookSigningSecret"
// UserServiceListLinkedIdentitiesProcedure is the fully-qualified name of the UserService's
// ListLinkedIdentities RPC.
UserServiceListLinkedIdentitiesProcedure = "/memos.api.UserService/ListLinkedIdentities"
// UserServiceGetLinkedIdentityProcedure is the fully-qualified name of the UserService's
// GetLinkedIdentity RPC.
UserServiceGetLinkedIdentityProcedure = "/memos.api.UserService/GetLinkedIdentity"
// UserServiceCreateLinkedIdentityProcedure is the fully-qualified name of the UserService's
// CreateLinkedIdentity RPC.
UserServiceCreateLinkedIdentityProcedure = "/memos.api.UserService/CreateLinkedIdentity"
// UserServiceDeleteLinkedIdentityProcedure is the fully-qualified name of the UserService's
// DeleteLinkedIdentity RPC.
UserServiceDeleteLinkedIdentityProcedure = "/memos.api.UserService/DeleteLinkedIdentity"
// UserServiceListPersonalAccessTokensProcedure is the fully-qualified name of the UserService's
// ListPersonalAccessTokens RPC.
UserServiceListPersonalAccessTokensProcedure = "/memos.api.UserService/ListPersonalAccessTokens"
// UserServiceCreatePersonalAccessTokenProcedure is the fully-qualified name of the UserService's
// CreatePersonalAccessToken RPC.
UserServiceCreatePersonalAccessTokenProcedure = "/memos.api.UserService/CreatePersonalAccessToken"
// UserServiceDeletePersonalAccessTokenProcedure is the fully-qualified name of the UserService's
// DeletePersonalAccessToken RPC.
UserServiceDeletePersonalAccessTokenProcedure = "/memos.api.UserService/DeletePersonalAccessToken"
// UserServiceImportMemosProcedure is the fully-qualified name of the UserService's ImportMemos RPC.
UserServiceImportMemosProcedure = "/memos.api.UserService/ImportMemos"
)
// UserServiceClient is a client for the memos.api.UserService service.
type UserServiceClient interface {
// ListUsers lists users in every state. Only admins may call it.
ListUsers(context.Context, *connect.Request[api.ListUsersRequest]) (*connect.Response[api.ListUsersResponse], error)
// GetUser gets a user by resource name.
GetUser(context.Context, *connect.Request[api.GetUserRequest]) (*connect.Response[api.User], error)
// BatchGetUsers gets active users by username. Usernames that match no
// active user are omitted from the response.
BatchGetUsers(context.Context, *connect.Request[api.BatchGetUsersRequest]) (*connect.Response[api.BatchGetUsersResponse], error)
// CreateUser creates a user. The first user of an instance becomes an admin.
// Otherwise, unless an admin calls it, the instance must allow user
// registration and password sign-up, and the new user gets the USER role.
CreateUser(context.Context, *connect.Request[api.CreateUserRequest]) (*connect.Response[api.User], error)
// UpdateUser updates a user. Users may update themselves; admins may update
// anyone. Changing the password ends the user's other sessions.
UpdateUser(context.Context, *connect.Request[api.UpdateUserRequest]) (*connect.Response[api.User], error)
// DeleteUser deletes a user. Users may delete themselves; admins may delete
// anyone. A user who belongs to any space cannot be deleted.
DeleteUser(context.Context, *connect.Request[api.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserSettings lists the settings of a user. Only the user may call it.
// The GENERAL setting is always included, with defaults when it was never
// saved.
ListUserSettings(context.Context, *connect.Request[api.ListUserSettingsRequest]) (*connect.Response[api.ListUserSettingsResponse], error)
// GetUserSetting gets a user setting. Only the user may call it.
GetUserSetting(context.Context, *connect.Request[api.GetUserSettingRequest]) (*connect.Response[api.UserSetting], error)
// UpdateUserSetting updates a user setting. Only the user may call it, and
// only the GENERAL and TAGS settings can be updated.
UpdateUserSetting(context.Context, *connect.Request[api.UpdateUserSettingRequest]) (*connect.Response[api.UserSetting], error)
// ListUserStats returns memo statistics for every user who created at least
// one matching memo the caller can read. Use the parent users/- for all
// users, or users/{user} for one user.
ListUserStats(context.Context, *connect.Request[api.ListUserStatsRequest]) (*connect.Response[api.ListUserStatsResponse], error)
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(context.Context, *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error)
// GetUserUsage returns a user's usage and the usage limits in effect for the
// user. Only the user or an admin may call it.
GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error)
// ListMemoViews lists 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. Only the user may call it.
ListMemoViews(context.Context, *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error)
// GetMemoView gets a memo view. Only the owner may call it.
GetMemoView(context.Context, *connect.Request[api.GetMemoViewRequest]) (*connect.Response[api.MemoView], error)
// CreateMemoView creates a memo view for a user. Only the user may call it.
CreateMemoView(context.Context, *connect.Request[api.CreateMemoViewRequest]) (*connect.Response[api.MemoView], error)
// UpdateMemoView updates a memo view. Only the owner may call it.
UpdateMemoView(context.Context, *connect.Request[api.UpdateMemoViewRequest]) (*connect.Response[api.MemoView], error)
// DeleteMemoView deletes a memo view. Only the owner may call it.
DeleteMemoView(context.Context, *connect.Request[api.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserNotifications lists a user's notifications. Only the user may call
// it. Notifications whose memos or space invitation the user can no longer
// read are left out.
ListUserNotifications(context.Context, *connect.Request[api.ListUserNotificationsRequest]) (*connect.Response[api.ListUserNotificationsResponse], error)
// UpdateUserNotification updates a notification's status. Only the receiver
// may call it.
UpdateUserNotification(context.Context, *connect.Request[api.UpdateUserNotificationRequest]) (*connect.Response[api.UserNotification], error)
// DeleteUserNotification permanently deletes a notification. Only the
// receiver may call it.
DeleteUserNotification(context.Context, *connect.Request[api.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserWebhooks lists a user's webhooks. Only the user may call it.
ListUserWebhooks(context.Context, *connect.Request[api.ListUserWebhooksRequest]) (*connect.Response[api.ListUserWebhooksResponse], error)
// CreateUserWebhook creates a webhook for a user. Only the user may call it.
// The service generates a signing secret when none is given.
CreateUserWebhook(context.Context, *connect.Request[api.CreateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error)
// UpdateUserWebhook updates a webhook. Only the owner may call it.
UpdateUserWebhook(context.Context, *connect.Request[api.UpdateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error)
// DeleteUserWebhook deletes a webhook. Only the owner may call it.
DeleteUserWebhook(context.Context, *connect.Request[api.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error)
// GetUserWebhookSigningSecret returns the signing secret of a webhook. Only
// the owner may call it. The secret is returned only through this call; it
// is never included in List, Create or Update responses.
GetUserWebhookSigningSecret(context.Context, *connect.Request[api.GetUserWebhookSigningSecretRequest]) (*connect.Response[api.GetUserWebhookSigningSecretResponse], error)
// ListLinkedIdentities lists the SSO identities linked to a user. The user
// and admins may call it.
ListLinkedIdentities(context.Context, *connect.Request[api.ListLinkedIdentitiesRequest]) (*connect.Response[api.ListLinkedIdentitiesResponse], error)
// GetLinkedIdentity gets an SSO identity linked to a user. The user and
// admins may call it.
GetLinkedIdentity(context.Context, *connect.Request[api.GetLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error)
// CreateLinkedIdentity completes an OAuth flow and links the resulting SSO
// identity to the authenticated user, who must be the parent.
CreateLinkedIdentity(context.Context, *connect.Request[api.CreateLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error)
// DeleteLinkedIdentity unlinks an SSO identity from a user. The user and
// admins may call it.
DeleteLinkedIdentity(context.Context, *connect.Request[api.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error)
// ListPersonalAccessTokens lists a user's personal access tokens (PATs),
// without their token values. PATs are long-lived tokens for API and script
// access, distinct from short-lived JWT access tokens. The user and admins
// may call it.
ListPersonalAccessTokens(context.Context, *connect.Request[api.ListPersonalAccessTokensRequest]) (*connect.Response[api.ListPersonalAccessTokensResponse], error)
// CreatePersonalAccessToken creates a personal access token for a user.
// Only the user may call it. The token value is returned only once, in the
// response.
CreatePersonalAccessToken(context.Context, *connect.Request[api.CreatePersonalAccessTokenRequest]) (*connect.Response[api.CreatePersonalAccessTokenResponse], error)
// DeletePersonalAccessToken deletes a personal access token, which stops
// working immediately. Only the owner may call it.
DeletePersonalAccessToken(context.Context, *connect.Request[api.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error)
// ImportMemos uploads a Memos export file in bounded chunks and imports it
// into the user's memos. The first call carries the spec and returns an
// upload_id; later calls carry that upload_id. A finishing call with
// validate_only returns the plan and keeps the archive staged; a finishing
// call without it imports and returns the report. Uploads are bound to the
// authenticated user, expire after 30 minutes of inactivity, and do not
// survive a server restart.
ImportMemos(context.Context, *connect.Request[api.ImportMemosRequest]) (*connect.Response[api.ImportMemosResponse], error)
}
// NewUserServiceClient constructs a client for the memos.api.UserService 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 NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) UserServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
userServiceMethods := api.File_api_user_service_proto.Services().ByName("UserService").Methods()
return &userServiceClient{
listUsers: connect.NewClient[api.ListUsersRequest, api.ListUsersResponse](
httpClient,
baseURL+UserServiceListUsersProcedure,
connect.WithSchema(userServiceMethods.ByName("ListUsers")),
connect.WithClientOptions(opts...),
),
getUser: connect.NewClient[api.GetUserRequest, api.User](
httpClient,
baseURL+UserServiceGetUserProcedure,
connect.WithSchema(userServiceMethods.ByName("GetUser")),
connect.WithClientOptions(opts...),
),
batchGetUsers: connect.NewClient[api.BatchGetUsersRequest, api.BatchGetUsersResponse](
httpClient,
baseURL+UserServiceBatchGetUsersProcedure,
connect.WithSchema(userServiceMethods.ByName("BatchGetUsers")),
connect.WithClientOptions(opts...),
),
createUser: connect.NewClient[api.CreateUserRequest, api.User](
httpClient,
baseURL+UserServiceCreateUserProcedure,
connect.WithSchema(userServiceMethods.ByName("CreateUser")),
connect.WithClientOptions(opts...),
),
updateUser: connect.NewClient[api.UpdateUserRequest, api.User](
httpClient,
baseURL+UserServiceUpdateUserProcedure,
connect.WithSchema(userServiceMethods.ByName("UpdateUser")),
connect.WithClientOptions(opts...),
),
deleteUser: connect.NewClient[api.DeleteUserRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeleteUserProcedure,
connect.WithSchema(userServiceMethods.ByName("DeleteUser")),
connect.WithClientOptions(opts...),
),
listUserSettings: connect.NewClient[api.ListUserSettingsRequest, api.ListUserSettingsResponse](
httpClient,
baseURL+UserServiceListUserSettingsProcedure,
connect.WithSchema(userServiceMethods.ByName("ListUserSettings")),
connect.WithClientOptions(opts...),
),
getUserSetting: connect.NewClient[api.GetUserSettingRequest, api.UserSetting](
httpClient,
baseURL+UserServiceGetUserSettingProcedure,
connect.WithSchema(userServiceMethods.ByName("GetUserSetting")),
connect.WithClientOptions(opts...),
),
updateUserSetting: connect.NewClient[api.UpdateUserSettingRequest, api.UserSetting](
httpClient,
baseURL+UserServiceUpdateUserSettingProcedure,
connect.WithSchema(userServiceMethods.ByName("UpdateUserSetting")),
connect.WithClientOptions(opts...),
),
listUserStats: connect.NewClient[api.ListUserStatsRequest, api.ListUserStatsResponse](
httpClient,
baseURL+UserServiceListUserStatsProcedure,
connect.WithSchema(userServiceMethods.ByName("ListUserStats")),
connect.WithClientOptions(opts...),
),
getUserStats: connect.NewClient[api.GetUserStatsRequest, api.UserStats](
httpClient,
baseURL+UserServiceGetUserStatsProcedure,
connect.WithSchema(userServiceMethods.ByName("GetUserStats")),
connect.WithClientOptions(opts...),
),
getUserUsage: connect.NewClient[api.GetUserUsageRequest, api.UserUsage](
httpClient,
baseURL+UserServiceGetUserUsageProcedure,
connect.WithSchema(userServiceMethods.ByName("GetUserUsage")),
connect.WithClientOptions(opts...),
),
listMemoViews: connect.NewClient[api.ListMemoViewsRequest, api.ListMemoViewsResponse](
httpClient,
baseURL+UserServiceListMemoViewsProcedure,
connect.WithSchema(userServiceMethods.ByName("ListMemoViews")),
connect.WithClientOptions(opts...),
),
getMemoView: connect.NewClient[api.GetMemoViewRequest, api.MemoView](
httpClient,
baseURL+UserServiceGetMemoViewProcedure,
connect.WithSchema(userServiceMethods.ByName("GetMemoView")),
connect.WithClientOptions(opts...),
),
createMemoView: connect.NewClient[api.CreateMemoViewRequest, api.MemoView](
httpClient,
baseURL+UserServiceCreateMemoViewProcedure,
connect.WithSchema(userServiceMethods.ByName("CreateMemoView")),
connect.WithClientOptions(opts...),
),
updateMemoView: connect.NewClient[api.UpdateMemoViewRequest, api.MemoView](
httpClient,
baseURL+UserServiceUpdateMemoViewProcedure,
connect.WithSchema(userServiceMethods.ByName("UpdateMemoView")),
connect.WithClientOptions(opts...),
),
deleteMemoView: connect.NewClient[api.DeleteMemoViewRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeleteMemoViewProcedure,
connect.WithSchema(userServiceMethods.ByName("DeleteMemoView")),
connect.WithClientOptions(opts...),
),
listUserNotifications: connect.NewClient[api.ListUserNotificationsRequest, api.ListUserNotificationsResponse](
httpClient,
baseURL+UserServiceListUserNotificationsProcedure,
connect.WithSchema(userServiceMethods.ByName("ListUserNotifications")),
connect.WithClientOptions(opts...),
),
updateUserNotification: connect.NewClient[api.UpdateUserNotificationRequest, api.UserNotification](
httpClient,
baseURL+UserServiceUpdateUserNotificationProcedure,
connect.WithSchema(userServiceMethods.ByName("UpdateUserNotification")),
connect.WithClientOptions(opts...),
),
deleteUserNotification: connect.NewClient[api.DeleteUserNotificationRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeleteUserNotificationProcedure,
connect.WithSchema(userServiceMethods.ByName("DeleteUserNotification")),
connect.WithClientOptions(opts...),
),
listUserWebhooks: connect.NewClient[api.ListUserWebhooksRequest, api.ListUserWebhooksResponse](
httpClient,
baseURL+UserServiceListUserWebhooksProcedure,
connect.WithSchema(userServiceMethods.ByName("ListUserWebhooks")),
connect.WithClientOptions(opts...),
),
createUserWebhook: connect.NewClient[api.CreateUserWebhookRequest, api.UserWebhook](
httpClient,
baseURL+UserServiceCreateUserWebhookProcedure,
connect.WithSchema(userServiceMethods.ByName("CreateUserWebhook")),
connect.WithClientOptions(opts...),
),
updateUserWebhook: connect.NewClient[api.UpdateUserWebhookRequest, api.UserWebhook](
httpClient,
baseURL+UserServiceUpdateUserWebhookProcedure,
connect.WithSchema(userServiceMethods.ByName("UpdateUserWebhook")),
connect.WithClientOptions(opts...),
),
deleteUserWebhook: connect.NewClient[api.DeleteUserWebhookRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeleteUserWebhookProcedure,
connect.WithSchema(userServiceMethods.ByName("DeleteUserWebhook")),
connect.WithClientOptions(opts...),
),
getUserWebhookSigningSecret: connect.NewClient[api.GetUserWebhookSigningSecretRequest, api.GetUserWebhookSigningSecretResponse](
httpClient,
baseURL+UserServiceGetUserWebhookSigningSecretProcedure,
connect.WithSchema(userServiceMethods.ByName("GetUserWebhookSigningSecret")),
connect.WithClientOptions(opts...),
),
listLinkedIdentities: connect.NewClient[api.ListLinkedIdentitiesRequest, api.ListLinkedIdentitiesResponse](
httpClient,
baseURL+UserServiceListLinkedIdentitiesProcedure,
connect.WithSchema(userServiceMethods.ByName("ListLinkedIdentities")),
connect.WithClientOptions(opts...),
),
getLinkedIdentity: connect.NewClient[api.GetLinkedIdentityRequest, api.LinkedIdentity](
httpClient,
baseURL+UserServiceGetLinkedIdentityProcedure,
connect.WithSchema(userServiceMethods.ByName("GetLinkedIdentity")),
connect.WithClientOptions(opts...),
),
createLinkedIdentity: connect.NewClient[api.CreateLinkedIdentityRequest, api.LinkedIdentity](
httpClient,
baseURL+UserServiceCreateLinkedIdentityProcedure,
connect.WithSchema(userServiceMethods.ByName("CreateLinkedIdentity")),
connect.WithClientOptions(opts...),
),
deleteLinkedIdentity: connect.NewClient[api.DeleteLinkedIdentityRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeleteLinkedIdentityProcedure,
connect.WithSchema(userServiceMethods.ByName("DeleteLinkedIdentity")),
connect.WithClientOptions(opts...),
),
listPersonalAccessTokens: connect.NewClient[api.ListPersonalAccessTokensRequest, api.ListPersonalAccessTokensResponse](
httpClient,
baseURL+UserServiceListPersonalAccessTokensProcedure,
connect.WithSchema(userServiceMethods.ByName("ListPersonalAccessTokens")),
connect.WithClientOptions(opts...),
),
createPersonalAccessToken: connect.NewClient[api.CreatePersonalAccessTokenRequest, api.CreatePersonalAccessTokenResponse](
httpClient,
baseURL+UserServiceCreatePersonalAccessTokenProcedure,
connect.WithSchema(userServiceMethods.ByName("CreatePersonalAccessToken")),
connect.WithClientOptions(opts...),
),
deletePersonalAccessToken: connect.NewClient[api.DeletePersonalAccessTokenRequest, emptypb.Empty](
httpClient,
baseURL+UserServiceDeletePersonalAccessTokenProcedure,
connect.WithSchema(userServiceMethods.ByName("DeletePersonalAccessToken")),
connect.WithClientOptions(opts...),
),
importMemos: connect.NewClient[api.ImportMemosRequest, api.ImportMemosResponse](
httpClient,
baseURL+UserServiceImportMemosProcedure,
connect.WithSchema(userServiceMethods.ByName("ImportMemos")),
connect.WithClientOptions(opts...),
),
}
}
// userServiceClient implements UserServiceClient.
type userServiceClient struct {
listUsers *connect.Client[api.ListUsersRequest, api.ListUsersResponse]
getUser *connect.Client[api.GetUserRequest, api.User]
batchGetUsers *connect.Client[api.BatchGetUsersRequest, api.BatchGetUsersResponse]
createUser *connect.Client[api.CreateUserRequest, api.User]
updateUser *connect.Client[api.UpdateUserRequest, api.User]
deleteUser *connect.Client[api.DeleteUserRequest, emptypb.Empty]
listUserSettings *connect.Client[api.ListUserSettingsRequest, api.ListUserSettingsResponse]
getUserSetting *connect.Client[api.GetUserSettingRequest, api.UserSetting]
updateUserSetting *connect.Client[api.UpdateUserSettingRequest, api.UserSetting]
listUserStats *connect.Client[api.ListUserStatsRequest, api.ListUserStatsResponse]
getUserStats *connect.Client[api.GetUserStatsRequest, api.UserStats]
getUserUsage *connect.Client[api.GetUserUsageRequest, api.UserUsage]
listMemoViews *connect.Client[api.ListMemoViewsRequest, api.ListMemoViewsResponse]
getMemoView *connect.Client[api.GetMemoViewRequest, api.MemoView]
createMemoView *connect.Client[api.CreateMemoViewRequest, api.MemoView]
updateMemoView *connect.Client[api.UpdateMemoViewRequest, api.MemoView]
deleteMemoView *connect.Client[api.DeleteMemoViewRequest, emptypb.Empty]
listUserNotifications *connect.Client[api.ListUserNotificationsRequest, api.ListUserNotificationsResponse]
updateUserNotification *connect.Client[api.UpdateUserNotificationRequest, api.UserNotification]
deleteUserNotification *connect.Client[api.DeleteUserNotificationRequest, emptypb.Empty]
listUserWebhooks *connect.Client[api.ListUserWebhooksRequest, api.ListUserWebhooksResponse]
createUserWebhook *connect.Client[api.CreateUserWebhookRequest, api.UserWebhook]
updateUserWebhook *connect.Client[api.UpdateUserWebhookRequest, api.UserWebhook]
deleteUserWebhook *connect.Client[api.DeleteUserWebhookRequest, emptypb.Empty]
getUserWebhookSigningSecret *connect.Client[api.GetUserWebhookSigningSecretRequest, api.GetUserWebhookSigningSecretResponse]
listLinkedIdentities *connect.Client[api.ListLinkedIdentitiesRequest, api.ListLinkedIdentitiesResponse]
getLinkedIdentity *connect.Client[api.GetLinkedIdentityRequest, api.LinkedIdentity]
createLinkedIdentity *connect.Client[api.CreateLinkedIdentityRequest, api.LinkedIdentity]
deleteLinkedIdentity *connect.Client[api.DeleteLinkedIdentityRequest, emptypb.Empty]
listPersonalAccessTokens *connect.Client[api.ListPersonalAccessTokensRequest, api.ListPersonalAccessTokensResponse]
createPersonalAccessToken *connect.Client[api.CreatePersonalAccessTokenRequest, api.CreatePersonalAccessTokenResponse]
deletePersonalAccessToken *connect.Client[api.DeletePersonalAccessTokenRequest, emptypb.Empty]
importMemos *connect.Client[api.ImportMemosRequest, api.ImportMemosResponse]
}
// ListUsers calls memos.api.UserService.ListUsers.
func (c *userServiceClient) ListUsers(ctx context.Context, req *connect.Request[api.ListUsersRequest]) (*connect.Response[api.ListUsersResponse], error) {
return c.listUsers.CallUnary(ctx, req)
}
// GetUser calls memos.api.UserService.GetUser.
func (c *userServiceClient) GetUser(ctx context.Context, req *connect.Request[api.GetUserRequest]) (*connect.Response[api.User], error) {
return c.getUser.CallUnary(ctx, req)
}
// BatchGetUsers calls memos.api.UserService.BatchGetUsers.
func (c *userServiceClient) BatchGetUsers(ctx context.Context, req *connect.Request[api.BatchGetUsersRequest]) (*connect.Response[api.BatchGetUsersResponse], error) {
return c.batchGetUsers.CallUnary(ctx, req)
}
// CreateUser calls memos.api.UserService.CreateUser.
func (c *userServiceClient) CreateUser(ctx context.Context, req *connect.Request[api.CreateUserRequest]) (*connect.Response[api.User], error) {
return c.createUser.CallUnary(ctx, req)
}
// UpdateUser calls memos.api.UserService.UpdateUser.
func (c *userServiceClient) UpdateUser(ctx context.Context, req *connect.Request[api.UpdateUserRequest]) (*connect.Response[api.User], error) {
return c.updateUser.CallUnary(ctx, req)
}
// DeleteUser calls memos.api.UserService.DeleteUser.
func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect.Request[api.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deleteUser.CallUnary(ctx, req)
}
// ListUserSettings calls memos.api.UserService.ListUserSettings.
func (c *userServiceClient) ListUserSettings(ctx context.Context, req *connect.Request[api.ListUserSettingsRequest]) (*connect.Response[api.ListUserSettingsResponse], error) {
return c.listUserSettings.CallUnary(ctx, req)
}
// GetUserSetting calls memos.api.UserService.GetUserSetting.
func (c *userServiceClient) GetUserSetting(ctx context.Context, req *connect.Request[api.GetUserSettingRequest]) (*connect.Response[api.UserSetting], error) {
return c.getUserSetting.CallUnary(ctx, req)
}
// UpdateUserSetting calls memos.api.UserService.UpdateUserSetting.
func (c *userServiceClient) UpdateUserSetting(ctx context.Context, req *connect.Request[api.UpdateUserSettingRequest]) (*connect.Response[api.UserSetting], error) {
return c.updateUserSetting.CallUnary(ctx, req)
}
// ListUserStats calls memos.api.UserService.ListUserStats.
func (c *userServiceClient) ListUserStats(ctx context.Context, req *connect.Request[api.ListUserStatsRequest]) (*connect.Response[api.ListUserStatsResponse], error) {
return c.listUserStats.CallUnary(ctx, req)
}
// GetUserStats calls memos.api.UserService.GetUserStats.
func (c *userServiceClient) GetUserStats(ctx context.Context, req *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error) {
return c.getUserStats.CallUnary(ctx, req)
}
// GetUserUsage calls memos.api.UserService.GetUserUsage.
func (c *userServiceClient) GetUserUsage(ctx context.Context, req *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error) {
return c.getUserUsage.CallUnary(ctx, req)
}
// ListMemoViews calls memos.api.UserService.ListMemoViews.
func (c *userServiceClient) ListMemoViews(ctx context.Context, req *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error) {
return c.listMemoViews.CallUnary(ctx, req)
}
// GetMemoView calls memos.api.UserService.GetMemoView.
func (c *userServiceClient) GetMemoView(ctx context.Context, req *connect.Request[api.GetMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return c.getMemoView.CallUnary(ctx, req)
}
// CreateMemoView calls memos.api.UserService.CreateMemoView.
func (c *userServiceClient) CreateMemoView(ctx context.Context, req *connect.Request[api.CreateMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return c.createMemoView.CallUnary(ctx, req)
}
// UpdateMemoView calls memos.api.UserService.UpdateMemoView.
func (c *userServiceClient) UpdateMemoView(ctx context.Context, req *connect.Request[api.UpdateMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return c.updateMemoView.CallUnary(ctx, req)
}
// DeleteMemoView calls memos.api.UserService.DeleteMemoView.
func (c *userServiceClient) DeleteMemoView(ctx context.Context, req *connect.Request[api.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deleteMemoView.CallUnary(ctx, req)
}
// ListUserNotifications calls memos.api.UserService.ListUserNotifications.
func (c *userServiceClient) ListUserNotifications(ctx context.Context, req *connect.Request[api.ListUserNotificationsRequest]) (*connect.Response[api.ListUserNotificationsResponse], error) {
return c.listUserNotifications.CallUnary(ctx, req)
}
// UpdateUserNotification calls memos.api.UserService.UpdateUserNotification.
func (c *userServiceClient) UpdateUserNotification(ctx context.Context, req *connect.Request[api.UpdateUserNotificationRequest]) (*connect.Response[api.UserNotification], error) {
return c.updateUserNotification.CallUnary(ctx, req)
}
// DeleteUserNotification calls memos.api.UserService.DeleteUserNotification.
func (c *userServiceClient) DeleteUserNotification(ctx context.Context, req *connect.Request[api.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deleteUserNotification.CallUnary(ctx, req)
}
// ListUserWebhooks calls memos.api.UserService.ListUserWebhooks.
func (c *userServiceClient) ListUserWebhooks(ctx context.Context, req *connect.Request[api.ListUserWebhooksRequest]) (*connect.Response[api.ListUserWebhooksResponse], error) {
return c.listUserWebhooks.CallUnary(ctx, req)
}
// CreateUserWebhook calls memos.api.UserService.CreateUserWebhook.
func (c *userServiceClient) CreateUserWebhook(ctx context.Context, req *connect.Request[api.CreateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error) {
return c.createUserWebhook.CallUnary(ctx, req)
}
// UpdateUserWebhook calls memos.api.UserService.UpdateUserWebhook.
func (c *userServiceClient) UpdateUserWebhook(ctx context.Context, req *connect.Request[api.UpdateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error) {
return c.updateUserWebhook.CallUnary(ctx, req)
}
// DeleteUserWebhook calls memos.api.UserService.DeleteUserWebhook.
func (c *userServiceClient) DeleteUserWebhook(ctx context.Context, req *connect.Request[api.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deleteUserWebhook.CallUnary(ctx, req)
}
// GetUserWebhookSigningSecret calls memos.api.UserService.GetUserWebhookSigningSecret.
func (c *userServiceClient) GetUserWebhookSigningSecret(ctx context.Context, req *connect.Request[api.GetUserWebhookSigningSecretRequest]) (*connect.Response[api.GetUserWebhookSigningSecretResponse], error) {
return c.getUserWebhookSigningSecret.CallUnary(ctx, req)
}
// ListLinkedIdentities calls memos.api.UserService.ListLinkedIdentities.
func (c *userServiceClient) ListLinkedIdentities(ctx context.Context, req *connect.Request[api.ListLinkedIdentitiesRequest]) (*connect.Response[api.ListLinkedIdentitiesResponse], error) {
return c.listLinkedIdentities.CallUnary(ctx, req)
}
// GetLinkedIdentity calls memos.api.UserService.GetLinkedIdentity.
func (c *userServiceClient) GetLinkedIdentity(ctx context.Context, req *connect.Request[api.GetLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error) {
return c.getLinkedIdentity.CallUnary(ctx, req)
}
// CreateLinkedIdentity calls memos.api.UserService.CreateLinkedIdentity.
func (c *userServiceClient) CreateLinkedIdentity(ctx context.Context, req *connect.Request[api.CreateLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error) {
return c.createLinkedIdentity.CallUnary(ctx, req)
}
// DeleteLinkedIdentity calls memos.api.UserService.DeleteLinkedIdentity.
func (c *userServiceClient) DeleteLinkedIdentity(ctx context.Context, req *connect.Request[api.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deleteLinkedIdentity.CallUnary(ctx, req)
}
// ListPersonalAccessTokens calls memos.api.UserService.ListPersonalAccessTokens.
func (c *userServiceClient) ListPersonalAccessTokens(ctx context.Context, req *connect.Request[api.ListPersonalAccessTokensRequest]) (*connect.Response[api.ListPersonalAccessTokensResponse], error) {
return c.listPersonalAccessTokens.CallUnary(ctx, req)
}
// CreatePersonalAccessToken calls memos.api.UserService.CreatePersonalAccessToken.
func (c *userServiceClient) CreatePersonalAccessToken(ctx context.Context, req *connect.Request[api.CreatePersonalAccessTokenRequest]) (*connect.Response[api.CreatePersonalAccessTokenResponse], error) {
return c.createPersonalAccessToken.CallUnary(ctx, req)
}
// DeletePersonalAccessToken calls memos.api.UserService.DeletePersonalAccessToken.
func (c *userServiceClient) DeletePersonalAccessToken(ctx context.Context, req *connect.Request[api.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) {
return c.deletePersonalAccessToken.CallUnary(ctx, req)
}
// ImportMemos calls memos.api.UserService.ImportMemos.
func (c *userServiceClient) ImportMemos(ctx context.Context, req *connect.Request[api.ImportMemosRequest]) (*connect.Response[api.ImportMemosResponse], error) {
return c.importMemos.CallUnary(ctx, req)
}
// UserServiceHandler is an implementation of the memos.api.UserService service.
type UserServiceHandler interface {
// ListUsers lists users in every state. Only admins may call it.
ListUsers(context.Context, *connect.Request[api.ListUsersRequest]) (*connect.Response[api.ListUsersResponse], error)
// GetUser gets a user by resource name.
GetUser(context.Context, *connect.Request[api.GetUserRequest]) (*connect.Response[api.User], error)
// BatchGetUsers gets active users by username. Usernames that match no
// active user are omitted from the response.
BatchGetUsers(context.Context, *connect.Request[api.BatchGetUsersRequest]) (*connect.Response[api.BatchGetUsersResponse], error)
// CreateUser creates a user. The first user of an instance becomes an admin.
// Otherwise, unless an admin calls it, the instance must allow user
// registration and password sign-up, and the new user gets the USER role.
CreateUser(context.Context, *connect.Request[api.CreateUserRequest]) (*connect.Response[api.User], error)
// UpdateUser updates a user. Users may update themselves; admins may update
// anyone. Changing the password ends the user's other sessions.
UpdateUser(context.Context, *connect.Request[api.UpdateUserRequest]) (*connect.Response[api.User], error)
// DeleteUser deletes a user. Users may delete themselves; admins may delete
// anyone. A user who belongs to any space cannot be deleted.
DeleteUser(context.Context, *connect.Request[api.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserSettings lists the settings of a user. Only the user may call it.
// The GENERAL setting is always included, with defaults when it was never
// saved.
ListUserSettings(context.Context, *connect.Request[api.ListUserSettingsRequest]) (*connect.Response[api.ListUserSettingsResponse], error)
// GetUserSetting gets a user setting. Only the user may call it.
GetUserSetting(context.Context, *connect.Request[api.GetUserSettingRequest]) (*connect.Response[api.UserSetting], error)
// UpdateUserSetting updates a user setting. Only the user may call it, and
// only the GENERAL and TAGS settings can be updated.
UpdateUserSetting(context.Context, *connect.Request[api.UpdateUserSettingRequest]) (*connect.Response[api.UserSetting], error)
// ListUserStats returns memo statistics for every user who created at least
// one matching memo the caller can read. Use the parent users/- for all
// users, or users/{user} for one user.
ListUserStats(context.Context, *connect.Request[api.ListUserStatsRequest]) (*connect.Response[api.ListUserStatsResponse], error)
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(context.Context, *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error)
// GetUserUsage returns a user's usage and the usage limits in effect for the
// user. Only the user or an admin may call it.
GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error)
// ListMemoViews lists 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. Only the user may call it.
ListMemoViews(context.Context, *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error)
// GetMemoView gets a memo view. Only the owner may call it.
GetMemoView(context.Context, *connect.Request[api.GetMemoViewRequest]) (*connect.Response[api.MemoView], error)
// CreateMemoView creates a memo view for a user. Only the user may call it.
CreateMemoView(context.Context, *connect.Request[api.CreateMemoViewRequest]) (*connect.Response[api.MemoView], error)
// UpdateMemoView updates a memo view. Only the owner may call it.
UpdateMemoView(context.Context, *connect.Request[api.UpdateMemoViewRequest]) (*connect.Response[api.MemoView], error)
// DeleteMemoView deletes a memo view. Only the owner may call it.
DeleteMemoView(context.Context, *connect.Request[api.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserNotifications lists a user's notifications. Only the user may call
// it. Notifications whose memos or space invitation the user can no longer
// read are left out.
ListUserNotifications(context.Context, *connect.Request[api.ListUserNotificationsRequest]) (*connect.Response[api.ListUserNotificationsResponse], error)
// UpdateUserNotification updates a notification's status. Only the receiver
// may call it.
UpdateUserNotification(context.Context, *connect.Request[api.UpdateUserNotificationRequest]) (*connect.Response[api.UserNotification], error)
// DeleteUserNotification permanently deletes a notification. Only the
// receiver may call it.
DeleteUserNotification(context.Context, *connect.Request[api.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error)
// ListUserWebhooks lists a user's webhooks. Only the user may call it.
ListUserWebhooks(context.Context, *connect.Request[api.ListUserWebhooksRequest]) (*connect.Response[api.ListUserWebhooksResponse], error)
// CreateUserWebhook creates a webhook for a user. Only the user may call it.
// The service generates a signing secret when none is given.
CreateUserWebhook(context.Context, *connect.Request[api.CreateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error)
// UpdateUserWebhook updates a webhook. Only the owner may call it.
UpdateUserWebhook(context.Context, *connect.Request[api.UpdateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error)
// DeleteUserWebhook deletes a webhook. Only the owner may call it.
DeleteUserWebhook(context.Context, *connect.Request[api.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error)
// GetUserWebhookSigningSecret returns the signing secret of a webhook. Only
// the owner may call it. The secret is returned only through this call; it
// is never included in List, Create or Update responses.
GetUserWebhookSigningSecret(context.Context, *connect.Request[api.GetUserWebhookSigningSecretRequest]) (*connect.Response[api.GetUserWebhookSigningSecretResponse], error)
// ListLinkedIdentities lists the SSO identities linked to a user. The user
// and admins may call it.
ListLinkedIdentities(context.Context, *connect.Request[api.ListLinkedIdentitiesRequest]) (*connect.Response[api.ListLinkedIdentitiesResponse], error)
// GetLinkedIdentity gets an SSO identity linked to a user. The user and
// admins may call it.
GetLinkedIdentity(context.Context, *connect.Request[api.GetLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error)
// CreateLinkedIdentity completes an OAuth flow and links the resulting SSO
// identity to the authenticated user, who must be the parent.
CreateLinkedIdentity(context.Context, *connect.Request[api.CreateLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error)
// DeleteLinkedIdentity unlinks an SSO identity from a user. The user and
// admins may call it.
DeleteLinkedIdentity(context.Context, *connect.Request[api.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error)
// ListPersonalAccessTokens lists a user's personal access tokens (PATs),
// without their token values. PATs are long-lived tokens for API and script
// access, distinct from short-lived JWT access tokens. The user and admins
// may call it.
ListPersonalAccessTokens(context.Context, *connect.Request[api.ListPersonalAccessTokensRequest]) (*connect.Response[api.ListPersonalAccessTokensResponse], error)
// CreatePersonalAccessToken creates a personal access token for a user.
// Only the user may call it. The token value is returned only once, in the
// response.
CreatePersonalAccessToken(context.Context, *connect.Request[api.CreatePersonalAccessTokenRequest]) (*connect.Response[api.CreatePersonalAccessTokenResponse], error)
// DeletePersonalAccessToken deletes a personal access token, which stops
// working immediately. Only the owner may call it.
DeletePersonalAccessToken(context.Context, *connect.Request[api.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error)
// ImportMemos uploads a Memos export file in bounded chunks and imports it
// into the user's memos. The first call carries the spec and returns an
// upload_id; later calls carry that upload_id. A finishing call with
// validate_only returns the plan and keeps the archive staged; a finishing
// call without it imports and returns the report. Uploads are bound to the
// authenticated user, expire after 30 minutes of inactivity, and do not
// survive a server restart.
ImportMemos(context.Context, *connect.Request[api.ImportMemosRequest]) (*connect.Response[api.ImportMemosResponse], error)
}
// NewUserServiceHandler 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 NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
userServiceMethods := api.File_api_user_service_proto.Services().ByName("UserService").Methods()
userServiceListUsersHandler := connect.NewUnaryHandler(
UserServiceListUsersProcedure,
svc.ListUsers,
connect.WithSchema(userServiceMethods.ByName("ListUsers")),
connect.WithHandlerOptions(opts...),
)
userServiceGetUserHandler := connect.NewUnaryHandler(
UserServiceGetUserProcedure,
svc.GetUser,
connect.WithSchema(userServiceMethods.ByName("GetUser")),
connect.WithHandlerOptions(opts...),
)
userServiceBatchGetUsersHandler := connect.NewUnaryHandler(
UserServiceBatchGetUsersProcedure,
svc.BatchGetUsers,
connect.WithSchema(userServiceMethods.ByName("BatchGetUsers")),
connect.WithHandlerOptions(opts...),
)
userServiceCreateUserHandler := connect.NewUnaryHandler(
UserServiceCreateUserProcedure,
svc.CreateUser,
connect.WithSchema(userServiceMethods.ByName("CreateUser")),
connect.WithHandlerOptions(opts...),
)
userServiceUpdateUserHandler := connect.NewUnaryHandler(
UserServiceUpdateUserProcedure,
svc.UpdateUser,
connect.WithSchema(userServiceMethods.ByName("UpdateUser")),
connect.WithHandlerOptions(opts...),
)
userServiceDeleteUserHandler := connect.NewUnaryHandler(
UserServiceDeleteUserProcedure,
svc.DeleteUser,
connect.WithSchema(userServiceMethods.ByName("DeleteUser")),
connect.WithHandlerOptions(opts...),
)
userServiceListUserSettingsHandler := connect.NewUnaryHandler(
UserServiceListUserSettingsProcedure,
svc.ListUserSettings,
connect.WithSchema(userServiceMethods.ByName("ListUserSettings")),
connect.WithHandlerOptions(opts...),
)
userServiceGetUserSettingHandler := connect.NewUnaryHandler(
UserServiceGetUserSettingProcedure,
svc.GetUserSetting,
connect.WithSchema(userServiceMethods.ByName("GetUserSetting")),
connect.WithHandlerOptions(opts...),
)
userServiceUpdateUserSettingHandler := connect.NewUnaryHandler(
UserServiceUpdateUserSettingProcedure,
svc.UpdateUserSetting,
connect.WithSchema(userServiceMethods.ByName("UpdateUserSetting")),
connect.WithHandlerOptions(opts...),
)
userServiceListUserStatsHandler := connect.NewUnaryHandler(
UserServiceListUserStatsProcedure,
svc.ListUserStats,
connect.WithSchema(userServiceMethods.ByName("ListUserStats")),
connect.WithHandlerOptions(opts...),
)
userServiceGetUserStatsHandler := connect.NewUnaryHandler(
UserServiceGetUserStatsProcedure,
svc.GetUserStats,
connect.WithSchema(userServiceMethods.ByName("GetUserStats")),
connect.WithHandlerOptions(opts...),
)
userServiceGetUserUsageHandler := connect.NewUnaryHandler(
UserServiceGetUserUsageProcedure,
svc.GetUserUsage,
connect.WithSchema(userServiceMethods.ByName("GetUserUsage")),
connect.WithHandlerOptions(opts...),
)
userServiceListMemoViewsHandler := connect.NewUnaryHandler(
UserServiceListMemoViewsProcedure,
svc.ListMemoViews,
connect.WithSchema(userServiceMethods.ByName("ListMemoViews")),
connect.WithHandlerOptions(opts...),
)
userServiceGetMemoViewHandler := connect.NewUnaryHandler(
UserServiceGetMemoViewProcedure,
svc.GetMemoView,
connect.WithSchema(userServiceMethods.ByName("GetMemoView")),
connect.WithHandlerOptions(opts...),
)
userServiceCreateMemoViewHandler := connect.NewUnaryHandler(
UserServiceCreateMemoViewProcedure,
svc.CreateMemoView,
connect.WithSchema(userServiceMethods.ByName("CreateMemoView")),
connect.WithHandlerOptions(opts...),
)
userServiceUpdateMemoViewHandler := connect.NewUnaryHandler(
UserServiceUpdateMemoViewProcedure,
svc.UpdateMemoView,
connect.WithSchema(userServiceMethods.ByName("UpdateMemoView")),
connect.WithHandlerOptions(opts...),
)
userServiceDeleteMemoViewHandler := connect.NewUnaryHandler(
UserServiceDeleteMemoViewProcedure,
svc.DeleteMemoView,
connect.WithSchema(userServiceMethods.ByName("DeleteMemoView")),
connect.WithHandlerOptions(opts...),
)
userServiceListUserNotificationsHandler := connect.NewUnaryHandler(
UserServiceListUserNotificationsProcedure,
svc.ListUserNotifications,
connect.WithSchema(userServiceMethods.ByName("ListUserNotifications")),
connect.WithHandlerOptions(opts...),
)
userServiceUpdateUserNotificationHandler := connect.NewUnaryHandler(
UserServiceUpdateUserNotificationProcedure,
svc.UpdateUserNotification,
connect.WithSchema(userServiceMethods.ByName("UpdateUserNotification")),
connect.WithHandlerOptions(opts...),
)
userServiceDeleteUserNotificationHandler := connect.NewUnaryHandler(
UserServiceDeleteUserNotificationProcedure,
svc.DeleteUserNotification,
connect.WithSchema(userServiceMethods.ByName("DeleteUserNotification")),
connect.WithHandlerOptions(opts...),
)
userServiceListUserWebhooksHandler := connect.NewUnaryHandler(
UserServiceListUserWebhooksProcedure,
svc.ListUserWebhooks,
connect.WithSchema(userServiceMethods.ByName("ListUserWebhooks")),
connect.WithHandlerOptions(opts...),
)
userServiceCreateUserWebhookHandler := connect.NewUnaryHandler(
UserServiceCreateUserWebhookProcedure,
svc.CreateUserWebhook,
connect.WithSchema(userServiceMethods.ByName("CreateUserWebhook")),
connect.WithHandlerOptions(opts...),
)
userServiceUpdateUserWebhookHandler := connect.NewUnaryHandler(
UserServiceUpdateUserWebhookProcedure,
svc.UpdateUserWebhook,
connect.WithSchema(userServiceMethods.ByName("UpdateUserWebhook")),
connect.WithHandlerOptions(opts...),
)
userServiceDeleteUserWebhookHandler := connect.NewUnaryHandler(
UserServiceDeleteUserWebhookProcedure,
svc.DeleteUserWebhook,
connect.WithSchema(userServiceMethods.ByName("DeleteUserWebhook")),
connect.WithHandlerOptions(opts...),
)
userServiceGetUserWebhookSigningSecretHandler := connect.NewUnaryHandler(
UserServiceGetUserWebhookSigningSecretProcedure,
svc.GetUserWebhookSigningSecret,
connect.WithSchema(userServiceMethods.ByName("GetUserWebhookSigningSecret")),
connect.WithHandlerOptions(opts...),
)
userServiceListLinkedIdentitiesHandler := connect.NewUnaryHandler(
UserServiceListLinkedIdentitiesProcedure,
svc.ListLinkedIdentities,
connect.WithSchema(userServiceMethods.ByName("ListLinkedIdentities")),
connect.WithHandlerOptions(opts...),
)
userServiceGetLinkedIdentityHandler := connect.NewUnaryHandler(
UserServiceGetLinkedIdentityProcedure,
svc.GetLinkedIdentity,
connect.WithSchema(userServiceMethods.ByName("GetLinkedIdentity")),
connect.WithHandlerOptions(opts...),
)
userServiceCreateLinkedIdentityHandler := connect.NewUnaryHandler(
UserServiceCreateLinkedIdentityProcedure,
svc.CreateLinkedIdentity,
connect.WithSchema(userServiceMethods.ByName("CreateLinkedIdentity")),
connect.WithHandlerOptions(opts...),
)
userServiceDeleteLinkedIdentityHandler := connect.NewUnaryHandler(
UserServiceDeleteLinkedIdentityProcedure,
svc.DeleteLinkedIdentity,
connect.WithSchema(userServiceMethods.ByName("DeleteLinkedIdentity")),
connect.WithHandlerOptions(opts...),
)
userServiceListPersonalAccessTokensHandler := connect.NewUnaryHandler(
UserServiceListPersonalAccessTokensProcedure,
svc.ListPersonalAccessTokens,
connect.WithSchema(userServiceMethods.ByName("ListPersonalAccessTokens")),
connect.WithHandlerOptions(opts...),
)
userServiceCreatePersonalAccessTokenHandler := connect.NewUnaryHandler(
UserServiceCreatePersonalAccessTokenProcedure,
svc.CreatePersonalAccessToken,
connect.WithSchema(userServiceMethods.ByName("CreatePersonalAccessToken")),
connect.WithHandlerOptions(opts...),
)
userServiceDeletePersonalAccessTokenHandler := connect.NewUnaryHandler(
UserServiceDeletePersonalAccessTokenProcedure,
svc.DeletePersonalAccessToken,
connect.WithSchema(userServiceMethods.ByName("DeletePersonalAccessToken")),
connect.WithHandlerOptions(opts...),
)
userServiceImportMemosHandler := connect.NewUnaryHandler(
UserServiceImportMemosProcedure,
svc.ImportMemos,
connect.WithSchema(userServiceMethods.ByName("ImportMemos")),
connect.WithHandlerOptions(opts...),
)
return "/memos.api.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case UserServiceListUsersProcedure:
userServiceListUsersHandler.ServeHTTP(w, r)
case UserServiceGetUserProcedure:
userServiceGetUserHandler.ServeHTTP(w, r)
case UserServiceBatchGetUsersProcedure:
userServiceBatchGetUsersHandler.ServeHTTP(w, r)
case UserServiceCreateUserProcedure:
userServiceCreateUserHandler.ServeHTTP(w, r)
case UserServiceUpdateUserProcedure:
userServiceUpdateUserHandler.ServeHTTP(w, r)
case UserServiceDeleteUserProcedure:
userServiceDeleteUserHandler.ServeHTTP(w, r)
case UserServiceListUserSettingsProcedure:
userServiceListUserSettingsHandler.ServeHTTP(w, r)
case UserServiceGetUserSettingProcedure:
userServiceGetUserSettingHandler.ServeHTTP(w, r)
case UserServiceUpdateUserSettingProcedure:
userServiceUpdateUserSettingHandler.ServeHTTP(w, r)
case UserServiceListUserStatsProcedure:
userServiceListUserStatsHandler.ServeHTTP(w, r)
case UserServiceGetUserStatsProcedure:
userServiceGetUserStatsHandler.ServeHTTP(w, r)
case UserServiceGetUserUsageProcedure:
userServiceGetUserUsageHandler.ServeHTTP(w, r)
case UserServiceListMemoViewsProcedure:
userServiceListMemoViewsHandler.ServeHTTP(w, r)
case UserServiceGetMemoViewProcedure:
userServiceGetMemoViewHandler.ServeHTTP(w, r)
case UserServiceCreateMemoViewProcedure:
userServiceCreateMemoViewHandler.ServeHTTP(w, r)
case UserServiceUpdateMemoViewProcedure:
userServiceUpdateMemoViewHandler.ServeHTTP(w, r)
case UserServiceDeleteMemoViewProcedure:
userServiceDeleteMemoViewHandler.ServeHTTP(w, r)
case UserServiceListUserNotificationsProcedure:
userServiceListUserNotificationsHandler.ServeHTTP(w, r)
case UserServiceUpdateUserNotificationProcedure:
userServiceUpdateUserNotificationHandler.ServeHTTP(w, r)
case UserServiceDeleteUserNotificationProcedure:
userServiceDeleteUserNotificationHandler.ServeHTTP(w, r)
case UserServiceListUserWebhooksProcedure:
userServiceListUserWebhooksHandler.ServeHTTP(w, r)
case UserServiceCreateUserWebhookProcedure:
userServiceCreateUserWebhookHandler.ServeHTTP(w, r)
case UserServiceUpdateUserWebhookProcedure:
userServiceUpdateUserWebhookHandler.ServeHTTP(w, r)
case UserServiceDeleteUserWebhookProcedure:
userServiceDeleteUserWebhookHandler.ServeHTTP(w, r)
case UserServiceGetUserWebhookSigningSecretProcedure:
userServiceGetUserWebhookSigningSecretHandler.ServeHTTP(w, r)
case UserServiceListLinkedIdentitiesProcedure:
userServiceListLinkedIdentitiesHandler.ServeHTTP(w, r)
case UserServiceGetLinkedIdentityProcedure:
userServiceGetLinkedIdentityHandler.ServeHTTP(w, r)
case UserServiceCreateLinkedIdentityProcedure:
userServiceCreateLinkedIdentityHandler.ServeHTTP(w, r)
case UserServiceDeleteLinkedIdentityProcedure:
userServiceDeleteLinkedIdentityHandler.ServeHTTP(w, r)
case UserServiceListPersonalAccessTokensProcedure:
userServiceListPersonalAccessTokensHandler.ServeHTTP(w, r)
case UserServiceCreatePersonalAccessTokenProcedure:
userServiceCreatePersonalAccessTokenHandler.ServeHTTP(w, r)
case UserServiceDeletePersonalAccessTokenProcedure:
userServiceDeletePersonalAccessTokenHandler.ServeHTTP(w, r)
case UserServiceImportMemosProcedure:
userServiceImportMemosHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedUserServiceHandler struct{}
func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect.Request[api.ListUsersRequest]) (*connect.Response[api.ListUsersResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListUsers is not implemented"))
}
func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect.Request[api.GetUserRequest]) (*connect.Response[api.User], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUser is not implemented"))
}
func (UnimplementedUserServiceHandler) BatchGetUsers(context.Context, *connect.Request[api.BatchGetUsersRequest]) (*connect.Response[api.BatchGetUsersResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.BatchGetUsers is not implemented"))
}
func (UnimplementedUserServiceHandler) CreateUser(context.Context, *connect.Request[api.CreateUserRequest]) (*connect.Response[api.User], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.CreateUser is not implemented"))
}
func (UnimplementedUserServiceHandler) UpdateUser(context.Context, *connect.Request[api.UpdateUserRequest]) (*connect.Response[api.User], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.UpdateUser is not implemented"))
}
func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect.Request[api.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeleteUser is not implemented"))
}
func (UnimplementedUserServiceHandler) ListUserSettings(context.Context, *connect.Request[api.ListUserSettingsRequest]) (*connect.Response[api.ListUserSettingsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListUserSettings is not implemented"))
}
func (UnimplementedUserServiceHandler) GetUserSetting(context.Context, *connect.Request[api.GetUserSettingRequest]) (*connect.Response[api.UserSetting], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserSetting is not implemented"))
}
func (UnimplementedUserServiceHandler) UpdateUserSetting(context.Context, *connect.Request[api.UpdateUserSettingRequest]) (*connect.Response[api.UserSetting], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.UpdateUserSetting is not implemented"))
}
func (UnimplementedUserServiceHandler) ListUserStats(context.Context, *connect.Request[api.ListUserStatsRequest]) (*connect.Response[api.ListUserStatsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListUserStats is not implemented"))
}
func (UnimplementedUserServiceHandler) GetUserStats(context.Context, *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserStats is not implemented"))
}
func (UnimplementedUserServiceHandler) GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserUsage is not implemented"))
}
func (UnimplementedUserServiceHandler) ListMemoViews(context.Context, *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListMemoViews is not implemented"))
}
func (UnimplementedUserServiceHandler) GetMemoView(context.Context, *connect.Request[api.GetMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetMemoView is not implemented"))
}
func (UnimplementedUserServiceHandler) CreateMemoView(context.Context, *connect.Request[api.CreateMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.CreateMemoView is not implemented"))
}
func (UnimplementedUserServiceHandler) UpdateMemoView(context.Context, *connect.Request[api.UpdateMemoViewRequest]) (*connect.Response[api.MemoView], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.UpdateMemoView is not implemented"))
}
func (UnimplementedUserServiceHandler) DeleteMemoView(context.Context, *connect.Request[api.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeleteMemoView is not implemented"))
}
func (UnimplementedUserServiceHandler) ListUserNotifications(context.Context, *connect.Request[api.ListUserNotificationsRequest]) (*connect.Response[api.ListUserNotificationsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListUserNotifications is not implemented"))
}
func (UnimplementedUserServiceHandler) UpdateUserNotification(context.Context, *connect.Request[api.UpdateUserNotificationRequest]) (*connect.Response[api.UserNotification], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.UpdateUserNotification is not implemented"))
}
func (UnimplementedUserServiceHandler) DeleteUserNotification(context.Context, *connect.Request[api.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeleteUserNotification is not implemented"))
}
func (UnimplementedUserServiceHandler) ListUserWebhooks(context.Context, *connect.Request[api.ListUserWebhooksRequest]) (*connect.Response[api.ListUserWebhooksResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListUserWebhooks is not implemented"))
}
func (UnimplementedUserServiceHandler) CreateUserWebhook(context.Context, *connect.Request[api.CreateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.CreateUserWebhook is not implemented"))
}
func (UnimplementedUserServiceHandler) UpdateUserWebhook(context.Context, *connect.Request[api.UpdateUserWebhookRequest]) (*connect.Response[api.UserWebhook], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.UpdateUserWebhook is not implemented"))
}
func (UnimplementedUserServiceHandler) DeleteUserWebhook(context.Context, *connect.Request[api.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeleteUserWebhook is not implemented"))
}
func (UnimplementedUserServiceHandler) GetUserWebhookSigningSecret(context.Context, *connect.Request[api.GetUserWebhookSigningSecretRequest]) (*connect.Response[api.GetUserWebhookSigningSecretResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserWebhookSigningSecret is not implemented"))
}
func (UnimplementedUserServiceHandler) ListLinkedIdentities(context.Context, *connect.Request[api.ListLinkedIdentitiesRequest]) (*connect.Response[api.ListLinkedIdentitiesResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListLinkedIdentities is not implemented"))
}
func (UnimplementedUserServiceHandler) GetLinkedIdentity(context.Context, *connect.Request[api.GetLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetLinkedIdentity is not implemented"))
}
func (UnimplementedUserServiceHandler) CreateLinkedIdentity(context.Context, *connect.Request[api.CreateLinkedIdentityRequest]) (*connect.Response[api.LinkedIdentity], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.CreateLinkedIdentity is not implemented"))
}
func (UnimplementedUserServiceHandler) DeleteLinkedIdentity(context.Context, *connect.Request[api.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeleteLinkedIdentity is not implemented"))
}
func (UnimplementedUserServiceHandler) ListPersonalAccessTokens(context.Context, *connect.Request[api.ListPersonalAccessTokensRequest]) (*connect.Response[api.ListPersonalAccessTokensResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListPersonalAccessTokens is not implemented"))
}
func (UnimplementedUserServiceHandler) CreatePersonalAccessToken(context.Context, *connect.Request[api.CreatePersonalAccessTokenRequest]) (*connect.Response[api.CreatePersonalAccessTokenResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.CreatePersonalAccessToken is not implemented"))
}
func (UnimplementedUserServiceHandler) DeletePersonalAccessToken(context.Context, *connect.Request[api.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.DeletePersonalAccessToken is not implemented"))
}
func (UnimplementedUserServiceHandler) ImportMemos(context.Context, *connect.Request[api.ImportMemosRequest]) (*connect.Response[api.ImportMemosResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ImportMemos is not implemented"))
}